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.
68 lines
2.2 KiB
Bash
Executable File
68 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
TRIPLEARCH="$(uname -m)"
|
|
BUILDDIR="$(pwd)"
|
|
DISTDIR="$(pwd)/dist"
|
|
|
|
apk update
|
|
apk add py3-pip xz perl-utils jq curl
|
|
pip3 install s3cmd
|
|
|
|
# Make the `zig version` number consistent.
|
|
# This will affect the cmake command below.
|
|
git config core.abbrev 9
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local
|
|
|
|
make -j$(nproc) install
|
|
./zig build test-fmt test-behavior test-std test-compiler-rt -Dskip-release
|
|
# TODO test-compare-output is hitting https://github.com/ziglang/zig/issues/3526
|
|
./zig build test-standalone test-stack-traces
|
|
# TODO test-cli is hitting https://github.com/ziglang/zig/issues/3526
|
|
./zig build test-asm-link test-runtime-safety
|
|
# TODO test-translate-c is hitting https://github.com/ziglang/zig/issues/3526
|
|
./zig build test-gen-h
|
|
# TODO test-compile-errors is hitting https://github.com/ziglang/zig/issues/3526
|
|
# TODO building docs is hitting https://github.com/ziglang/zig/issues/3526
|
|
|
|
# TODO full test suite:
|
|
#./zig build test
|
|
|
|
if [ -z "$DRONE_PULL_REQUEST" ]; then
|
|
mv ../LICENSE "$DISTDIR/"
|
|
# TODO uncomment when the docs are generated
|
|
# mv ../zig-cache/langref.html "$DISTDIR/"
|
|
mv "$DISTDIR/bin/zig" "$DISTDIR/"
|
|
rmdir "$DISTDIR/bin"
|
|
|
|
GITBRANCH="$DRONE_BRANCH"
|
|
VERSION="$("$DISTDIR/zig" version)"
|
|
DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
|
|
TARBALL="$DIRNAME.tar.xz"
|
|
mv "$DISTDIR" "$DIRNAME"
|
|
tar cfJ "$TARBALL" "$DIRNAME"
|
|
|
|
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
|
|
|
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
|
|
BYTESIZE=$(wc -c < $TARBALL)
|
|
|
|
JSONFILE="$TRIPLEARCH-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/$TRIPLEARCH-linux-$VERSION.json"
|
|
if [ "$GITBRANCH" = "master" ]; then
|
|
cd "$BUILDDIR"
|
|
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
|
|
fi
|
|
fi
|