From af9360366bc52dc066a49e68339e845fa9040e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 6 Mar 2023 17:32:48 +0200 Subject: [PATCH] More CI (#3) - ci only: use a separate zig cache dir for each run - use `tools/bazel` everywhere. - remove arm64 tests. They don't give enough value to be worth the brittle environment. - remove windows execution, except for launcher. Ditto. I will probably bring them back. --- .bazelrc | 2 ++ .buildkite/pipeline.yml | 37 +++++++++++++++++++++++++++++++++--- .buildkite/setup-bazelrc.sh | 15 +++++++++++++++ .gitignore | 2 ++ bin/buildifier | 8 ++++++-- bin/mod-tidy | 9 ++++++--- ci/launcher | 14 +++++--------- ci/launcher-wine64 | 18 ++++++++++++++++++ ci/list_toolchains_platforms | 20 +++++++++---------- ci/test | 18 ++++++++++-------- release | 5 +++-- test/c/BUILD | 4 ---- test/cgo/BUILD | 4 ---- test/windows/BUILD | 13 ++++++++++--- 14 files changed, 121 insertions(+), 48 deletions(-) create mode 100755 .buildkite/setup-bazelrc.sh create mode 100755 ci/launcher-wine64 diff --git a/.bazelrc b/.bazelrc index dc904bb..0bd600e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,3 +7,5 @@ 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 8b6054c..de15ee4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,8 +1,39 @@ +# Copyright 2023 Uber Technologies, Inc. +# Licensed under the Apache License, Version 2.0 + steps: - - label: "Build" - command: tools/bazel build //... + - label: "Test" + command: | + . .buildkite/setup-bazelrc.sh + ci/test - label: "Lint" - command: ci/lint + command: | + . .buildkite/setup-bazelrc.sh + ci/lint + - label: "List Platforms" + command: "ci/list_toolchains_platforms" + - label: "Test Release and Launcher scripts" + command: | + git config --global user.email "buildkite@example.com" + git config --global user.name "Buildkite Bot" + + echo "--- ci/release" + ci/release + echo "--- ci/launcher" + ci/launcher + - label: "Test Launcher on wine64" + plugins: + - docker#v5.5.0: + image: "debian:stable" + command: | + apt-get update && apt-get install --no-install-recommends -y \ + wine64 python3 ca-certificates + ci/launcher-wine64 + - label: "mod-tidy and update-repos" + command: | + . .buildkite/setup-bazelrc.sh + bin/mod-tidy + git diff --exit-code agents: - "queue=init" - "docker=*" diff --git a/.buildkite/setup-bazelrc.sh b/.buildkite/setup-bazelrc.sh new file mode 100755 index 0000000..bbb811f --- /dev/null +++ b/.buildkite/setup-bazelrc.sh @@ -0,0 +1,15 @@ +# 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 < /tmp/got_cache +echo "--- ensure github.com/ziglang/zig/issues/13050 does not regress" +find "${BAZEL_ZIG_CC_CACHE_PREFIX:-/tmp/bazel-zig-cc}" \ + -name mutex_destructor.o -execdir file '{}' \; \ + | sort \ + | uniq -c \ + | sort -rn > /tmp/got_cache diff -u ci/testdata/want_cache /tmp/got_cache || { >&2 echo "ERROR: unexpected artifacts. This is TODO." diff --git a/release b/release index faaf8d2..8c6dae7 100755 --- a/release +++ b/release @@ -27,12 +27,13 @@ last_tag=$(git -c 'versionsort.suffix=-' tag -l --sort=v:refname | tail -1) echo Changelog since "$last_tag": git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD | \ grep -v "Update release notes for $last_tag" -} | git tag "${sign[@]}" -F - "$1" +} | git tag "${sign[@]+"${sign[@]}"}" -F - "$1" shasum=$(git archive --prefix="bazel-zig-cc-$1/" --format=tar "$1" | \ gzip -n | sha256sum | cut -f1 -d" ") -./relnotes.awk -v tag="$1" -v sha256sum="$shasum" README.md | sponge README.md +./relnotes.awk -v tag="$1" -v sha256sum="$shasum" README.md > .README.md +mv .README.md README.md git add README.md git commit -m "Update release notes for $1" diff --git a/test/c/BUILD b/test/c/BUILD index 950f97d..a91459f 100644 --- a/test/c/BUILD +++ b/test/c/BUILD @@ -13,9 +13,7 @@ cc_binary( platform_binary( name = "which_libc_{}".format(name), src = "which_libc", - env = {"QEMU_LD_PREFIX": "/usr/aarch64-linux-gnu"} if "arm64" in name else {}, platform = platform, - run_under = "qemu-aarch64-static" if "arm64" in name else "", ), sh_test( name = "test_libc_{}".format(name), @@ -31,8 +29,6 @@ cc_binary( ("linux_amd64_musl", "//libc_aware/platform:linux_amd64_musl", "non-glibc"), ("linux_amd64_gnu.2.19", "//libc_aware/platform:linux_amd64_gnu.2.19", "glibc_2.19"), ("linux_amd64_gnu.2.28", "//libc_aware/platform:linux_amd64_gnu.2.28", "glibc_2.28"), - ("linux_arm64_musl", "//libc_aware/platform:linux_arm64_musl", "non-glibc"), ("linux_amd64", "//platform:linux_amd64", "glibc_2.19"), - ("linux_arm64", "//platform:linux_arm64", "glibc_2.28"), ] ] diff --git a/test/cgo/BUILD b/test/cgo/BUILD index 2f1ce74..785ecf8 100644 --- a/test/cgo/BUILD +++ b/test/cgo/BUILD @@ -44,14 +44,10 @@ go_binary( platform_test( name = "cgo_test_{}".format(name), src = "cgo_test", - env = {"QEMU_LD_PREFIX": "/usr/aarch64-linux-gnu"} if is_arm64 else {}, platform = platform, - run_under = "qemu-aarch64-static" if is_arm64 else "", ) for name, platform, is_arm64 in [ ("linux_amd64_musl", "//libc_aware/platform:linux_amd64_musl", False), ("linux_amd64_gnu.2.19", "//libc_aware/platform:linux_amd64_gnu.2.19", False), - ("linux_arm64_musl", "//libc_aware/platform:linux_arm64_musl", True), - ("linux_arm64_gnu.2.28", "//libc_aware/platform:linux_arm64_gnu.2.28", True), ] ] diff --git a/test/windows/BUILD b/test/windows/BUILD index f73b932..634e0a4 100644 --- a/test/windows/BUILD +++ b/test/windows/BUILD @@ -9,12 +9,19 @@ cc_binary( tags = ["manual"], ) -platform_test( +# TODO(motiejus): bring back windows tests, not only builds +#platform_test( +# name = "winver_windows_amd64", +# src = "winver", +# platform = "//platform:windows_amd64", +# run_under = "wine64-stable", +# tags = ["no-sandbox"], +#) + +platform_binary( name = "winver_windows_amd64", src = "winver", platform = "//platform:windows_amd64", - run_under = "wine64-stable", - tags = ["no-sandbox"], ) platform_binary(