jetify-com / devbox-install-action

31 stars 15 forks source link

Cache key should also include architecture #35

Closed abbudao closed 5 months ago

abbudao commented 6 months ago

Hello, I've started a POC to adopt DevBox for my company, and I am currently using this action on CI. I ran an issue in which the same cache key is being used on different architectures, which will result in the wrong output. Example run:

Cache Size: ~440 MB (460937930 B)
/home/runner/.local/bin/tar -xf /home/runner/actions-runner/_work/_temp/16a74c1d-2a75-4a3c-bb3c-19732e2dc6af/cache.tzst -P -C /home/runner/actions-runner/_work/portfolio/portfolio --use-compress-program unzstd
Received 460937930 of 460937930 (100.0%), 9.6 MBs/sec
Cache restored successfully
Cache restored from key: Linux-devbox-nix-store-42205890a2f8496977b209fc3bc849407e06ed0661ca863ad39f934a80c55928
Run devbox run --config=. -- echo "Packages installed!"
/home/runner/actions-runner/_work/_temp/727404b5-3f8b-47c6-9702-3cc0e102006c.sh: line 1: /usr/local/bin/devbox: cannot execute binary file: Exec format error
Error: Process completed with exit code 126.

From this line, I assume we should also be using runner.arch on the cache key, like:

    - name: Mount devbox cli cache
      if: inputs.refresh-cli == 'false'
      id: cache-devbox-cli
      uses: actions/cache/restore@v4
      with:
        path: /usr/local/bin/devbox
        key: ${{ runner.os }}-${{ runner.arch }}-devbox-cli-${{ env.latest_version }}

If welcome, I can open a PR with the change.

LucilleH commented 6 months ago

If welcome, I can open a PR with the change.

@abbudao Please do!