From c69f990dfa36a922c6779fc0e48066e3bde62815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 16 Jun 2021 23:23:41 +0300 Subject: [PATCH] add hangzig test script --- .gitignore | 1 + hangzig | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 hangzig diff --git a/.gitignore b/.gitignore index 4542d01..9f934f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.sw[op] +/bazel /bazel-bin /bazel-bazel-zig-cc /bazel-out diff --git a/hangzig b/hangzig new file mode 100755 index 0000000..a8dda28 --- /dev/null +++ b/hangzig @@ -0,0 +1,34 @@ +#!/bin/bash +set -euo pipefail + +readonly bzl=https://github.com/bazelbuild/bazelisk/releases/download/v1.9.0/bazelisk-linux-amd64 + +set -x + +outside() { + if [[ ! -x bazel ]]; then + rm -f bazel + curl -L "$bzl" -o bazel + chmod +x bazel + fi + exec docker run -ti --rm -v $(pwd):/x -w /x \ + --cpus 2 \ + -m 4096MB \ + -e CC=/usr/bin/false \ + debian:bullseye ./hangzig inside + } + +inside() { + apt-get update && apt-get install -y ca-certificates + exec ./bazel build --platforms @zig_sdk//:aarch64-macos-gnu //test:gognu +} + + +case "${1:-}" in + "") + outside;; + inside) + inside;; + *) + exit 1; +esac