|
| 1 | +# CI/CD Improvements — Implementation Record |
| 2 | + |
| 3 | +**Status**: Implemented (2026-03-16) |
| 4 | + |
| 5 | +## Changes Made |
| 6 | + |
| 7 | +### Phase A: Quick Wins |
| 8 | +- **`.dockerignore`** created in app-template, todo-app, hello-world, wit — excludes `.git`, `.github`, `__pycache__`, `.env`, docs, etc. WIT version also excludes `frontend/node_modules` and `frontend/.next` |
| 9 | +- **Pip caching** added to all deploy.yml files via `cache: 'pip'` on `actions/setup-python@v5` |
| 10 | + |
| 11 | +### Phase B: Test Reliability |
| 12 | +- **Tests made non-optional** — replaced `pytest || echo "skip"` with `pytest --collect-only` check; if tests exist they must pass, if none exist it skips gracefully |
| 13 | +- **Legacy backport** — todo-app and hello-world deploy.yml now include per-app credentials block (matches app-template); validate.yml updated with `continue-on-error: true` on platform checkout |
| 14 | + |
| 15 | +### Phase C: WIT Frontend CI |
| 16 | +- **New `ci.yml`** in wit — runs backend pytest + frontend TypeScript type-check (`tsc --noEmit`) and build (`npm run build`) on all pushes/PRs |
| 17 | + |
| 18 | +### Phase D: Build Performance |
| 19 | +- **BuildKit cache mounts** added to all Python Dockerfiles (`# syntax=docker/dockerfile:1`, `--mount=type=cache,target=/root/.cache/pip`) |
| 20 | +- WIT frontend Dockerfile also gets npm cache mount (`--mount=type=cache,target=/root/.npm`) |
| 21 | + |
| 22 | +### Phase E: Deployment Notifications |
| 23 | +- **GitHub Deployment API** integrated in app-template deploy.yml — creates deployment before SSH, updates status to success/failure after |
| 24 | + |
| 25 | +### Phase F: Workflow Deduplication |
| 26 | +- **Reusable `validate.yml`** created in `towlion/.github/.github/workflows/validate.yml` (workflow_call with tier input) |
| 27 | +- **app-template** validate.yml simplified to 8-line caller using the reusable workflow |
| 28 | +- **deploy.yml split** into `test` and `deploy` jobs in app-template (deploy `needs: test`) |
| 29 | + |
| 30 | +## Files Changed |
| 31 | + |
| 32 | +| Repo | File | Action | |
| 33 | +|------|------|--------| |
| 34 | +| app-template | `.dockerignore` | Created | |
| 35 | +| app-template | `.github/workflows/deploy.yml` | Modified (cache, test fix, deployment API, job split) | |
| 36 | +| app-template | `.github/workflows/validate.yml` | Modified (reusable workflow caller) | |
| 37 | +| app-template | `app/Dockerfile` | Modified (BuildKit cache mount) | |
| 38 | +| todo-app | `.dockerignore` | Created | |
| 39 | +| todo-app | `.github/workflows/deploy.yml` | Modified (cache, test fix, per-app credentials) | |
| 40 | +| todo-app | `.github/workflows/validate.yml` | Modified (continue-on-error) | |
| 41 | +| todo-app | `app/Dockerfile` | Modified (BuildKit cache mount) | |
| 42 | +| hello-world | `.dockerignore` | Created | |
| 43 | +| hello-world | `.github/workflows/deploy.yml` | Modified (cache, test fix, per-app credentials) | |
| 44 | +| hello-world | `.github/workflows/validate.yml` | Modified (continue-on-error) | |
| 45 | +| hello-world | `app/Dockerfile` | Modified (BuildKit cache mount) | |
| 46 | +| wit | `.dockerignore` | Created | |
| 47 | +| wit | `.github/workflows/deploy.yml` | Modified (cache, test fix) | |
| 48 | +| wit | `.github/workflows/ci.yml` | Created (frontend + backend CI) | |
| 49 | +| wit | `app/Dockerfile` | Modified (BuildKit cache mount) | |
| 50 | +| wit | `frontend/Dockerfile` | Modified (npm cache mount) | |
| 51 | +| .github | `.github/workflows/validate.yml` | Created (reusable workflow) | |
| 52 | + |
| 53 | +## Verification Checklist |
| 54 | +- [ ] Push each repo, confirm GitHub Actions pass |
| 55 | +- [ ] Check Actions logs for "Cache restored" on second run (pip cache) |
| 56 | +- [ ] Add a failing test in any repo → confirm deploy is blocked |
| 57 | +- [ ] Check todo-app/hello-world Actions for "Using per-app credentials" message |
| 58 | +- [ ] Push TypeScript error in wit/frontend → confirm ci.yml fails |
| 59 | +- [ ] SSH to server, run `docker compose build` twice → second build faster (BuildKit cache) |
| 60 | +- [ ] Check app-template repo Environments tab for deployment history |
0 commit comments