Skip to content

Commit

Permalink
[ci] make CI $PATH equal for push & PR to cache nonhermetic builds
Browse files Browse the repository at this point in the history
Change of `PATH` will cause change to hash of nonhermetic builds, which
prevents Verilator build cached in master to be reused in pull request
CI.

It appears that gcloud CLI is the one making difference, so fake a PATH
without installing it (as it's additional ~0.5G to download).

Signed-off-by: Gary Guo <gary.guo@lowrisc.org>
  • Loading branch information
nbdd0121 committed Jan 13, 2025
1 parent defb371 commit 2ce0a29
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/actions/prepare-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ runs:
- uses: google-github-actions/setup-gcloud@v2
if: github.event_name != 'pull_request'

# HACK: for pull request we don't really need gcloud (and it's ~0.5G to download), but not including
# it in the PATH cause environment variables to change and Verilator build to be uncached.
- name: Fake gcloud PATH
if: github.event_name == 'pull_request'
shell: bash
run: |
LATEST=$(curl -sSfL https://raw.githubusercontent.com/google-github-actions/setup-cloud-sdk/main/data/versions.json | jq -r .[-1])
GCLOUD_PATH="${{ runner.tool_cache }}/gcloud/$LATEST/x64/bin"
mkdir -p "$GCLOUD_PATH"
echo "$GCLOUD_PATH" >> "$GITHUB_PATH"
- name: Configure ~/.bazelrc
if: inputs.configure-bazel == 'true'
run: |
Expand Down

0 comments on commit 2ce0a29

Please sign in to comment.