Skip to content

Commit 8d4151c

Browse files
committed
Fix Python caching in the GitHub Actions workflows
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
1 parent a3b1987 commit 8d4151c

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fonttools==4.*

.github/workflows/fluent_linter.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ jobs:
3434
with:
3535
python-version: '3.14'
3636
cache: 'pip'
37+
cache-dependency-path: '.github/fluent_linter_requirements.txt'
3738

38-
- name: Install Fluent dependencies
39-
run: |
40-
pip install -r .github/requirements.txt
39+
- name: Install requirements
40+
run: pip install -r .github/fluent_linter_requirements.txt
4141

4242
- name: Lint Fluent reference files
43-
run: |
44-
moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml
43+
run: moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml

.github/workflows/font_tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ jobs:
5656
with:
5757
python-version: '3.14'
5858
cache: 'pip'
59+
cache-dependency-path: '.github/font_tests_requirements.txt'
5960

60-
- name: Install Fonttools
61-
run: pip install fonttools
61+
- name: Install requirements
62+
run: pip install -r .github/font_tests_requirements.txt
6263

6364
- name: Run font tests
6465
run: npx gulp fonttest --headless

0 commit comments

Comments
 (0)