ci: speed up build pipeline (NuGet cache, shallow checkout, jar layer reorder) (#190) #192

Merged
timothy merged 1 commits from feat/190-ci-cache into main 2026-07-08 19:54:25 +02:00
Owner

Closes #190.

Three CI-speed wins (CI-config only, no app code):

  1. Cache NuGet packages — test and migrations both ran dotnet restore from scratch every run (act_runner uses fresh containers). Added actions/cache@v4 on ~/.nuget/packages keyed on hashFiles('Directory.Packages.props', 'global.json') (both exist at repo root; clean cache key thanks to Central Package Management) before the Restore step in both jobs.
  2. Shallow checkout for test — test used fetch-depth: 0 but needs no history; dropped to 1. build (needs tags for git describe) left untouched. migrations checkout already defaults to depth 1 (documented with a comment).
  3. openapi-generator jar layer reorder (Dockerfile) — moved the wget of the 7.15.0 generator jar to before the openapi spec COPY, so API PRs that change v1.json no longer bust the ~30MB download layer. Codegen still runs after the spec copy. Exact URL/version preserved.

docs/ci-cd.md updated in the same PR.

YAML re-validated (yaml.safe_load). Watch this PR's run for the gating checks; the NuGet-cache effect is visible on the second run (first primes the cache).

🤖 Generated with Claude Code

Closes #190. Three CI-speed wins (CI-config only, no app code): 1. **Cache NuGet packages** — `test` and `migrations` both ran `dotnet restore` from scratch every run (act_runner uses fresh containers). Added `actions/cache@v4` on `~/.nuget/packages` keyed on `hashFiles('Directory.Packages.props', 'global.json')` (both exist at repo root; clean cache key thanks to Central Package Management) before the `Restore` step in both jobs. 2. **Shallow checkout for `test`** — `test` used `fetch-depth: 0` but needs no history; dropped to `1`. `build` (needs tags for `git describe`) left untouched. `migrations` checkout already defaults to depth 1 (documented with a comment). 3. **openapi-generator jar layer reorder (Dockerfile)** — moved the `wget` of the 7.15.0 generator jar to *before* the openapi spec `COPY`, so API PRs that change `v1.json` no longer bust the ~30MB download layer. Codegen still runs after the spec copy. Exact URL/version preserved. `docs/ci-cd.md` updated in the same PR. YAML re-validated (`yaml.safe_load`). Watch this PR's run for the gating checks; the NuGet-cache effect is visible on the *second* run (first primes the cache). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timothy added 1 commit 2026-07-08 19:40:09 +02:00
ci: speed up build pipeline (NuGet cache, shallow checkout, jar layer reorder)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 5m3s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 5m17s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
e68aa5834c
Three CI wins from ersatztv#190, all config-only:

- Cache ~/.nuget/packages via actions/cache@v4 in both the `test` and
  `migrations` jobs, keyed on Directory.Packages.props + global.json, so
  dotnet restore no longer starts from scratch every run.
- Shallow-checkout the `test` job (fetch-depth: 1) since it never runs
  git describe/log; only `build` needs full history for versioning. The
  `migrations` job's checkout was already effectively shallow (default
  fetch-depth 1), documented explicitly.
- Reorder the Dockerfile so the openapi-generator jar wget happens before
  the openapi spec COPY, decoupling the ~30MB download layer from spec
  changes (e.g. v1.json) that previously busted it on every API PR.

Documented all three in docs/ci-cd.md alongside the existing job/Dockerfile
notes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
timothy merged commit b37c2298b5 into main 2026-07-08 19:54:25 +02:00
timothy deleted branch feat/190-ci-cache 2026-07-08 19:54:25 +02:00
Sign in to join this conversation.