mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
5001faa690
Each of the 3 CI services now trigger a sr.ht build via the on_master_success script. The sr.ht build checks if all builds have completed successfully by trying to download the JSON file for the particular version. If all builds have completed successfully then this sr.ht job will update the download page.
58 lines
2.1 KiB
Bash
Executable File
58 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
BUILDDIR="$(pwd)"
|
|
|
|
sudo sh -c 'echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list'
|
|
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
|
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
|
sudo apt-get update -q
|
|
|
|
sudo apt-get remove -y llvm-*
|
|
sudo rm -rf /usr/local/*
|
|
sudo apt-get install -y libxml2-dev libclang-9-dev llvm-9 llvm-9-dev cmake s3cmd gcc-7 g++-7 qemu
|
|
|
|
# Make the `zig version` number consistent.
|
|
# This will affect the cmake command below.
|
|
git config core.abbrev 9
|
|
|
|
export CC=gcc-7
|
|
export CXX=g++-7
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release
|
|
make -j2 install
|
|
./zig build test -Denable-qemu
|
|
VERSION="$(./zig version)"
|
|
|
|
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
|
ARTIFACTSDIR="$BUILDDIR/artifacts"
|
|
mkdir "$ARTIFACTSDIR"
|
|
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm9-x86_64 -j2 $BUILD_SOURCEVERSION
|
|
TARBALL="$(ls $ARTIFACTSDIR)"
|
|
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
|
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$ARTIFACTSDIR/$TARBALL" s3://ziglang.org/builds/
|
|
|
|
SHASUM=$(sha256sum $ARTIFACTSDIR/$TARBALL | cut '-d ' -f1)
|
|
BYTESIZE=$(wc -c < $ARTIFACTSDIR/$TARBALL)
|
|
|
|
JSONFILE="linux-$GITBRANCH.json"
|
|
touch $JSONFILE
|
|
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
|
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
|
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
|
|
|
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
|
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-linux-$VERSION.json"
|
|
|
|
# `set -x` causes these variables to be mangled.
|
|
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
|
set +x
|
|
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
|
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
|
|
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
|
|
echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION"
|
|
fi
|