Skip to content

Commit

Permalink
clear nix store cache
Browse files Browse the repository at this point in the history
  • Loading branch information
LucilleH committed Jan 20, 2025
1 parent 6110990 commit e66db89
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,27 @@ jobs:
enable-cache: ${{ matrix.use-cache }}
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

test-action-with-version:
test-action-with-devbox-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install devbox
uses: ./
with:
devbox-version: 0.9.1
devbox-version: 0.13.6
project-path: 'testdata'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

test-action-with-nix-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install devbox
uses: ./
with:
project-path: 'testdata'
nix-version: v0.32.3
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

test-action-with-sha256-checksum:
runs-on: ubuntu-latest
Expand All @@ -54,10 +65,10 @@ jobs:
- name: Install devbox
uses: ./
with:
devbox-version: 0.9.1
devbox-version: 0.13.6
refresh-cli: true
project-path: 'testdata'
sha256-checksum: 'f58202279237b9e0e7d69ef9334c7ca0628db31e5575f105dad6f41a171ebb6a'
sha256-checksum: '22a31081df183aab7b8f88a794505c7c0ae217d6314e61b3e0bfe6972b992199'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

test-action-with-sha256-checksum-failure:
Expand All @@ -69,7 +80,7 @@ jobs:
uses: ./
continue-on-error: true
with:
devbox-version: 0.9.1
devbox-version: 0.13.6
refresh-cli: true
sha256-checksum: 'bad-sha'
project-path: 'testdata'
Expand All @@ -85,8 +96,8 @@ jobs:
- name: Install devbox
uses: ./
with:
devbox-version: 0.9.1
devbox-version: 0.13.6
refresh-cli: true
sha256-checksum: 'e7793acf6dadecc6a04eb64d6352665698c75f6c9f59fbe3efee3b04dbec294d'
sha256-checksum: '169836de22c41a1c68ac5a43e0514d4021137647c7c08ee8bd921faa430ee286'
project-path: 'testdata'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ Here's an example job with all inputs:
devbox-version: 0.13.4
disable-nix-access-token: 'false'
sha256-checksum: <checksum>
nix-version: v0.33
nix-version: v0.32.3
```
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ runs:
if: inputs.refresh-cli == 'false' && steps.cache-devbox-cli.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ~/.local/bin/devbox
path: |
~/.local/bin/devbox
/usr/local/bin/devbox
key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}

- name: Workaround nix store cache permission issue
Expand Down Expand Up @@ -158,6 +160,15 @@ runs:
shell: bash
run: |
devbox run --config=${{ inputs.project-path }} -- echo "Packages installed!"
- name: List nix store cache on failure
shell: bash
if: failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "It is likely that nix has shipped a backwards incompatible change. You can either specify the 'nix-version', or proceed to the actions tab and manually delete the cache:"
gh cache list --key ${{ runner.os }}-${{ runner.arch }}-devbox --json key
- name: Save nix store cache
if: inputs.enable-cache == 'true' && steps.cache-devbox-nix-store.outputs.cache-hit != 'true'
Expand Down

0 comments on commit e66db89

Please sign in to comment.