From e55c350bff035cc63bd349bb715b1a65fb53b6b2 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 27 Sep 2026 08:54:24 +0200 Subject: [PATCH] ci: pre-commit shellcheck group skips the hook-env cache; pins move to pylint Measured on c73cfd3: cold 59 s / warm 54 s / 47 s -- inside 60 s with little margin. shellcheck is a language: system hook with no env, yet its group restored (and on a miss saved) the ~120 MB hook-env cache. The prettier/shfmt version-record step moves from rest (the slowest group on the warm run, 49 s) to pylint (the fastest, 31-37 s). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KFwA9nymhUdTrVF65kigTV --- .github/workflows/pre-commit.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 8da364b2..da22f134 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -89,9 +89,12 @@ jobs: # first, and the others would rebuild their hook envs on every run. The # restore-keys fall back to any env set built by the SAME interpreter # (this group's older config first, then any group's), so a config - # change rebuilds only the hooks whose rev moved. + # change rebuilds only the hooks whose rev moved. shellcheck is a + # `language: system` hook with no env to cache, so its group skips the + # ~120 MB restore (3-6 s) and the save. - uses: actions/cache@v4 id: cache + if: matrix.group != 'shellcheck' with: path: ~/.cache/pre-commit key: >- @@ -182,9 +185,10 @@ jobs: # workflow that does run them inherits the pin instead of re-deriving # it. Their real divergence risk is between developers: both REWRITE # files, so two versions reformat the repo back and forth. Installed in - # one group only; the other three would be paying for it twice over. + # one group only, pylint's: it finishes ~10 s ahead of the others, while + # rest (which also pays for zsh) was the slowest group with it. - name: Install prettier and shfmt (pinned) - if: matrix.group == 'rest' + if: matrix.group == 'pylint' env: PRETTIER_VERSION: 3.9.5 SHFMT_VERSION: v3.13.1 @@ -219,5 +223,5 @@ jobs: # group's key, so without this the envs of every hook rev ever used # would ride along forever. gc drops the ones the config no longer names. - name: Prune stale hook envs before the cache is saved - if: steps.cache.outputs.cache-hit != 'true' + if: matrix.group != 'shellcheck' && steps.cache.outputs.cache-hit != 'true' run: pre-commit gc