Skip to content

Commit

Permalink
Add script to build on scaleway
Browse files Browse the repository at this point in the history
  • Loading branch information
phhusson committed Jul 6, 2019
1 parent 700d660 commit a2a189f
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions cloud/scaleway.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

if [ "$#" -ne 1 ];then
echo "Usage: $0 <android-9.0|android-8.1>"
exit 1
fi

android_version="$1"

set -ex

cleanup() {
if [ -n "$name" ];then
scw rm -f "$name"
fi
}

run_script() {
echo "$1" > script.sh
scw cp script.sh "$name":/tmp/
scw exec "$name" 'bash /tmp/script.sh < /dev/null'
}

trap 'cleanup' ERR
trap 'cleanup' EXIT

COMMERCIAL_TYPE="GP1-S"
suffix="$(echo "$RANDOM" |md5sum |cut -c 1-8)"
name="phh-treble-$suffix"

echo "Running build on $name"

machine="$(scw run --ip-address=dynamic --commercial-type "$COMMERCIAL_TYPE" -d --name="$name" 'ubuntu-bionic$')"
echo "... also called $machine"
#scw attach --no-stdin "$name" &

scw exec -w "$name" echo "Good morning, now building"
machine_ip="$(scw inspect server:phh-treble-3976258d |jq -r '.[0]|.public_ip.address')"
run_script 'export DEBIAN_FRONTEND=noninteractive && dpkg --add-architecture i386 && \
apt-get update && \
(yes "" | apt-get install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" \
build-essential \
imagemagick \
xorriso \
locales \
openjdk-8-jdk \
python \
git \
m4 \
unzip \
bison \
zip \
gperf \
libxml2-utils \
zlib1g:i386 \
libstdc++6:i386 \
bc \
curl \
lzop \
lzip \
lunzip \
squashfs-tools \
sudo \
repo \
xmlstarlet \
python-pip \
python3-pip \
git )'

run_script '
git config --global user.name "Pierre-Hugues Husson" && \
git config --global user.email [email protected] && \
git config --global color.ui auto'

run_script 'git clone https://github.com/phhusson/treble_experimentations'

run_script '\
mkdir build-dir && \
sed -E -i "s/(repo sync.*)-j 1/\1-j24/g" treble_experimentations/build.sh && \
sed -E -i "s/(make.*)-j8/\1-j24/g" treble_experimentations/build.sh
'

run_script "cd build-dir && bash ../treble_experimentations/build.sh $android_version"

rsync -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -rv "root@$machine_ip:build-dir/release" release

0 comments on commit a2a189f

Please sign in to comment.