Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit a2a189f

Browse files
committed
Add script to build on scaleway
1 parent 700d660 commit a2a189f

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

cloud/scaleway.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -ne 1 ];then
4+
echo "Usage: $0 <android-9.0|android-8.1>"
5+
exit 1
6+
fi
7+
8+
android_version="$1"
9+
10+
set -ex
11+
12+
cleanup() {
13+
if [ -n "$name" ];then
14+
scw rm -f "$name"
15+
fi
16+
}
17+
18+
run_script() {
19+
echo "$1" > script.sh
20+
scw cp script.sh "$name":/tmp/
21+
scw exec "$name" 'bash /tmp/script.sh < /dev/null'
22+
}
23+
24+
trap 'cleanup' ERR
25+
trap 'cleanup' EXIT
26+
27+
COMMERCIAL_TYPE="GP1-S"
28+
suffix="$(echo "$RANDOM" |md5sum |cut -c 1-8)"
29+
name="phh-treble-$suffix"
30+
31+
echo "Running build on $name"
32+
33+
machine="$(scw run --ip-address=dynamic --commercial-type "$COMMERCIAL_TYPE" -d --name="$name" 'ubuntu-bionic$')"
34+
echo "... also called $machine"
35+
#scw attach --no-stdin "$name" &
36+
37+
scw exec -w "$name" echo "Good morning, now building"
38+
machine_ip="$(scw inspect server:phh-treble-3976258d |jq -r '.[0]|.public_ip.address')"
39+
run_script 'export DEBIAN_FRONTEND=noninteractive && dpkg --add-architecture i386 && \
40+
apt-get update && \
41+
(yes "" | apt-get install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" \
42+
build-essential \
43+
imagemagick \
44+
xorriso \
45+
locales \
46+
openjdk-8-jdk \
47+
python \
48+
git \
49+
m4 \
50+
unzip \
51+
bison \
52+
zip \
53+
gperf \
54+
libxml2-utils \
55+
zlib1g:i386 \
56+
libstdc++6:i386 \
57+
bc \
58+
curl \
59+
lzop \
60+
lzip \
61+
lunzip \
62+
squashfs-tools \
63+
sudo \
64+
repo \
65+
xmlstarlet \
66+
python-pip \
67+
python3-pip \
68+
git )'
69+
70+
run_script '
71+
git config --global user.name "Pierre-Hugues Husson" && \
72+
git config --global user.email [email protected] && \
73+
git config --global color.ui auto'
74+
75+
run_script 'git clone https://github.com/phhusson/treble_experimentations'
76+
77+
run_script '\
78+
mkdir build-dir && \
79+
sed -E -i "s/(repo sync.*)-j 1/\1-j24/g" treble_experimentations/build.sh && \
80+
sed -E -i "s/(make.*)-j8/\1-j24/g" treble_experimentations/build.sh
81+
'
82+
83+
run_script "cd build-dir && bash ../treble_experimentations/build.sh $android_version"
84+
85+
rsync -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -rv "root@$machine_ip:build-dir/release" release

0 commit comments

Comments
 (0)