Implement Node.js caching, and fix Python caching, in the GitHub Actions workflows#20952
Open
timvandermeij wants to merge 2 commits intomozilla:masterfrom
Open
Implement Node.js caching, and fix Python caching, in the GitHub Actions workflows#20952timvandermeij wants to merge 2 commits intomozilla:masterfrom
timvandermeij wants to merge 2 commits intomozilla:masterfrom
Conversation
The `setup-node` action contains built-in support for caching [1], so this commit makes sure we use it for all Node.js-based workflows to reduce workflow execution time. Note that, contrary what one might expect [2], the `node_modules` directory is deliberately not cached because it can conflict with differing Node.js versions and because it's not useful in combination with `npm ci` usage which wipes the `node_modules` folder unconditionally. Therefore, the action instead caches the global `npm` cache directory instead which does not suffer from these problems and still provides a speed-up at installation time. [1] https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data [2] actions/setup-node#416 [3] actions/cache#67
For the Python-based workflows we were already using `pip` caching [1], but sadly this isn't fully functional at the moment because the caching functionality uses `requirements.txt` to determine when to create or invalidate the cache. However, we have two different `pip` install commands but only a `requirements.txt` for one of them (the Fluent linter), which means that the other job (the font tests) will not populate the cache with its dependencies. This can be seen by opening any font tests or Fluent linting build and noticing that they report the exact same cache key even though their dependencies are different. In the installation step the dependencies are reported as "Downloading [package].whl" instead of the expected "Using cached [package].whl". This commit fixes the issue by explicitly defining a `requirements.txt` file for both jobs and pointing the caching functionality to the specific file paths to make sure that unique caches with the correct package data are used. While we're here we also align the syntax and step titles in the files for consistency. [1] https://github.com/actions/setup-python?tab=readme-ov-file#caching-packages-dependencies
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20952 +/- ##
==========================================
- Coverage 62.58% 62.57% -0.01%
==========================================
Files 174 174
Lines 121947 121951 +4
==========================================
- Hits 76318 76311 -7
- Misses 45629 45640 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
themavik
reviewed
Mar 23, 2026
themavik
left a comment
There was a problem hiding this comment.
Adding cache: npm on setup-node and wiring pip cache-dependency-path to the renamed requirements files should cut cold CI time. nit: font_tests_requirements.txt floats fonttools on 4.* — if font tests ever break on a minor bump, consider pinning tighter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The commit messages contain more details about the individual changes.