| name: Store Bazel cache |
| description: Stores Bazel cache using actions/cache |
| inputs: |
| workflow: |
| description: Workflow name |
| required: true |
| key: |
| description: Extra cache key |
| required: true |
| runs: |
| using: "composite" |
| steps: |
| - if: runner.os == 'Windows' |
| name: Use GNU tar |
| shell: cmd |
| # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#improving-cache-restore-performance-on-windowsusing-cross-os-caching |
| # Bazel relies heavily on symlinks, so enable native support |
| run: | |
| echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" |
| echo MSYS=winsymlinks:native>>"%GITHUB_ENV%" |
| - if: runner.os == 'Windows' |
| uses: actions/cache@v3 |
| with: |
| # Ideally we would cache the whole external/ but it causes various |
| # issues both on packing and unpacking cache. |
| # The whole caching approached needs overhaul to make it work good |
| # on Windows. |
| path: | |
| D:\_bazel\external\bundle |
| D:\_bazel\external\rules_ruby |
| D:\_bazel\external\rules_ruby_dist |
| D:\_bazel-disk |
| D:\_bazel-repo |
| key: ${{ runner.os }}-bazel-${{ inputs.workflow }}-${{ inputs.key }}-${{ hashFiles('**/BUILD.bazel') }} |
| restore-keys: | |
| ${{ runner.os }}-bazel-${{ inputs.workflow }}-${{ inputs.key }}- |
| ${{ runner.os }}-bazel-${{ inputs.workflow }}- |
| - if: runner.os != 'Windows' |
| uses: actions/cache@v3 |
| with: |
| path: | |
| /tmp/bazel/external |
| ~/.cache/bazel-disk |
| ~/.cache/bazel-repo |
| key: ${{ runner.os }}-bazel-${{ inputs.workflow }}-${{ inputs.key }}-${{ hashFiles('**/BUILD.bazel') }} |
| restore-keys: | |
| ${{ runner.os }}-bazel-${{ inputs.workflow }}-${{ inputs.key }}- |
| ${{ runner.os }}-bazel-${{ inputs.workflow }}- |