Add a cache for downloaded Bazel binaries

This will reduce flakes by caching pinned versions of bazel on github

PiperOrigin-RevId: 507617220
pull/11816/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent ae4c4ea6d4
commit e5bbcd20d3
  1. 21
      .github/actions/bazel/action.yml

@ -47,6 +47,27 @@ runs:
credentials-file: ${{ steps.auth.outputs.credentials-file }} credentials-file: ${{ steps.auth.outputs.credentials-file }}
bazel-cache: ${{ inputs.bazel-cache }} bazel-cache: ${{ inputs.bazel-cache }}
- name: Get Linux bazelisk path
if: runner.os == 'Linux'
shell: bash
run: echo "BAZELISK_PATH=~/.cache/bazelisk" >> $GITHUB_ENV
- name: Get MacOS bazelisk path
if: runner.os == 'macOS'
shell: bash
run: echo "BAZELISK_PATH=~/Library/Caches/bazelisk" >> $GITHUB_ENV
- name: Get Windows bazelisk path
if: runner.os == 'Windows'
shell: bash
run: echo "BAZELISK_PATH=$LOCALAPPDATA\bazelisk" >> $GITHUB_ENV
- name: Cache Bazelisk
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: ${{ env.BAZELISK_PATH }}
key: bazel-${{ runner.os }}-${{ inputs.version }}
- name: Validate inputs - name: Validate inputs
if: ${{ (inputs.bash && inputs.bazel) || (!inputs.bash && !inputs.bazel) }} if: ${{ (inputs.bash && inputs.bazel) || (!inputs.bash && !inputs.bazel) }}
shell: bash shell: bash

Loading…
Cancel
Save