English
Topic 22. Continuous integration with GitHub Actions
Goal: check every change automatically on a clean machine — a GitHub Actions workflow that verifies the formatting, builds in Release, detects a missing migration and runs all backend tests against PostgreSQL, and audits, lints, tests and builds the Angular client — and run exactly the same checks locally before each push.
Where we are
The application is complete. Module 6 makes it safe to change and brings it to a server; this topic adds the first safety net (Fig. 22.1).
Fig. 22.1. Continuous integration in the path of a change
- Starting point: topic 21 — the messenger is complete: 93 backend tests (19 data, 41 business, 33 API) and 49 frontend tests pass locally.
- At the end of the topic every push to
devand every pull request is checked by GitHub Actions in two parallel jobs,./Run.ps1 checkruns the same checks on your computer, andmainaccepts changes only through a pull request with green checks.
Steps
- GitHub Actions — workflows, jobs, steps and runners · the workflow file · triggers, permissions and concurrency
- The backend job — the SDK and the package cache · restore and the format check · the Release build · the migration check · tests with Testcontainers
- The frontend job — Node and the npm cache · a clean install and the audit · Prettier and ESLint · Vitest · the production build
- Running CI —
./Run.ps1 check· thedevbranch and the first run · reading a failed run · protectingmain - Checkpoint — what must work, self-check questions and exercises
Materials
- Course slides, part 5, Testing and CI/CD (slides "Three levels of backend tests", "Continuous integration:
ci.yml", "Eight gates before production") .github/workflows/ci.yml,Run.ps1,Directory.Build.propsDocs/Testing.md– test projects and continuous integration- GitHub Actions documentation