From 5323bbab8a35a8d39a7816fe00a0fbdbd2ea031b Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Sat, 28 Mar 2026 15:11:08 -0700 Subject: [PATCH] ci: align just bazel helpers with workflow behavior --- .github/scripts/run-bazel-ci.sh | 69 +++++++++++++++++++++------------ justfile | 9 +++-- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/.github/scripts/run-bazel-ci.sh b/.github/scripts/run-bazel-ci.sh index cf50135c2e..b71d7ed9f2 100755 --- a/.github/scripts/run-bazel-ci.sh +++ b/.github/scripts/run-bazel-ci.sh @@ -41,8 +41,23 @@ if [[ -n "${BAZEL_OUTPUT_USER_ROOT:-}" ]]; then bazel_startup_args+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}") fi +runner_os="${RUNNER_OS:-}" +if [[ -z "${runner_os}" ]]; then + case "$(uname -s)" in + Darwin) + runner_os=macOS + ;; + Linux) + runner_os=Linux + ;; + MINGW*|MSYS*|CYGWIN*) + runner_os=Windows + ;; + esac +fi + ci_config=ci-linux -case "${RUNNER_OS:-}" in +case "${runner_os}" in macOS) ci_config=ci-macos ;; @@ -112,7 +127,7 @@ if [[ ${#bazel_args[@]} -eq 0 || ${#bazel_targets[@]} -eq 0 ]]; then exit 1 fi -if [[ $use_node_test_env -eq 1 && "${RUNNER_OS:-}" != "Windows" ]]; then +if [[ $use_node_test_env -eq 1 && "${runner_os}" != "Windows" ]]; then # Bazel test sandboxes on macOS may resolve an older Homebrew `node` # before the `actions/setup-node` runtime on PATH. node_bin="$(which node)" @@ -158,28 +173,34 @@ if [[ -n "${BUILDBUDDY_API_KEY:-}" ]]; then bazel_status=${PIPESTATUS[0]} set -e else - echo "BuildBuddy API key is not available; using local Bazel configuration." - # Keep fork/community PRs on Bazel but disable remote services that are - # configured in .bazelrc and require auth. - # - # Flag docs: - # - Command-line reference: https://bazel.build/reference/command-line-reference - # - Remote caching overview: https://bazel.build/remote/caching - # - Remote execution overview: https://bazel.build/remote/rbe - # - Build Event Protocol overview: https://bazel.build/remote/bep - # - # --noexperimental_remote_repo_contents_cache: - # disable remote repo contents cache enabled in .bazelrc startup options. - # https://bazel.build/reference/command-line-reference#startup_options-flag--experimental_remote_repo_contents_cache - # --remote_cache= and --remote_executor=: - # clear remote cache/execution endpoints configured in .bazelrc. - # https://bazel.build/reference/command-line-reference#common_options-flag--remote_cache - # https://bazel.build/reference/command-line-reference#common_options-flag--remote_executor - bazel_run_args=( - "${bazel_args[@]}" - --remote_cache= - --remote_executor= - ) + bazel_run_args=("${bazel_args[@]}") + + if [[ -n "${GITHUB_ACTIONS:-}" ]]; then + echo "BuildBuddy API key is not available in GitHub Actions; disabling remote Bazel services." + # Keep fork/community PRs on Bazel but disable remote services that are + # configured in .bazelrc and require auth. + # + # Flag docs: + # - Command-line reference: https://bazel.build/reference/command-line-reference + # - Remote caching overview: https://bazel.build/remote/caching + # - Remote execution overview: https://bazel.build/remote/rbe + # - Build Event Protocol overview: https://bazel.build/remote/bep + # + # --noexperimental_remote_repo_contents_cache: + # disable remote repo contents cache enabled in .bazelrc startup options. + # https://bazel.build/reference/command-line-reference#startup_options-flag--experimental_remote_repo_contents_cache + # --remote_cache= and --remote_executor=: + # clear remote cache/execution endpoints configured in .bazelrc. + # https://bazel.build/reference/command-line-reference#common_options-flag--remote_cache + # https://bazel.build/reference/command-line-reference#common_options-flag--remote_executor + bazel_run_args+=( + --remote_cache= + --remote_executor= + ) + else + echo "BuildBuddy API key env var is not available; preserving Bazel remote settings from local Bazel config." + fi + if (( ${#post_config_bazel_args[@]} > 0 )); then bazel_run_args+=("${post_config_bazel_args[@]}") fi diff --git a/justfile b/justfile index a39d2dd6ba..32ac1a0d91 100644 --- a/justfile +++ b/justfile @@ -67,17 +67,18 @@ bazel-lock-check: ./scripts/check-module-bazel-lock.sh bazel-test: - bazel test --test_tag_filters=-argument-comment-lint //... --keep_going + bazel test --test_tag_filters=-argument-comment-lint --keep_going -- //... -//third_party/v8:all bazel-clippy: bazel build --config=clippy -- //codex-rs/... -//codex-rs/v8-poc:all [no-cd] bazel-argument-comment-lint: - bazel build --config=argument-comment-lint -- //codex-rs/... + ./.github/scripts/run-bazel-ci.sh -- build --config=argument-comment-lint --keep_going -- //codex-rs/... +[no-cd] bazel-remote-test: - bazel test --test_tag_filters=-argument-comment-lint //... --config=remote --platforms=//:rbe --keep_going + ./.github/scripts/run-bazel-ci.sh --print-failed-test-logs --use-node-test-env -- test --test_tag_filters=-argument-comment-lint --test_verbose_timeout_warnings -- //... -//third_party/v8:all build-for-release: bazel build //codex-rs/cli:release_binaries --config=remote @@ -102,7 +103,7 @@ write-hooks-schema: [no-cd] argument-comment-lint *args: if [ "$#" -eq 0 ]; then \ - bazel build --config=argument-comment-lint -- //codex-rs/...; \ + ./.github/scripts/run-bazel-ci.sh -- build --config=argument-comment-lint --keep_going -- //codex-rs/...; \ else \ ./tools/argument-comment-lint/run-prebuilt-linter.py "$@"; \ fi