diff --git a/.github/actions/setup-bazelisk/action.yml b/.github/actions/setup-bazelisk/action.yml new file mode 100644 index 00000000..0576cef5 --- /dev/null +++ b/.github/actions/setup-bazelisk/action.yml @@ -0,0 +1,41 @@ +name: Setup Bazelisk +description: Install Bazelisk with one retry, then verify it is on PATH +inputs: + bazelisk-version: + description: Bazelisk version to install + required: false + default: "1.29.0" +runs: + using: composite + steps: + - name: Setup Bazelisk (attempt 1) + id: setup_bazelisk_1 + continue-on-error: true + uses: bazel-contrib/setup-bazel@0.19.0 + with: + bazelisk-version: ${{ inputs.bazelisk-version }} + + - name: Setup Bazelisk (attempt 2) + id: setup_bazelisk_2 + if: steps.setup_bazelisk_1.outcome != 'success' + continue-on-error: false + uses: bazel-contrib/setup-bazel@0.19.0 + with: + bazelisk-version: ${{ inputs.bazelisk-version }} + + # Composite run steps need an explicit shell. Use bash on Linux/macOS (pwsh + # is not always present after free-disk-space) and pwsh on Windows. + - name: Verify Bazelisk installation + if: runner.os != 'Windows' + shell: bash + run: bazelisk version || (echo "Failed to install Bazelisk after two setup attempts, or Bazelisk is not available on PATH." && exit 1) + + - name: Verify Bazelisk installation + if: runner.os == 'Windows' + shell: pwsh + run: | + bazelisk version + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to install Bazelisk after two setup attempts, or Bazelisk is not available on PATH." + exit 1 + } diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 65764b21..2c01d16c 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -28,9 +28,7 @@ jobs: # 3️⃣ Install Bazelisk (recommended Bazel launcher) - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk # 4️⃣ (Optional) Install Doxygen for documentation generation - name: Install Doxygen @@ -87,9 +85,7 @@ jobs: swap-storage: false - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk - name: Prefetch external repos run: | @@ -135,9 +131,7 @@ jobs: swap-storage: false - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk - name: Prefetch external repos run: | diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 50c23e9b..e1499ed6 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -16,9 +16,7 @@ jobs: # Install Bazelisk (recommended Bazel launcher) - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk # Install Doxygen, to generate documentation - name: Install Doxygen @@ -65,9 +63,7 @@ jobs: uses: actions/checkout@v6 - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk - name: Prefetch external repos run: | diff --git a/.github/workflows/ci_wasm.yml b/.github/workflows/ci_wasm.yml index 6a2b8871..7d32e4f0 100644 --- a/.github/workflows/ci_wasm.yml +++ b/.github/workflows/ci_wasm.yml @@ -30,9 +30,7 @@ jobs: # 3️⃣ Install Bazelisk (recommended Bazel launcher) - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk # 4️⃣ Prefetch emsdk / toolchain archives (retry transient network timeouts) - name: Prefetch external repos diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml index 00421cab..baea72d1 100644 --- a/.github/workflows/ci_windows.yml +++ b/.github/workflows/ci_windows.yml @@ -16,9 +16,7 @@ jobs: # Install Bazelisk (recommended Bazel launcher) - name: Setup Bazelisk - uses: bazel-contrib/setup-bazel@0.19.0 - with: - bazelisk-version: "1.29.0" + uses: ./.github/actions/setup-bazelisk # Warm external deps (emsdk, LLVM, …); retry transient network fetch failures - name: Prefetch external repos