setup-zig icon indicating copy to clipboard operation
setup-zig copied to clipboard

Caching Failure

Open britown88 opened this issue 2 years ago • 1 comments

This has been working great except the cache never seems to work so it downloads new every time.

Run goto-bus-stop/setup-zig@v[2](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:2)
  with:
    version: 0.12.0-dev.1092+68ed78775
    cache: true
  
attempting restore of zig-zig-windows-x86_64-0.12.0-dev.1092+68ed78775 to C:\hostedtoolcache\windows\zig\0.12.0-dev.1092+68ed78775\x64
no cached version found. downloading zig zig-windows-x86_64-0.12.0-dev.1092+68ed78775
"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ; try { [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\cc549bce-4de7-4f1b-bbb9-95518[3](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:3)05898c', 'D:\a\_temp\9e02c0[4](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:4)d-874[5](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:5)-46a6-84ff-f477fe680a[5](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:6)9', $true) } catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath 'D:\a\_temp\cc549bce-4de7-4f1b-bbb9-95518305898c' -DestinationPath 'D:\a\_temp\9e02c04d-8745-4[6](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:7)a6-84ff-f4[7](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:8)7fe6[8](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:9)0a5[9](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:10)' -Force } else { throw $_ } } ;"
adding zig 0.12.0-dev.[10](https://github.com/britown88/chron4/actions/runs/6566761611/job/17838117964#step:3:11)92+68ed78775 at C:\hostedtoolcache\windows\zig\0.12.0-dev.1092\x64 to local cache zig-zig-windows-x86_64-0.12.0-dev.1092+68ed78775
"C:\Program Files\Git\usr\bin\tar.exe" --posix -cf cache.tzst --exclude cache.tzst -P -C D:/a/chron4/chron4 --files-from manifest.txt --force-local --use-compress-program "zstd -T0"
Failed to save: Unable to reserve cache with key zig-zig-windows-x86_64-0.12.0-dev.1092+68ed78775, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/master, Key: zig-zig-windows-x86_64-0.12.0-dev.1092+68ed78775, Version: 3c01fb4cea4efcddb92bea7a65ce5b1f03c58bf039a2b2f7521c77414d872b2f
zig installed at C:\hostedtoolcache\windows\zig\0.12.0-dev.1092\x64

Any idea?

britown88 avatar Oct 18 '23 21:10 britown88

Same here, thanks for reporting this.

I think I finally found the issue:

Per that error message, it's omitting the build metadata part of the version when installing, i.e, we see this

zig installed at C:\hostedtoolcache\windows\zig\0.12.0-dev.1092\x64

which doesn't include the +68ed78775 suffix from the version being used, 0.12.0-dev.1092+68ed78775.

So, it seems like the build metadata is breaking something.... 🤔

I then updated a fork of this repo to ignore the build metadata, and it seems to cache fine for me now.

Try it out like so:

      - uses: jethrodaniel/setup-zig@fix-caching
        with:
          version: 0.12.0-dev.903+7aa85691b

jethrodaniel avatar Nov 24 '23 04:11 jethrodaniel