a65ba6c85a
This service stopped working two days ago for unknown reasons. Until it is determined how to get it working again, or we switch to a different CI provider for aarch64, this CI test coverage is disabled so that we can continue to use the CI for other targets.
151 lines
7.0 KiB
Bash
Executable File
151 lines
7.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
VERSION="$1"
|
|
SRCDIR="$(pwd)"
|
|
NATIVE_TARBALL="zig-linux-$(uname -m)-$VERSION.tar.xz"
|
|
|
|
# Check for all the builds being completed. It's expected that this script is run several times
|
|
# before they are all complete.
|
|
#AARCH64_LINUX_JSON_URL="https://ziglang.org/builds/aarch64-linux-$VERSION.json"
|
|
X86_64_LINUX_JSON_URL="https://ziglang.org/builds/x86_64-linux-$VERSION.json"
|
|
X86_64_WINDOWS_JSON_URL="https://ziglang.org/builds/x86_64-windows-$VERSION.json"
|
|
AARCH64_MACOS_JSON_URL="https://ziglang.org/builds/aarch64-macos-$VERSION.json"
|
|
X86_64_MACOS_JSON_URL="https://ziglang.org/builds/x86_64-macos-$VERSION.json"
|
|
X86_64_FREEBSD_JSON_URL="https://ziglang.org/builds/x86_64-freebsd-$VERSION.json"
|
|
#X86_64_NETBSD_JSON_URL="https://ziglang.org/builds/x86_64-netbsd-$VERSION.json"
|
|
|
|
# If any of these fail, it's not really this job failing; rather we have detected
|
|
# that this job will be called again later when other jobs have completed.
|
|
#curl --fail -I "$AARCH64_LINUX_JSON_URL" >/dev/null || exit 0
|
|
curl --fail -I "$X86_64_LINUX_JSON_URL" >/dev/null || exit 0
|
|
curl --fail -I "$X86_64_WINDOWS_JSON_URL" >/dev/null || exit 0
|
|
curl --fail -I "$AARCH64_MACOS_JSON_URL" >/dev/null || exit 0
|
|
curl --fail -I "$X86_64_MACOS_JSON_URL" >/dev/null || exit 0
|
|
curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
|
|
#curl --fail -I "$X86_64_NETBSD_JSON_URL" >/dev/null || exit 0
|
|
|
|
# Without --user, this gave me:
|
|
# ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
|
|
pip3 install s3cmd --user
|
|
S3CMD="$HOME/.local/bin/s3cmd"
|
|
|
|
# This is the user when pushing to the website repo.
|
|
git config --global user.email "ziggy@ziglang.org"
|
|
git config --global user.name "Ziggy"
|
|
|
|
# Refresh this with `ssh-keyscan github.com` from a trusted Internet connection.
|
|
# We hard code the public key here to detect man-in-the-middle attacks.
|
|
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
|
|
|
|
# We don't want the .git folder inside the tarball.
|
|
rm -rf .git
|
|
|
|
cd "$HOME"
|
|
wget "https://ziglang.org/builds/$NATIVE_TARBALL"
|
|
tar xf "$NATIVE_TARBALL"
|
|
ZIGDIR="$(pwd)/$(basename $NATIVE_TARBALL .tar.xz)"
|
|
ZIG="$ZIGDIR/zig"
|
|
LANGREF="$ZIGDIR/doc/langref.html"
|
|
SRCTARBALLDIR="zig-$VERSION"
|
|
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
|
|
mv "$SRCDIR" "$SRCTARBALLDIR"
|
|
tar cfJ "$SRC_TARBALL" "$SRCTARBALLDIR"
|
|
export SRC_SHASUM=$(sha256sum $SRC_TARBALL | cut '-d ' -f1)
|
|
export SRC_BYTESIZE=$(wc -c < $SRC_TARBALL)
|
|
|
|
X86_64_WINDOWS_JSON=$(curl --fail "$X86_64_WINDOWS_JSON_URL" || exit 1)
|
|
export X86_64_WINDOWS_TARBALL="$(echo "$X86_64_WINDOWS_JSON" | jq .tarball -r)"
|
|
export X86_64_WINDOWS_BYTESIZE="$(echo "$X86_64_WINDOWS_JSON" | jq .size -r)"
|
|
export X86_64_WINDOWS_SHASUM="$(echo "$X86_64_WINDOWS_JSON" | jq .shasum -r)"
|
|
|
|
AARCH64_MACOS_JSON=$(curl --fail "$AARCH64_MACOS_JSON_URL" || exit 1)
|
|
export AARCH64_MACOS_TARBALL="$(echo "$AARCH64_MACOS_JSON" | jq .tarball -r)"
|
|
export AARCH64_MACOS_BYTESIZE="$(echo "$AARCH64_MACOS_JSON" | jq .size -r)"
|
|
export AARCH64_MACOS_SHASUM="$(echo "$AARCH64_MACOS_JSON" | jq .shasum -r)"
|
|
|
|
X86_64_MACOS_JSON=$(curl --fail "$X86_64_MACOS_JSON_URL" || exit 1)
|
|
export X86_64_MACOS_TARBALL="$(echo "$X86_64_MACOS_JSON" | jq .tarball -r)"
|
|
export X86_64_MACOS_BYTESIZE="$(echo "$X86_64_MACOS_JSON" | jq .size -r)"
|
|
export X86_64_MACOS_SHASUM="$(echo "$X86_64_MACOS_JSON" | jq .shasum -r)"
|
|
|
|
X86_64_LINUX_JSON=$(curl --fail "$X86_64_LINUX_JSON_URL" || exit 1)
|
|
export X86_64_LINUX_TARBALL="$(echo "$X86_64_LINUX_JSON" | jq .tarball -r)"
|
|
export X86_64_LINUX_BYTESIZE="$(echo "$X86_64_LINUX_JSON" | jq .size -r)"
|
|
export X86_64_LINUX_SHASUM="$(echo "$X86_64_LINUX_JSON" | jq .shasum -r)"
|
|
|
|
#AARCH64_LINUX_JSON=$(curl --fail "$AARCH64_LINUX_JSON_URL" || exit 1)
|
|
#export AARCH64_LINUX_TARBALL="$(echo "$AARCH64_LINUX_JSON" | jq .tarball -r)"
|
|
#export AARCH64_LINUX_BYTESIZE="$(echo "$AARCH64_LINUX_JSON" | jq .size -r)"
|
|
#export AARCH64_LINUX_SHASUM="$(echo "$AARCH64_LINUX_JSON" | jq .shasum -r)"
|
|
|
|
X86_64_FREEBSD_JSON=$(curl --fail "$X86_64_FREEBSD_JSON_URL" || exit 1)
|
|
export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
|
|
export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
|
|
export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
|
|
|
|
#X86_64_NETBSD_JSON=$(curl --fail "$X86_64_NETBSD_JSON_URL" || exit 1)
|
|
#export X86_64_NETBSD_TARBALL="$(echo "$X86_64_NETBSD_JSON" | jq .tarball -r)"
|
|
#export X86_64_NETBSD_BYTESIZE="$(echo "$X86_64_NETBSD_JSON" | jq .size -r)"
|
|
#export X86_64_NETBSD_SHASUM="$(echo "$X86_64_NETBSD_JSON" | jq .shasum -r)"
|
|
|
|
export MASTER_DATE="$(date +%Y-%m-%d)"
|
|
export MASTER_VERSION="$VERSION"
|
|
|
|
# Create index.json and update the website repo.
|
|
cd "$SRCTARBALLDIR/ci/srht"
|
|
"$ZIG" run update-download-page.zig
|
|
CIDIR="$(pwd)"
|
|
|
|
cd "$HOME"
|
|
|
|
# Update autodocs and langref directly to S3 in order to prevent the
|
|
# www.ziglang.org git repo from growing too big.
|
|
|
|
# Please do not edit this script to pre-compress the artifacts before they hit
|
|
# S3. This prevents the website from working on browsers that do not support gzip
|
|
# encoding. Cloudfront will automatically compress files if they are less than
|
|
# 9.5 MiB, and the client advertises itself as capable of decompressing.
|
|
# The data.js file is currently 16 MiB. In order to fix this problem, we need to do
|
|
# one of the following things:
|
|
# * Reduce the size of data.js to less than 9.5 MiB.
|
|
# * Figure out how to adjust the Cloudfront settings to increase the max size for
|
|
# auto-compressed objects.
|
|
# * Migrate to fastly.
|
|
$S3CMD put -P --no-mime-magic \
|
|
--add-header="Cache-Control: max-age=0, must-revalidate" \
|
|
"$LANGREF" s3://ziglang.org/documentation/master/index.html
|
|
|
|
$S3CMD put -P --no-mime-magic \
|
|
--add-header="Cache-Control: max-age=0, must-revalidate" \
|
|
"$ZIGDIR/doc/std/index.html" s3://ziglang.org/documentation/master/std/index.html
|
|
|
|
$S3CMD put -P --no-mime-magic \
|
|
--add-header="Cache-Control: max-age=0, must-revalidate" \
|
|
"$ZIGDIR/doc/std/main.js" s3://ziglang.org/documentation/master/std/main.js
|
|
|
|
$S3CMD put -P --no-mime-magic \
|
|
--add-header="Cache-Control: max-age=0, must-revalidate" \
|
|
"$ZIGDIR/doc/std/data.js" s3://ziglang.org/documentation/master/std/data.js
|
|
|
|
$S3CMD put -P --no-mime-magic --recursive \
|
|
--add-header="Cache-Control: max-age=0, must-revalidate" \
|
|
-m "text/html" \
|
|
"$ZIGDIR/doc/std/src/" s3://ziglang.org/documentation/master/std/src/
|
|
|
|
$S3CMD put -P --no-mime-magic \
|
|
--add-header="cache-control: public, max-age=31536000, immutable" \
|
|
"$HOME/$SRC_TARBALL" s3://ziglang.org/builds/
|
|
|
|
git clone --depth 1 git@github.com:ziglang/www.ziglang.org.git
|
|
cd www.ziglang.org
|
|
WWWDIR="$(pwd)"
|
|
|
|
cd "$WWWDIR"
|
|
cp "$CIDIR/out/index.json" data/releases.json
|
|
git add data/releases.json
|
|
git commit -m "CI: update releases"
|
|
git push origin master
|