From 3a204583f395ee10e1817325720cba897ff59b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 8 Mar 2023 17:33:59 +0200 Subject: [PATCH] all commands: use /tmp/bazel-zig-cc (#6) Different Bazel instances can share the zig cache all right. --- .bazelrc | 2 -- .buildkite/pipeline.yml | 11 +++-------- .buildkite/setup-bazelrc.sh | 15 --------------- bin/mod-tidy | 2 +- ci/lint | 1 - ci/test | 8 ++++++-- 6 files changed, 10 insertions(+), 29 deletions(-) delete mode 100755 .buildkite/setup-bazelrc.sh diff --git a/.bazelrc b/.bazelrc index 0bd600e..dc904bb 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,5 +7,3 @@ build --worker_sandboxing build --experimental_reuse_sandbox_directories build --incompatible_enable_cc_toolchain_resolution build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 - -try-import %workspace%/.custom.ci.bazelrc diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index de15ee4..f0ff564 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -3,15 +3,11 @@ steps: - label: "Test" - command: | - . .buildkite/setup-bazelrc.sh - ci/test + command: ci/test - label: "Lint" - command: | - . .buildkite/setup-bazelrc.sh - ci/lint + command: ci/lint - label: "List Platforms" - command: "ci/list_toolchains_platforms" + command: ci/list_toolchains_platforms - label: "Test Release and Launcher scripts" command: | git config --global user.email "buildkite@example.com" @@ -31,7 +27,6 @@ steps: ci/launcher-wine64 - label: "mod-tidy and update-repos" command: | - . .buildkite/setup-bazelrc.sh bin/mod-tidy git diff --exit-code agents: diff --git a/.buildkite/setup-bazelrc.sh b/.buildkite/setup-bazelrc.sh deleted file mode 100755 index bbb811f..0000000 --- a/.buildkite/setup-bazelrc.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2023 Uber Technologies, Inc. -# Licensed under the Apache License, Version 2.0 - -if [ -z "${BUILDKITE_BUILD_NUMBER:-}" ]; then - >&2 echo "error: expected to run in buildkite" - exit 1 -fi - -export BAZEL_ZIG_CC_CACHE_PREFIX="/tmp/bazel-zig-cc${BUILDKITE_BUILD_NUMBER}" -mkdir -p "$BAZEL_ZIG_CC_CACHE_PREFIX" - -cat > .custom.ci.bazelrc < /dev/null; then mapfile -t files < \ <(git ls-files) diff --git a/ci/test b/ci/test index bd81b0b..4d6f75f 100755 --- a/ci/test +++ b/ci/test @@ -5,22 +5,26 @@ set -xeuo pipefail +cache_prefix="${BAZEL_ZIG_CC_CACHE_PREFIX:-/tmp/bazel-zig-cc}" + # check a very hermetic setup with a single target. Re-building all of # them takes a long time, so using only one. If we ever decide to build all # targets, we will need to exclude Go, since go dynamically links to glibc on # linux. + echo "--- build a single target with very hermetic sandbox" tools/bazel build "$@" \ --experimental_use_hermetic_linux_sandbox \ + --sandbox_writable_path="$cache_prefix" \ --sandbox_add_mount_pair=/proc \ //test/c:which_libc_linux_amd64_gnu.2.19 # then test everything else with the standard sandbox -echo "--- bazel test $@ ..." +echo "--- bazel test $* ..." tools/bazel test "$@" ... echo "--- ensure github.com/ziglang/zig/issues/13050 does not regress" -find "${BAZEL_ZIG_CC_CACHE_PREFIX:-/tmp/bazel-zig-cc}" \ +find "$cache_prefix" \ -name mutex_destructor.o -execdir file '{}' \; \ | sort \ | uniq -c \