authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-04 12:15:55-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-12-04 12:15:55-08:00
loga90de4eef5f490d9caff2e1b672fc2f09df9205b
treed7789a6bfee9abe923b1725645a3f9c2800702e0
parentc4853ba7ea007f46f8680749c028767287d39f68
parent55838bc2910f3f73762ea513536b74af056ed9ec
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #7301 from LemonBoy/more-ci-stuff

Make the CI script more robust

1 files changed, 25 insertions(+), 19 deletions(-)

ci/azure/linux_script+25-19
...@@ -3,40 +3,46 @@...@@ -3,40 +3,46 @@
3set -x3set -x
4set -e4set -e
55
6# This parameters we wait at most 2mins, it should be enough to sort out any
7# transient error.
8CMD_MAX_RETRY=12
9CMD_WAIT_TIME=10s
10
11# Execute the given command and, in case of failure, try to execute it again
12# after sleeping for CMD_WAIT_TIME.
13# We give up after retrying CMD_MAX_RETRY times.
14retry() {
15 for i in $(seq 1 "$CMD_MAX_RETRY"); do
16 eval "$@" && return
17 echo "command \"$@\" failed, retrying..."
18 sleep ${CMD_WAIT_TIME}
19 done
20
21 echo "command \"$@\" failed, giving up..."
22 exit 1
23}
24
6BUILDDIR="$(pwd)"25BUILDDIR="$(pwd)"
726
8sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list'27sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" >> /etc/apt/sources.list'
9wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -28retry 'wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -'
10sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test29retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
1130
12sudo apt-get remove -y llvm-*31sudo apt-get remove -y llvm-*
13sudo rm -rf /usr/local/*32sudo rm -rf /usr/local/*
1433
15# Some APT mirrors can be flaky, retry the download instead of failing right34retry sudo apt-get update -q
16# away.35retry sudo apt-get install -y \
17APT_MAX_RETRY=3
18
19for i in $(seq 1 "$APT_MAX_RETRY"); do
20 sudo apt-get update -q
21 sudo apt-get install -y \
22 libxml2-dev libclang-11-dev llvm-11 llvm-11-dev liblld-11-dev cmake s3cmd \36 libxml2-dev libclang-11-dev llvm-11 llvm-11-dev liblld-11-dev cmake s3cmd \
23 gcc-7 g++-7 ninja-build tidy \37 gcc-7 g++-7 ninja-build tidy \
24 && break
25 if [ "$i" -eq "$APT_MAX_RETRY" ]; then
26 echo 'apt-get failed, giving up...'
27 exit 1
28 fi
29 echo 'apt-get failed, retrying...'
30 sleep 5s
31done
3238
33QEMUBASE="qemu-linux-x86_64-5.1.0"39QEMUBASE="qemu-linux-x86_64-5.1.0"
34wget https://ziglang.org/deps/$QEMUBASE.tar.xz40wget -nv https://ziglang.org/deps/$QEMUBASE.tar.xz
35tar xf $QEMUBASE.tar.xz41tar xf $QEMUBASE.tar.xz
36PATH=$PWD/$QEMUBASE/bin:$PATH42PATH=$PWD/$QEMUBASE/bin:$PATH
3743
38WASMTIME="wasmtime-v0.20.0-x86_64-linux"44WASMTIME="wasmtime-v0.20.0-x86_64-linux"
39wget https://github.com/bytecodealliance/wasmtime/releases/download/v0.20.0/$WASMTIME.tar.xz45wget -nv https://github.com/bytecodealliance/wasmtime/releases/download/v0.20.0/$WASMTIME.tar.xz
40tar xf $WASMTIME.tar.xz46tar xf $WASMTIME.tar.xz
41PATH=$PWD/$WASMTIME:$PATH47PATH=$PWD/$WASMTIME:$PATH
4248