Stream: ideas

Topic: Cache keys for CI


view this post on Zulip Hannes (Jan 12 2024 at 13:40):

In CI, it is convenient to be able to cache dependencies between runs so that you don't have to download them all again on each run. To do this, GitHub Actions and Gitlab CI (and I'm sure other CI systems that I'm not familiar with) use a cache key to invalidate the cache. For other languages with a package manifest file you normally just hash the lockfile and use that as the cache key. In Roc, for a package you could use the main.roc file, but for apps, the main.roc file will likely have a lot of changes that are unrelated to the dependencies.

One way to solve this could be to have a subcommand for the Roc CLI that prints the dependencies to stdout.

Another solution would be to just use sed/grep/awk in CI to extract the header and use that as the cache key.

Anyone have any other ideas for how we could deal with this?

view this post on Zulip Sky Rose (Jan 12 2024 at 14:08):

a subcommand could be nice for other analysis, too. I pretty frequently use npm list and related commands to understand my dependency tree.

view this post on Zulip Kevin Gillette (Jan 12 2024 at 14:09):

Perhaps the roc command could have some operation that either dumps out a validation hash (with a flag for just dependencies) or... what Sky just suggested

view this post on Zulip Richard Feldman (Jan 12 2024 at 14:23):

yeah when we get to actually caching roc files locally, we'll be generating our own hashes that are based on the source code, not just dependencies - so individual modules often won't need to be rebuilt if they didn't change

view this post on Zulip Richard Feldman (Jan 12 2024 at 14:24):

but a subcommand to print all dependencies could be nice too


Last updated: Jun 16 2026 at 16:19 UTC