nix-community / cache-nix-action

Cache Nix store in GitHub Actions to speed up workflows [maintainer=@deemp]
MIT License
29 stars 6 forks source link

Cache restore failure #16

Closed develop7 closed 7 months ago

develop7 commented 7 months ago

Repro:

Invoke cache-nix-action following the example from it's manual:

    - name: Restore and cache Nix store
      uses: nix-community/cache-nix-action@v4
      with:
        key: cache-${{ runner.os }}-${{ hashFiles('nix/**/*.nix') }}
        restore-keys: |
          cache-${{ runner.os }}-
        gc-linux: true
        gc-max-store-size-linux: 1000000000
        gc-macos: true
        gc-max-store-size-macos: 1000000000
        purge: true
        purge-keys: cache-${{ runner.os }}-
        purge-created: true
        purge-created-max-age: 42

https://github.com/develop7/postgrest/blob/abfeda7512395ee5cf091378fc75f6d223e6833a/.github/actions/setup-nix/action.yaml#L17-L30

Expected: cache is unpacking successfully

Instead: the action output log is polluted with the messages like ones below indicating (partial?) failure to unpack the cache

/usr/bin/tar: ../../../../../nix/store/br1p5pan2pgmgrm81kj43qawd9b9nns1-libunistring-1.1/lib/libunistring.so.5.0.0: Cannot open: File exists

Link: https://github.com/PostgREST/postgrest/actions/runs/6709349886/job/18232202233?pr=2992#step:3:76

deemp commented 7 months ago

Hi! See the Limitations section. image

develop7 commented 7 months ago

Ohhh, I see, it fails to untar nix and deps only. Got it, thanks.

develop7 commented 7 months ago

Hey @deemp, could you hide the lines in question behind a lines' group at least? Seems really straightforward to implement. They should collapse automatically after the end group marker being printed, and do not expand in the log viewer, so that should decrease log pollution.

deemp commented 7 months ago

Hi, @develop7! Nice idea. Implemented in 17d19d3d8be918757589635bc1a6830be0b129d2

develop7 commented 7 months ago

Works like a charm, thanks!