From 4410d88f1611a9f55fc120f6fa5927308700862d Mon Sep 17 00:00:00 2001 From: Corrin Lakeland Date: Sun, 2 Aug 2026 20:31:08 +1200 Subject: [PATCH] ci: cache mypy incremental state in the backend type check job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend Type Check ran full-strict mypy cold on every push (~2m15s). Mypy is incremental, so restoring .mypy_cache lets it re-check only the modules whose dependencies changed — typical pushes drop to seconds. The key embeds the commit SHA because actions/cache never overwrites an existing key; restore-keys falls back to the newest snapshot for the same poetry.lock + pyproject.toml. The other candidate (caching pre-commit hook environments) turned out to already exist inside pre-commit/action@v3, so it is not duplicated here. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01PnuHL7w3UisSk6KQ81q3Qf --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cca23aa4b..1a116b30b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,18 @@ jobs: key: poetry-${{ hashFiles('poetry.lock') }} restore-keys: poetry- + # Mypy is incremental: with a restored .mypy_cache it only re-checks + # modules whose dependencies changed. The key includes the commit SHA so + # every run saves a fresh snapshot (actions/cache never overwrites an + # existing key); restore-keys falls back to the most recent snapshot for + # the same deps/config. + - name: Cache mypy incremental state + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 + with: + path: .mypy_cache + key: mypy-${{ hashFiles('poetry.lock', 'pyproject.toml') }}-${{ github.sha }} + restore-keys: mypy-${{ hashFiles('poetry.lock', 'pyproject.toml') }}- + - name: Install dependencies run: | python -m pip install --upgrade pip