ci: align just bazel helpers with workflow behavior

This commit is contained in:
Michael Bolin
2026-03-28 15:11:08 -07:00
parent 4e27a87ec6
commit 5323bbab8a
2 changed files with 50 additions and 28 deletions

View File

@@ -41,8 +41,23 @@ if [[ -n "${BAZEL_OUTPUT_USER_ROOT:-}" ]]; then
bazel_startup_args+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}") bazel_startup_args+=("--output_user_root=${BAZEL_OUTPUT_USER_ROOT}")
fi 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 ci_config=ci-linux
case "${RUNNER_OS:-}" in case "${runner_os}" in
macOS) macOS)
ci_config=ci-macos ci_config=ci-macos
;; ;;
@@ -112,7 +127,7 @@ if [[ ${#bazel_args[@]} -eq 0 || ${#bazel_targets[@]} -eq 0 ]]; then
exit 1 exit 1
fi 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` # Bazel test sandboxes on macOS may resolve an older Homebrew `node`
# before the `actions/setup-node` runtime on PATH. # before the `actions/setup-node` runtime on PATH.
node_bin="$(which node)" node_bin="$(which node)"
@@ -158,28 +173,34 @@ if [[ -n "${BUILDBUDDY_API_KEY:-}" ]]; then
bazel_status=${PIPESTATUS[0]} bazel_status=${PIPESTATUS[0]}
set -e set -e
else else
echo "BuildBuddy API key is not available; using local Bazel configuration." bazel_run_args=("${bazel_args[@]}")
# Keep fork/community PRs on Bazel but disable remote services that are
# configured in .bazelrc and require auth. if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
# echo "BuildBuddy API key is not available in GitHub Actions; disabling remote Bazel services."
# Flag docs: # Keep fork/community PRs on Bazel but disable remote services that are
# - Command-line reference: https://bazel.build/reference/command-line-reference # configured in .bazelrc and require auth.
# - Remote caching overview: https://bazel.build/remote/caching #
# - Remote execution overview: https://bazel.build/remote/rbe # Flag docs:
# - Build Event Protocol overview: https://bazel.build/remote/bep # - Command-line reference: https://bazel.build/reference/command-line-reference
# # - Remote caching overview: https://bazel.build/remote/caching
# --noexperimental_remote_repo_contents_cache: # - Remote execution overview: https://bazel.build/remote/rbe
# disable remote repo contents cache enabled in .bazelrc startup options. # - Build Event Protocol overview: https://bazel.build/remote/bep
# https://bazel.build/reference/command-line-reference#startup_options-flag--experimental_remote_repo_contents_cache #
# --remote_cache= and --remote_executor=: # --noexperimental_remote_repo_contents_cache:
# clear remote cache/execution endpoints configured in .bazelrc. # disable remote repo contents cache enabled in .bazelrc startup options.
# https://bazel.build/reference/command-line-reference#common_options-flag--remote_cache # https://bazel.build/reference/command-line-reference#startup_options-flag--experimental_remote_repo_contents_cache
# https://bazel.build/reference/command-line-reference#common_options-flag--remote_executor # --remote_cache= and --remote_executor=:
bazel_run_args=( # clear remote cache/execution endpoints configured in .bazelrc.
"${bazel_args[@]}" # https://bazel.build/reference/command-line-reference#common_options-flag--remote_cache
--remote_cache= # https://bazel.build/reference/command-line-reference#common_options-flag--remote_executor
--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 if (( ${#post_config_bazel_args[@]} > 0 )); then
bazel_run_args+=("${post_config_bazel_args[@]}") bazel_run_args+=("${post_config_bazel_args[@]}")
fi fi

View File

@@ -67,17 +67,18 @@ bazel-lock-check:
./scripts/check-module-bazel-lock.sh ./scripts/check-module-bazel-lock.sh
bazel-test: 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-clippy:
bazel build --config=clippy -- //codex-rs/... -//codex-rs/v8-poc:all bazel build --config=clippy -- //codex-rs/... -//codex-rs/v8-poc:all
[no-cd] [no-cd]
bazel-argument-comment-lint: 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-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: build-for-release:
bazel build //codex-rs/cli:release_binaries --config=remote bazel build //codex-rs/cli:release_binaries --config=remote
@@ -102,7 +103,7 @@ write-hooks-schema:
[no-cd] [no-cd]
argument-comment-lint *args: argument-comment-lint *args:
if [ "$#" -eq 0 ]; then \ 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 \ else \
./tools/argument-comment-lint/run-prebuilt-linter.py "$@"; \ ./tools/argument-comment-lint/run-prebuilt-linter.py "$@"; \
fi fi