Skip to content

Commit

Permalink
test macos caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
LucilleH committed Sep 18, 2023
1 parent a0bd99f commit 38a9442
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install devbox
uses: ./
with:
devbox-version: 0.5.5
devbox-version: 0.5.13
project-path: 'testdata'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

Expand All @@ -60,10 +60,10 @@ jobs:
- name: Install devbox
uses: ./
with:
devbox-version: 0.5.5
devbox-version: 0.5.13
refresh-cli: true
project-path: 'testdata'
sha256-checksum: 'd5e623c032d38250346301040d51bcdca8e6db051c3688cc452e0dda5d95a070'
sha256-checksum: '481cc5d270a22843d7f7c34eac6cea4bbe9f2cdfbc72f0217ea3823ebabecc43'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"

test-action-with-sha256-checksum-failure:
Expand All @@ -75,7 +75,7 @@ jobs:
uses: ./
continue-on-error: true
with:
devbox-version: 0.5.5
devbox-version: 0.5.13
refresh-cli: true
sha256-checksum: 'bad-sha'
project-path: 'testdata'
Expand All @@ -91,9 +91,9 @@ jobs:
- name: Install devbox
uses: ./
with:
devbox-version: 0.5.5
devbox-version: 0.5.13
enable-cache: true
refresh-cli: true
sha256-checksum: '3c2ce11638e3ffcd55881ec20143c38feeb24069ccdb5edf82b343c168aaca32'
sha256-checksum: 'f5907e5782f6e1f5a7ca32c8ae2a0a81618549314bab237174a46fb216f43809'
project-path: 'testdata'
disable-nix-access-token: "${{ github.ref != 'refs/heads/main' }}"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
### Action Inputs

| Input argument | description | default |
| ---------------- | ------------------------------------------------------------------------------------- | --------------------- |
| ------------------------ | ------------------------------------------------------------------------------------- | --------------------- |
| project-path | Path to the folder that contains a valid `devbox.json` | repo's root directory |
| enable-cache | Cache the entire Nix store in github based on your `devbox.json` | false |
| refresh-cli | Specify whether the CLI should be redownloaded | false |
Expand All @@ -51,7 +51,7 @@ Here's an example job with all inputs:
project-path: 'path-to-folder'
enable-cache: 'true'
refresh-cli: 'false'
devbox-version: 0.5.11
devbox-version: 0.5.13
disable-nix-access-token: 'false'
sha256-sum: b6f7e24839de004ef2cad312f05865f77a73b1e0b1757e0f4d39a5911adabd50
sha256-sum: f5907e5782f6e1f5a7ca32c8ae2a0a81618549314bab237174a46fb216f43809
```
14 changes: 8 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ runs:
- name: Workaround for permission issue
if: inputs.enable-cache == 'true' && runner.os != 'macOS'
shell: bash
run: sudo chmod u+s "$(command -v tar)"
run: |
# for Linux
sudo chmod u+s "$(command -v tar)"
# for MacOS
sudo chmod u+s "$(command -v gtar)"
- name: Mount nix store cache
if: inputs.enable-cache == 'true'
Expand All @@ -39,7 +43,6 @@ runs:
~/.nix-defexpr
~/.nix-profile
/nix/store
/nix/var/nix
~/.local/state/nix
key: ${{ runner.os }}-devbox-${{ hashFiles(format('{0}/devbox.lock', inputs.project-path)) }}

Expand Down Expand Up @@ -81,8 +84,6 @@ runs:
export DEVBOX_USE_VERSION="${{ env.latest_version }}"
curl -fsSL https://get.jetpack.io/devbox | FORCE=1 bash
devbox setup nix # temporary until 0.5.13 is released
version=$(devbox version)
if [[ ! "$version" = "$DEVBOX_USE_VERSION" ]]; then
echo "ERROR: mismatch devbox version downloaded. Expected $DEVBOX_USE_VERSION, got $version."
Expand Down Expand Up @@ -120,6 +121,7 @@ runs:
- name: Install nix and devbox packages
shell: bash
run: |
NIX_INSTALLER_NO_CHANNEL_ADD=1
NIX_BUILD_SHELL=/bin/bash
export NIX_USER_COUNT=1
export NIX_INSTALLER_NO_CHANNEL_ADD=1
export NIX_BUILD_SHELL=/bin/bash
devbox run --config=${{ inputs.project-path }} -- echo "Packages installed!"
11 changes: 11 additions & 0 deletions testdata/devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"lockfile_version": "1",
"packages": {
"go@latest": {
"last_modified": "2023-09-17T10:54:49Z",
"resolved": "github:NixOS/nixpkgs/5148520bfab61f99fd25fb9ff7bfbb50dad3c9db#go_1_21",
"source": "devbox-search",
"version": "1.21.1"
}
}
}

0 comments on commit 38a9442

Please sign in to comment.