hendrikmuhs / ccache-action

github action to speedup building using ccache
MIT License
118 stars 53 forks source link

Platform-specific cache keys #161

Open krlmlr opened 1 year ago

krlmlr commented 1 year ago

I run a build matrix across macOS, Linux (Ubuntu 20.04 and 22.04) and Windows. It seems to make no sense to reuse the same cache across platforms, and I suspect a race condition when those platforms are actually built and cached in parallel.

Should the platform be part of the cache key by default? I'm currently working around: https://github.com/krlmlr/duckdb-r/blob/ccache/.github/workflows/install/action.yml#L87-L97

hendrikmuhs commented 1 year ago

I am not sure if this is a workaround or best practice, I use

${{ matrix.os }}-${{ matrix.type }}

for my builds.

juan-lunarg commented 12 months ago

What about when you have a complicated matrix for testing?

We have a pretty involved matrix right now:

- uses: hendrikmuhs/ccache-action@v1.2
    with:
      key: ${{ matrix.config }}-${{ matrix.compiler }}-${{ matrix.os }}-${{ matrix.santizer }}-${{ matrix.etc }}

If someone makes a change to the matrix it's easy to forget to update the key.

Is there a better way to write this? IE an automated way to get a hash of the matrix that I could use for the key? Or auto detect the platform / matrix if possible?