Skip to content

Commit 3e7a8e4

Browse files
committed
ci: prime and unify the dependency cache so lockfile changes don't cold-install every job
Previously setup-cache (cache-management.yml) restored a cache blob and auto-saved it without ever running the install, so a new lockfile hash would save a stale/empty blob under the new key and every downstream job would cold-install independently and throw the result away. Two fixes: 1. Prime on miss: when actions/cache misses in setup-cache, install UV and run `make dev-install` (ORB_SKIP_UI_BUILD=1 to skip the bun SPA build) before the job ends so actions/cache@v5 auto-saves a fully-populated .venv + ~/.cache/uv under the new key. Exactly one install runs per (python-version, lockfile-hash) combination; all downstream jobs hit the warm cache via setup-uv-cached. 2. Unified key base: replace the eight distinct cache-key-base values (test-deps, quality-deps, changelog-validation, container-build, docs-deps, test-matrix/test-deps, workflow-validation, dependabot) with a single "deps" base across all callers. Every workflow installs the identical --all-groups env via make dev-install, so one shared cache entry is correct and lets all workflows share a single warm blob. The reusable-test.yml cold-install fallback key format is updated to match (test-deps-py -> deps-py).
1 parent f3d74ba commit 3e7a8e4

10 files changed

Lines changed: 24 additions & 13 deletions

.github/workflows/cache-management.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
required: true
1313
type: string
1414
cache-key-base:
15-
description: 'Base cache key (e.g. test-deps, quality-deps)'
15+
description: 'Base cache key — all callers must pass "deps" for the shared env'
1616
required: true
1717
type: string
1818
python-version:
@@ -22,11 +22,11 @@ on:
2222
outputs:
2323
cache-key:
2424
description: 'Generated cache key for use in setup-uv-cached'
25-
value: ${{ jobs.generate-cache-key.outputs.cache-key }}
25+
value: ${{ jobs.setup-cache.outputs.cache-key }}
2626

2727
jobs:
28-
generate-cache-key:
29-
name: Generate Cache Key
28+
setup-cache:
29+
name: Prime Dependency Cache
3030
runs-on: ubuntu-latest
3131
permissions:
3232
contents: read
@@ -63,3 +63,14 @@ jobs:
6363
restore-keys: |
6464
${{ inputs.cache-key-base }}-py${{ inputs.python-version }}-
6565
${{ inputs.cache-key-base }}-
66+
67+
- name: Install UV
68+
if: steps.cache.outputs.cache-hit != 'true'
69+
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
70+
71+
- name: Populate cache (install dependencies on miss)
72+
if: steps.cache.outputs.cache-hit != 'true'
73+
env:
74+
# Suppress the bun SPA build — this job only primes the Python env.
75+
ORB_SKIP_UI_BUILD: "1"
76+
run: make dev-install

.github/workflows/changelog-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: ./.github/workflows/cache-management.yml
3333
with:
3434
cache-type: dependencies
35-
cache-key-base: changelog-validation
35+
cache-key-base: deps
3636
python-version: ${{ needs.config.outputs.default-python-version }}
3737

3838
validate-changelog:

.github/workflows/ci-quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: ./.github/workflows/cache-management.yml
4747
with:
4848
cache-type: dependencies
49-
cache-key-base: quality-deps
49+
cache-key-base: deps
5050
python-version: ${{ needs.config.outputs.default-python-version }}
5151

5252
auto-format:

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: ./.github/workflows/cache-management.yml
5050
with:
5151
cache-type: dependencies
52-
cache-key-base: test-deps
52+
cache-key-base: deps
5353
python-version: ${{ needs.config.outputs.default-python-version }}
5454

5555
# Parallel test-group matrix (T2613): splits the non-provider test corpus

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: ./.github/workflows/cache-management.yml
3333
with:
3434
cache-type: dependencies
35-
cache-key-base: dependabot
35+
cache-key-base: deps
3636
python-version: ${{ needs.config.outputs.default-python-version }}
3737

3838
update-uv-lock:

.github/workflows/dev-containers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
# fell through to the SHA-based fallback arm in cache-management.yml, producing
8383
# a cold key on every run and forcing a full dep reinstall each time.
8484
cache-type: dependencies
85-
cache-key-base: container-build
85+
cache-key-base: deps
8686
python-version: ${{ needs.config.outputs.default-python-version }}
8787

8888
container-pipeline:

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
uses: ./.github/workflows/cache-management.yml
5757
with:
5858
cache-type: dependencies
59-
cache-key-base: docs-deps
59+
cache-key-base: deps
6060
python-version: ${{ needs.config.outputs.default-python-version }}
6161

6262
build:

.github/workflows/reusable-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
${{
117117
inputs.cache-key != ''
118118
&& inputs.cache-key
119-
|| format('test-deps-py{0}-{1}',
119+
|| format('deps-py{0}-{1}',
120120
inputs.python-version || inputs.default-python-version,
121121
hashFiles('.project.yml', 'pyproject.toml', 'uv.lock'))
122122
}}

.github/workflows/test-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: ./.github/workflows/cache-management.yml
2929
with:
3030
cache-type: dependencies
31-
cache-key-base: test-deps
31+
cache-key-base: deps
3232
python-version: ${{ needs.config.outputs.default-python-version }}
3333

3434
unit-tests:

.github/workflows/validate-workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: ./.github/workflows/cache-management.yml
3636
with:
3737
cache-type: dependencies
38-
cache-key-base: workflow-validation
38+
cache-key-base: deps
3939
python-version: ${{ needs.config.outputs.default-python-version }}
4040

4141
validate-workflows:

0 commit comments

Comments
 (0)