julia-actions / cache

A shortcut action to cache Julia artifacts, packages, and registries.
MIT License
38 stars 8 forks source link

Non-unique cache key when using objects in job matrix #87

Closed omus closed 7 months ago

omus commented 7 months ago

A GitHub action job matrix supports defining YAML objects as part of the matrix specification:

strategy:
  matrix:
    pkg:
      - name: A
        dir: A.jl
      - name: B
        dir: B.jl
    version:
      - "1"
    runs-on:
      - ubuntu-latest
    arch:
      - x64

When utilizing this pattern with julia-actions/cache the resulting default generated cache key is julia-cache-workflow-job-Object-1-ubuntu-latest-x64-Linux-... when running for package A and package B. This is problematic as these keys are not unique which means we're only storing the cached depot information for the last run job.

omus commented 7 months ago

Discovered when testing #83

IanButterworth commented 7 months ago

Ah the pkg matrix object isn't being expanded in the join here https://github.com/julia-actions/cache/blob/930a18227b7f8e7d390f3155b2c2b0834eda44a7/action.yml#L71

So just prints as Object.

I wasn't aware that matrix could be a tree like this.

omus commented 7 months ago

I have a fix I'll make a PR for

omus commented 7 months ago

The changes in #88 create the following cache keys:

julia-cache;workflow=...;job=...;os=Linux;pkg-name=A;pkg-dir=A.jl;version=1;runs-on=ubuntu-latest;arch=x64;...
julia-cache;workflow=...;job=...;os=Linux;pkg-name=B;pkg-dir=B.jl;version=1;runs-on=ubuntu-latest;arch=x64;...