| name: "Setup Bazel" | |
| description: "Configure Bazel with caching for GitHub Actions workflows" | |
| runs: | |
| using: "composite" | |
| steps: | |
| - name: Setup Bazel | |
| uses: bazel-contrib/setup-bazel@0.19.1 | |
| with: | |
| # Windows images have a fixed-version `bazel` on PATH, and Bazelisk | |
| # < 1.29.0 has no windows-arm64 build. | |
| bazelisk-version: 1.29.0 | |
| bazelisk-cache: true | |
| disk-cache: true | |
| # Files hashed to compute the repository cache key. If only `true` is | |
| # passed, only MODULE.bazel/WORKSPACE* are hashed, so lockfile-only | |
| # updates would get a cache hit on the old key and skip saving newly | |
| # downloaded wheels. | |
| repository-cache: | | |
| - MODULE.bazel | |
| - dev/uv.lock | |
| - tools/publish/requirements_linux.txt | |
| bazelrc: | | |
| # .bazelrc enables --config=pyrefly by default; disable the pyrefly | |
| # output group here so operational workflows don't download the | |
| # pyrefly toolchain or type-check targets before running them. | |
| build --output_groups=-pyrefly | |
| build --//python/config_settings:py_pbs_distribution=install_only_stripped | |
| # setup-bazel only configures Bazelisk and restores caches; the Bazel | |
| # binary itself is downloaded by Bazelisk on first invocation. Because | |
| # Bazelisk does not retry mid-stream download failures, trigger and retry | |
| # the download upfront via `bazel --version`. | |
| - name: Download Bazel | |
| shell: bash | |
| run: "${GITHUB_ACTION_PATH}/download_bazel.sh" |