Skip to main content

CI/CD Strategy

The Go backend (qubital-backend) runs its checks on GitHub Actions in tiers: cheap checks on every branch push, the full suite on a ready pull request, and a build and deploy on every merge to main. Prod is released by hand through the promote. How the deploy itself works is on the Deployment page.

Pipeline​

WhenWorkflowWhat runs
Push to a branch, until it has a ready PRbranch-check.yamlBlocking lint and the short unit tests (-short skips every testcontainers-backed test). About a minute. Docs-only pushes skip it
Push to a ready PRpr-quality-gate.yaml → go-suite.yamlThe Go suite: generated files up to date, vet of the end-to-end tier, blocking lint, every test with -race. This is the merge gate
PR that changes docker/, the binary build script or go.mod/go.sumapi-image-check.yamlBuilds the api image (not published) and runs an advisory Trivy scan
PR that changes .github/scripts/, contract/ or the specscript-tests.yamlThe deploy scripts' tests and the API contract generator
PR that changes centrifugo/centrifugo-image.yamlA smoke build of the broker image
Merge to mainbuild-push-staging.yamlRe-runs the Go suite unless the merged tree is one the gate passed, builds and pushes the images, deploys staging, publishes the staging API contract when the spec changed
By handpromote-staging-to-prod.yamlReleases a staging commit to prod (Deployment)
Nightly, 04:00 UTCe2e-staging-nightly.yamlEnd-to-end journeys against staging
Nightly, 03:00 UTCghcr-cleanup.yamlKeeps the last 15 staging images; never prunes prod or broker images
go.mod changes on main, weeklygo-cache.yamlWarms main's Go cache, which branch and PR runs restore

A draft PR gets the branch check only; marking it ready starts the gate.

Merge to main​

  1. Merged-tree check. A squash merge lands the tested tree only when the branch was up to date with main. The Go suite runs again on the merged tree before anything is built when the trees differ, when the gate's suite didn't pass on the PR head, or when the push didn't come from a merged PR. A merge that changed only docs since the last successful run is neither re-tested nor deployed.
  2. Build. The api and worker binaries are compiled on the runner (CGO_ENABLED=0); the Dockerfile only packages them. The broker image is content-addressed (src-<key> over centrifugo/'s build inputs) and built only when GHCR doesn't have that tag yet.
  3. Deploy staging through qubital-infra: the broker's digest first when it changed, then the api's, each waiting for verify; then /health.

Why checks sit where they do​

  • Fast feedback on branches, the full suite once per PR push. The branch check catches broken code within a minute; the expensive suite runs only when a PR is ready.
  • Nothing is re-tested after merge when the gate already passed that exact tree. Re-running tests on identical bytes can't give a different answer.
  • The prod release re-scans but doesn't re-test. The CVE database changes daily; the tested bytes don't. The promote scans the exact digest it ships, with a fresh database, and blocks on fixable HIGH or CRITICAL findings.
  • Images are built once. Prod gets staging's image by digest, never a rebuild.