.github/workflows/ci.yml.
Workflow Triggers
The CI workflow runs on:- Pull Requests - All PR events (open, synchronize, reopened)
- Push to main - When changes are merged to the main branch
- Manual Dispatch - Via GitHub UI (
workflow_dispatch)
Concurrency Control
The workflow uses concurrency groups to prevent redundant builds:Path-Based Job Filtering
Thechanges job uses dorny/paths-filter to detect which parts of the codebase changed:
| Filter | Paths | Triggers Jobs |
|---|---|---|
proto | proto/** | contract |
go | services/**, proto/** | go-lint, go-test, nix-build |
frontend | frontend/** | frontend-lint, frontend-build |
node | node-services/** | node-lint, node-test |
nix | **/*.nix, flake.nix, flake.lock | nix-build |
Jobs Reference
contract
Runs on: Pull requests whenproto/** files change
Purpose: Validates Protocol Buffers schema contracts
Steps:
- Checkout with full git history (
fetch-depth: 0) - Install buf CLI via
bufbuild/buf-action@v1 - Run
buf lintto check proto style and conventions - Run
buf breaking --against '.git#branch=main'to detect breaking API changes
proto/ doesn’t exist on main yet (new projects).
go-lint
Runs on: Pull requests when Go files change (services/**, proto/**)
Purpose: Enforces Go code quality standards
Steps:
- Checkout repository
- Install Go from
services/go.modversion - Run
golangci-lintv2.10 inservices/directory
.golangci.yml in the services directory.
go-test
Runs on: Pull requests when Go files change Purpose: Runs Go unit tests Steps:- Checkout repository
- Install Go from
services/go.modversion - Run
go test ./...inservices/directory
frontend-lint
Runs on: Pull requests whenfrontend/** files change
Purpose: Validates TypeScript/React code quality
Steps:
- Checkout repository
- Install Node.js 22 with npm cache
- Run
npm ciinfrontend/ - Run
npx biome check src/for linting and formatting checks
frontend-build
Runs on: Pull requests whenfrontend/** files change
Purpose: Verifies frontend builds successfully with type checking
Steps:
- Checkout repository
- Install Node.js 22 with npm cache
- Run
npm ciandnpm run buildinfrontend/
- TypeScript type checking
- Vite production build
- Asset optimization
node-lint
Runs on: Pull requests whennode-services/** files change
Purpose: Lints Node.js microservices
Strategy: Matrix job for each service:
auth-servicecustom-lang-service
- Checkout repository
- Install Node.js 22 with service-specific npm cache
- Run
npm ciinnode-services/<service>/ - Run
npx biome check .
node-test
Runs on: Pull requests whennode-services/** files change
Purpose: Runs unit tests for Node.js microservices
Strategy: Matrix job for each service:
auth-servicecustom-lang-service
- Checkout repository
- Install Node.js 22 with service-specific npm cache
- Run
npm ciinnode-services/<service>/ - Run
npm test(Vitest)
nix-build
Runs on: Any push/PR when Go or Nix files change Purpose: Builds reproducible service binaries and container images with Nix Runner:blacksmith-2vcpu-ubuntu-2404 (custom runner for Nix builds)
Steps:
- Checkout repository
- Install Nix with flakes enabled
- Configure Cachix cache (
hackz-megalo-cup) for build acceleration - Build service binaries:
nix build .#caller .#greeter .#gateway - Build container images:
nix build .#caller-image .#greeter-image .#gateway-image - (Main branch only) Push images to
ghcr.iowith SHA andlatesttags
ghcr.io/hackz-megalo-cup/<service>:<sha> and ghcr.io/hackz-megalo-cup/<service>:latest
Authentication: Uses GitHub token with packages: write permission.
render-manifests
Runs on: Push to main branch only (afternix-build succeeds)
Purpose: Regenerates Kubernetes manifests from nixidy modules and creates auto-merge PR
Runner: blacksmith-2vcpu-ubuntu-2404
Steps:
- Checkout repository
- Install Nix with flakes enabled
- Configure Cachix cache (skip push)
- Run
bash scripts/gen-manifests.shto render nixidy manifests - Create PR via
peter-evans/create-pull-request@v7:- Branch:
chore/render-manifests - Title: “chore: render nixidy manifests”
- Auto-delete branch after merge
- Branch:
- Enable auto-merge with squash strategy
deploy/manifests/ stays in sync with nixidy source definitions in deploy/k8s/*.nix.
Workflow Status Badge
Add CI status badge to your README:Skipping CI on Push to Main
Most validation jobs skip onpush events to main:
nix-build- To build and push container imagesrender-manifests- To update Kubernetes manifests
Caching Strategy
| Job | Cache Type | Location |
|---|---|---|
| Node jobs | npm dependencies | <service>/package-lock.json |
| Go jobs | Go modules | Automatic via setup-go |
| Nix jobs | Cachix binary cache | cachix.org/hackz-megalo-cup |
Debugging Failed CI
Contract Failures
- Breaking changes in proto files (field removals, type changes)
- Lint violations (naming conventions, required fields)
Go Lint/Test Failures
Frontend Failures
Nix Build Failures
Environment Variables
| Variable | Source | Usage |
|---|---|---|
GITHUB_TOKEN | Automatic | Authentication for gh CLI, packages |
CACHIX_AUTH_TOKEN | Repository secret | Push to Cachix binary cache |
Permissions
Jobs use minimal required permissions:Related Documentation
- Pre-commit Hooks - Local validation before CI
- Nixidy - Reproducible builds with Nix
- Protocol Buffers - API contract management