2021-06-16 23:23:41 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
readonly bzl=https://github.com/bazelbuild/bazelisk/releases/download/v1.9.0/bazelisk-linux-amd64
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
outside() {
|
2021-06-16 23:45:51 +03:00
|
|
|
git clean -ffxd --exclude bazel
|
2021-06-16 23:23:41 +03:00
|
|
|
if [[ ! -x bazel ]]; then
|
|
|
|
rm -f bazel
|
|
|
|
curl -L "$bzl" -o bazel
|
|
|
|
chmod +x bazel
|
|
|
|
fi
|
2021-06-18 11:16:08 +03:00
|
|
|
exec docker run --privileged -ti --rm -v $(pwd):/x -w /x --name hangzig \
|
2021-06-16 23:30:58 +03:00
|
|
|
--cpuset-cpus 0-1 \
|
2021-06-16 23:23:41 +03:00
|
|
|
-m 4096MB \
|
|
|
|
-e CC=/usr/bin/false \
|
2021-06-16 23:59:26 +03:00
|
|
|
debian:testing ./hangzig inside
|
2021-06-16 23:23:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inside() {
|
2021-06-18 10:18:58 +03:00
|
|
|
apt-get update && apt-get install -y ca-certificates
|
2021-06-16 23:26:35 +03:00
|
|
|
exec ./bazel build -s --platforms @zig_sdk//:aarch64-macos-gnu //test:gognu
|
2021-06-16 23:23:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
case "${1:-}" in
|
|
|
|
"")
|
|
|
|
outside;;
|
|
|
|
inside)
|
|
|
|
inside;;
|
|
|
|
*)
|
|
|
|
exit 1;
|
|
|
|
esac
|