AAnvio
Deployment

CI/CD

How Anvio's GitHub Actions pipelines lint, test, build, and release the monorepo.

4 min read

Anvio uses two GitHub Actions workflows: ci.yml runs on every push/PR to main, and release.yml runs on version tags. Both are read directly from .github/workflows/.

CI pipeline (.github/workflows/ci.yml)

Triggers: push to main, pull_request targeting main.

Rendering diagram…

lint and typecheck and test all run independently; build waits on all three (needs: [lint, typecheck, test]).

- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
  with:
    node-version: 20
    cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint

Same setup, then pnpm typecheck.

Runs against live service containers — this is the same trio used in Docker Compose:

services:
  postgres:
    image: postgres:16-alpine
    env:
      POSTGRES_USER: anvio
      POSTGRES_PASSWORD: anvio
      POSTGRES_DB: anvio
    ports: ["5432:5432"]
    options: >-
      --health-cmd pg_isready
      --health-interval 10s
      --health-timeout 5s
      --health-retries 5
  redis:
    image: redis:7-alpine
    ports: ["6379:6379"]
    options: >-
      --health-cmd "redis-cli ping"
      --health-interval 10s
      --health-timeout 5s
      --health-retries 5
  nats:
    image: nats:2.10-alpine
    ports: ["4222:4222"]
env:
  DATABASE_URL: postgresql://anvio:anvio@localhost:5432/anvio
  REDIS_URL: redis://localhost:6379
  NATS_URL: nats://localhost:4222
  JWT_SECRET: test-secret
  ANTHROPIC_API_KEY: test-key

Then: pnpm install --frozen-lockfile, pnpm build, pnpm test.

Note the nats service container has no health-check gate in CI (unlike Docker Compose's wget --spider http://localhost:8222/healthz) — tests that need NATS should tolerate a brief connection retry window.

Depends on lint, typecheck, and test all passing. Runs pnpm install --frozen-lockfile then pnpm build across the whole workspace.

All four jobs run on ubuntu-latest, use pnpm/action-setup@v4 and actions/setup-node@v4 with node-version: 20 and cache: pnpm, and install with --frozen-lockfile (no lockfile drift allowed in CI).

CI does not build or push Docker images. It validates the monorepo (lint, typecheck, unit/integration tests, build) but stops short of the container images described in Docker. Building Dockerfile.api / Dockerfile.worker / Dockerfile.gateway is a separate, manual/deploy-time step in the current pipeline.

TODO: No workflow file currently builds and pushes the three Dockerfiles to a registry. If you need container images in CI, add a docker build/docker push job — none exists in .github/workflows/ today.

Release pipeline (.github/workflows/release.yml)

Triggers: push of a v*.*.* tag, or manual workflow_dispatch with an existing tag input.

Rendering diagram…

Full gate before anything is published — checkout, pnpm/node setup, then in order:

- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm build
- run: pnpm test
  env:
    ANTHROPIC_API_KEY: test-key
    JWT_SECRET: test-secret

Note validate does not spin up Postgres/Redis/NATS service containers the way ci.yml's test job does — it relies on the same test suite tolerating their absence, or on ci.yml having already verified the commit on main.

Needs validate. Resolves the release tag (from the pushed tag ref, or the workflow_dispatch input), extracts the matching ## [x.y.z] section from CHANGELOG.md with an awk script, and creates a GitHub Release via softprops/action-gh-release@v2:

- name: Create GitHub Release
  uses: softprops/action-gh-release@v2
  with:
    tag_name: ${{ steps.tag.outputs.name }}
    name: Anvio ${{ steps.tag.outputs.name }}
    body: ${{ steps.changelog.outputs.body }}
    draft: false
    prerelease: ${{ contains(steps.tag.outputs.name, '-') }}
    generate_release_notes: false

If no matching CHANGELOG.md section is found, the workflow emits a ::warning:: annotation and falls back to a generic release body (Release <tag>. See CHANGELOG.md for details.).

Tags containing a hyphen (e.g. v1.22.0-rc.1) are automatically marked prerelease: true.

permissions: contents: write is granted at the workflow level so publish can create the release without extra token configuration (GITHUB_TOKEN is the built-in Actions token).

Cutting a release

# Bump version, update CHANGELOG.md with a matching ## [x.y.z] heading, commit
git tag v1.22.0
git push origin v1.22.0
# release.yml runs automatically

Or trigger manually against an existing tag via the Actions UI (workflow_dispatch → tag input) if the tag push didn't fire the workflow for some reason.

The release workflow does not publish npm packages or Docker images — it only validates the build/test suite and creates a GitHub Release with changelog notes. Confirm your deployment target (Docker Compose host, etc.) pulls from the tagged commit or built image separately.

Edit on GitHub

Last updated on

On this page