From 8d4151cfbb76758b1be339cb25187863a0c23465 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 22 Mar 2026 16:37:59 +0100 Subject: [PATCH] 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 --- .../{requirements.txt => fluent_linter_requirements.txt} | 0 .github/font_tests_requirements.txt | 1 + .github/workflows/fluent_linter.yml | 9 ++++----- .github/workflows/font_tests.yml | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) rename .github/{requirements.txt => fluent_linter_requirements.txt} (100%) create mode 100644 .github/font_tests_requirements.txt diff --git a/.github/requirements.txt b/.github/fluent_linter_requirements.txt similarity index 100% rename from .github/requirements.txt rename to .github/fluent_linter_requirements.txt diff --git a/.github/font_tests_requirements.txt b/.github/font_tests_requirements.txt new file mode 100644 index 000000000..e8ce6dfc4 --- /dev/null +++ b/.github/font_tests_requirements.txt @@ -0,0 +1 @@ +fonttools==4.* diff --git a/.github/workflows/fluent_linter.yml b/.github/workflows/fluent_linter.yml index f92d1df03..e7dfbca34 100644 --- a/.github/workflows/fluent_linter.yml +++ b/.github/workflows/fluent_linter.yml @@ -34,11 +34,10 @@ jobs: with: python-version: '3.14' cache: 'pip' + cache-dependency-path: '.github/fluent_linter_requirements.txt' - - name: Install Fluent dependencies - run: | - pip install -r .github/requirements.txt + - name: Install requirements + run: pip install -r .github/fluent_linter_requirements.txt - name: Lint Fluent reference files - run: | - moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml + run: moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml diff --git a/.github/workflows/font_tests.yml b/.github/workflows/font_tests.yml index 6ff7aecde..e8630d330 100644 --- a/.github/workflows/font_tests.yml +++ b/.github/workflows/font_tests.yml @@ -56,9 +56,10 @@ jobs: with: python-version: '3.14' cache: 'pip' + cache-dependency-path: '.github/font_tests_requirements.txt' - - name: Install Fonttools - run: pip install fonttools + - name: Install requirements + run: pip install -r .github/font_tests_requirements.txt - name: Run font tests run: npx gulp fonttest --headless