diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml index 2d61391..47431ee 100644 --- a/.github/workflows/copyright.yml +++ b/.github/workflows/copyright.yml @@ -30,11 +30,12 @@ jobs: uses: actions/checkout@v4.2.2 - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: - disk-cache: true - repository-cache: true + disk-cache: false + repository-cache: false bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Run Copyright Check run: | diff --git a/.github/workflows/docs-verify.yml b/.github/workflows/docs-verify.yml index 3a3ff34..84be0e5 100644 --- a/.github/workflows/docs-verify.yml +++ b/.github/workflows/docs-verify.yml @@ -57,11 +57,12 @@ jobs: echo "pip_cache=${BASE}/pip" >> "$GITHUB_OUTPUT" - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: false repository-cache: false bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Prepare cache dirs shell: bash diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7ac07b0..9a96fce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -80,11 +80,12 @@ jobs: echo "pip_cache=${BASE}/pip" >> "$GITHUB_OUTPUT" - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: false repository-cache: false bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Prepare cache dirs shell: bash diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2613578..d917e53 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -29,11 +29,12 @@ jobs: uses: actions/checkout@v4.2.2 - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: - disk-cache: true - repository-cache: true + disk-cache: false + repository-cache: false bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Run Formatting Check diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml index 9c8cde8..04489f8 100644 --- a/.github/workflows/license-check.yml +++ b/.github/workflows/license-check.yml @@ -44,11 +44,12 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: true repository-cache: true bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Run License Check via Bazel run: | diff --git a/.github/workflows/qnx-build.yml b/.github/workflows/qnx-build.yml index 7daa55a..9625ef8 100644 --- a/.github/workflows/qnx-build.yml +++ b/.github/workflows/qnx-build.yml @@ -36,6 +36,11 @@ on: required: false default: "workflow-approval" type: string + bazel-disk-cache: + description: "Enable Bazel disk cache on GitHub. The value can be a string to use as cache key for separating workflows" + required: false + default: "true" + type: string secrets: score-qnx-license: description: "Base64-encoded QNX license content" @@ -64,11 +69,12 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: - disk-cache: true + disk-cache: ${{ inputs.bazel-disk-cache }} repository-cache: true bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Prepare QNX license env: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index a9392b9..2f284d8 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -31,11 +31,12 @@ jobs: uses: actions/checkout@v4.2.2 - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: true repository-cache: true bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Run Static Analysis via Bazel run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac79960..2d0747e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,11 +35,12 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: true repository-cache: true bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} - name: Run Tests via Bazel run: | diff --git a/README.md b/README.md index 2f721bf..bea930e 100644 --- a/README.md +++ b/README.md @@ -308,11 +308,12 @@ To improve performance and reduce redundant downloads across workflow runs, the ```yaml - name: Setup Bazel with shared caching - uses: bazel-contrib/setup-bazel@0.14.0 + uses: bazel-contrib/setup-bazel@0.18.0 with: disk-cache: true repository-cache: true bazelisk-cache: true + cache-save: ${{ github.event_name == 'push' }} ``` ### Benefits @@ -320,6 +321,7 @@ To improve performance and reduce redundant downloads across workflow runs, the - **`disk-cache`**: Stores compiled Bazel outputs across jobs. - **`repository-cache`**: Caches external dependencies (e.g., modules, WORKSPACE fetches). - **`bazelisk-cache`**: Avoids re-downloading Bazel binaries. +- **`cache-save`**: Saves the cache only on push events to avoid unnecessary cache updates (e.g., from pull requests). This setup significantly reduces CI build time and improves reuse across different workflows.