Skip to content

Commit

Permalink
fix: use architecture as part of cache key (#36)
Browse files Browse the repository at this point in the history
Use architecture as part of the cache key to avoid bad cache hits. The
current implementation can crash pipelines using matrix strategies or
when different pipelines use different architectures but leverage the
Devbox action.

Fixes: #35

---------

Signed-off-by: Pedro Morello Abbud <abbudao@gmail.com>
Co-authored-by: Lucille Hua <lucille.hua@jetpack.io>
  • Loading branch information
abbudao and LucilleH committed Mar 18, 2024
1 parent f656242 commit 2aca099
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ runs:
uses: actions/cache/restore@v4
with:
path: /usr/local/bin/devbox
key: ${{ runner.os }}-devbox-cli-${{ env.latest_version }}
key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}

- name: Install devbox cli
if: steps.cache-devbox-cli.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -99,7 +99,7 @@ runs:
uses: actions/cache/save@v4
with:
path: /usr/local/bin/devbox
key: ${{ runner.os }}-devbox-cli-${{ env.latest_version }}
key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}

- name: Workaround nix store cache permission issue
if: inputs.enable-cache == 'true'
Expand Down Expand Up @@ -145,7 +145,7 @@ runs:
~/.nix-profile
/nix/store
/nix/var/nix
key: ${{ runner.os }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
key: ${{ runner.os }}-${{ runner.arch }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}

- name: Install devbox packages
shell: bash
Expand All @@ -164,7 +164,7 @@ runs:
~/.nix-profile
/nix/store
/nix/var/nix
key: ${{ runner.os }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}
key: ${{ runner.os }}-${{ runner.arch }}-devbox-nix-store-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}

- name: Restore tar command
if: inputs.enable-cache == 'true'
Expand Down

0 comments on commit 2aca099

Please sign in to comment.