From 8de225bf6d19cebf9a801e12ccde85871d40e681 Mon Sep 17 00:00:00 2001 From: Adam Witmer Date: Tue, 9 Jun 2026 15:47:13 -0600 Subject: [PATCH 1/5] CI: cache microsoft fonts --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f1d7d4..d30beb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,22 @@ jobs: python -m pip install -v ".[dev]" mypy neat_ml ruff check neat_ml - - name: install fonts + - name: cache fonts + id: cache-fonts if: runner.os == 'Linux' + uses: actions/cache@v5 + with: + path: /usr/share/fonts/truetype/msttcorefonts/ + key: ${{ runner.os }}-msttcorefonts-v1 + - name: install fonts + if: runner.os == 'Linux' && steps.cache-fonts.outputs.cache-hit != 'true' run: | echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections sudo apt-get update sudo apt-get install -y ttf-mscorefonts-installer || true - sudo fc-cache -f -v + - name: refresh font cache + if: runner.os == 'Linux' + run: sudo fc-cache -f -v - name: test run: | cd /tmp && python -m pytest --pyargs neat_ml --cov=neat_ml --cov-report=term-missing From 815cfb925ab0b01af5c8fd8d2f5cb84d74dcddd9 Mon Sep 17 00:00:00 2001 From: Adam Witmer Date: Tue, 9 Jun 2026 16:21:02 -0600 Subject: [PATCH 2/5] MAINT, CI: address AI reviewer comment * store cached files in user-writable path and copy to root-owned directory * add step to separate font install via download vs. from cache --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d30beb3..b52f613 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: if: runner.os == 'Linux' uses: actions/cache@v5 with: - path: /usr/share/fonts/truetype/msttcorefonts/ + path: ~/.cache/msttcorefonts/ key: ${{ runner.os }}-msttcorefonts-v1 - name: install fonts if: runner.os == 'Linux' && steps.cache-fonts.outputs.cache-hit != 'true' @@ -38,6 +38,13 @@ jobs: echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections sudo apt-get update sudo apt-get install -y ttf-mscorefonts-installer || true + mkdir -p ~/.cache/msttcorefonts/ + cp /usr/share/fonts/truetype/msttcorefonts/*.ttf ~/.cache/msttcorefonts/ + - name: install fonts from cache + if: runner.os == 'Linux' && steps.cache-fonts.outputs.cache-hit == 'true' + run: | + sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts/ + sudo cp ~/.cache/msttcorefonts/*.ttf /usr/share/fonts/truetype/msttcorefonts/ - name: refresh font cache if: runner.os == 'Linux' run: sudo fc-cache -f -v From 864a596a5d983ed3683da4670ba835988f35c7df Mon Sep 17 00:00:00 2001 From: Adam Witmer Date: Thu, 11 Jun 2026 09:05:38 -0600 Subject: [PATCH 3/5] CI: use github actions cache hash --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b52f613..4660164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: cache fonts id: cache-fonts if: runner.os == 'Linux' - uses: actions/cache@v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5 with: path: ~/.cache/msttcorefonts/ key: ${{ runner.os }}-msttcorefonts-v1 From b5d74b97209d490212647f9fbf085f14deb2aa81 Mon Sep 17 00:00:00 2001 From: Adam Witmer Date: Thu, 11 Jun 2026 09:57:50 -0600 Subject: [PATCH 4/5] MAINT: fix hash version comment * change from incorrect `v5` to correct hash `v5.0.5` --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4660164..86885da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: cache fonts id: cache-fonts if: runner.os == 'Linux' - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5 + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5 with: path: ~/.cache/msttcorefonts/ key: ${{ runner.os }}-msttcorefonts-v1 From 189da6de0a1ad5c6b0e1a328fadad674ed065551 Mon Sep 17 00:00:00 2001 From: Adam Witmer Date: Thu, 11 Jun 2026 17:28:48 -0600 Subject: [PATCH 5/5] CI: modify cache logic to check for successful download --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86885da..434fe9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,8 +38,19 @@ jobs: echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections sudo apt-get update sudo apt-get install -y ttf-mscorefonts-installer || true - mkdir -p ~/.cache/msttcorefonts/ - cp /usr/share/fonts/truetype/msttcorefonts/*.ttf ~/.cache/msttcorefonts/ + # before making the user storage directory, check if the font(s) we need + # (i.e. `Arial.ttf` and `Arial_Bold.ttf`) exist/were successfully downloaded + # to the root directory to avoid loading an empty directory on a successful + # ``cache-hit`` + if [[ ! -f "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf" || \ + ! -f "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf" ]]; then + echo "Fonts not downloaded successfully." + exit 1 + else + echo "Fonts downloaded successfully. Caching fonts..." + mkdir -p ~/.cache/msttcorefonts/ + cp /usr/share/fonts/truetype/msttcorefonts/*.ttf ~/.cache/msttcorefonts/ + fi - name: install fonts from cache if: runner.os == 'Linux' && steps.cache-fonts.outputs.cache-hit == 'true' run: |