Skip to content

Commit 871c076

Browse files
committed
ci: add build-cache job to pre-build Nix environments
Add a dedicated build-cache job that runs before other CI jobs to pre-populate the Nix store cache. This ensures that subsequent parallel jobs (gitleaks, ci matrix, coverage) can benefit from the cached derivations instead of each rebuilding from scratch. The build-cache job: - Runs as a matrix for both python311 and python313 - Builds the Nix development environment - Saves the cache via cache-nix-action for downstream jobs gitleaks, ci, and coverage jobs now depend on build-cache to ensure cache is available before they run.
1 parent 3cb93bb commit 871c076

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ permissions:
1616
id-token: write
1717

1818
jobs:
19+
build-cache:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
python-version: ["python311", "python313"]
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
27+
28+
- name: Setup Nix
29+
uses: ./.github/actions/setup-nix
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Build Nix environment
34+
run: nix develop .#${{ matrix.python-version }} --command true
35+
1936
gitleaks:
37+
needs: build-cache
2038
runs-on: ubuntu-latest
2139
steps:
2240
- name: Checkout repository
@@ -31,6 +49,7 @@ jobs:
3149
run: nix develop --command just gitleaks
3250

3351
ci:
52+
needs: build-cache
3453
runs-on: ubuntu-latest
3554
strategy:
3655
matrix:
@@ -56,6 +75,7 @@ jobs:
5675
run: nix develop .#${{ matrix.python-version }} --command just test
5776

5877
coverage:
78+
needs: build-cache
5979
runs-on: ubuntu-latest
6080
if: github.ref == 'refs/heads/main'
6181
steps:

0 commit comments

Comments
 (0)