Skip to content

Use matrix.os instead of runner.os in the CI cache key #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

langston-barrett
Copy link

runner.os typically has values like Linux or Windows, whereas matrix.os (which is the value of runs-on) has more descriptive values such as ubuntu-24.04-arm. In particular, matrix.os tends to contain or imply a particular OS version (e.g., 24.04) and a particular architecture (e.g., x86_64 for ubuntu-latest, ARM64 for ubuntu-latest-arm). These data are highly relevant to compilation; they should be included in the cache key to avoid spurious sharing of caches between OS versions or architectures.

This is not currently a problem for primitive, as it is only tested against a single OS version and architecture. However, it never hurts to be future proof, especially since using matrix.os is just as easy as runner.os.

`runner.os` typically has values like `Linux` or `Windows`, whereas
`matrix.os` (which is the value of `runs-on`) has more descriptive
values such as `ubuntu-24.04-arm`. In particular, `matrix.os` tends to
contain or imply a particular OS version (e.g., `24.04`) and a
particular architecture (e.g., x86_64 for `ubuntu-latest`, ARM64 for
`ubuntu-latest-arm`). These data are highly relevant to compilation;
they should be included in the cache key to avoid spurious sharing of
caches between OS versions or architectures.

This is not currently a *problem* for `primitive`, as it is only tested
against a single OS version and architecture. However, it never hurts to
be future proof, especially since using `matrix.os` is just as easy as
`runner.os`.
@hasufell
Copy link
Member

hasufell commented Apr 1, 2025

cabal does not distinguish by OS version. What makes you think a cache built on ubuntu 20 becomes invalid on ubuntu 22?

It would only be true the other way around due to glibc incompatibility. But that's not really a concern in most CIs and can be fixed by busting the cache with an Int key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants