Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,29 @@ 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@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
with:
path: ~/.cache/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
mkdir -p ~/.cache/msttcorefonts/
cp /usr/share/fonts/truetype/msttcorefonts/*.ttf ~/.cache/msttcorefonts/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Empty cache saved on apt install failure creates persistent failure loop

If ttf-mscorefonts-installer fails to download fonts (exactly the intermittent failure this PR is fixing), mkdir -p ~/.cache/msttcorefonts/ still succeeds and creates an empty directory. The subsequent cp then fails, but actions/cache's post-job step runs regardless of job status and saves the empty ~/.cache/msttcorefonts/ directory under the key runner.os-msttcorefonts-v1. On every subsequent run the cache is a hit and the "install fonts from cache" step runs — sudo cp ~/.cache/msttcorefonts/*.ttf ... glob-expands to nothing, the step fails, and tests never run. The only recovery is a manual cache key bump.

A minimal fix is to guard the cp so it either exits cleanly without saving an empty cache (e.g. check that .ttf files exist first) or to avoid caching on failure.

- 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
- name: test
run: |
cd /tmp && python -m pytest --pyargs neat_ml --cov=neat_ml --cov-report=term-missing