> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gatojs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CI workflows

> The GitHub Actions workflows every GatoJS project ships with: verify and integration tests, end-to-end tests, mutation testing, dependency audit, secret scanning and workflow lint.

Every GatoJS project ships six GitHub Actions workflows in `.github/workflows/`. They check code; **none of them deploys**. Deploys happen on your hosting platform (for Railway, on every push to the connected branch, see [below](#ci-and-deploys)).

All workflows use `permissions: contents: read` and check out with `persist-credentials: false`. Node comes from `.nvmrc`.

| Workflow | Triggers | What it runs |
| - | - | - |
| `ci.yml` | Push and PR to `main` | Regenerate + `git diff`, `npm run verify`, integration tests on Postgres |
| `e2e.yml` | Push to `main`; PR to `main` unless only docs changed | Playwright against Postgres and Mailpit |
| `mutation.yml` | Manual only | Stryker mutation tests and the mutation gate |
| `security-audit.yml` | Dependency changes; Mondays 06:00 UTC | `npm audit` for critical production vulnerabilities |
| `security-secret-scan.yml` | Push and PR to `main` | TruffleHog on the pushed commits |
| `workflow-lint.yml` | Changes under `.github/workflows/` | actionlint |

## `ci.yml`

Runs on every push and pull request to `main`, with two jobs.

**`verify` (Generate + verify)**

```yaml .github/workflows/ci.yml theme={null}
- name: Regenerate wa files
  run: npm run wa -- generate

- name: Generated files are up to date
  run: git diff --exit-code

- name: Verify (lint, typecheck, test, build)
  run: npm run verify
```

1. `npm run wa -- generate` regenerates the registry, locale list and generated regions, and `git diff --exit-code` fails if anything changed. If this step fails, run `npx gato generate` locally and commit the result.
2. `npm run verify` runs lint, typecheck, unit tests, the production build, `turbo run test typecheck lint` for workspace packages, and the Git hook tests.

**`integration` (Integration tests, Postgres)**

Runs `npm run test:integration` against a `postgres:16` service, with `INTEGRATION_DATABASE_URL` pointing to a `<slug>_test` database.

### Module CI steps

Before the integration tests, the job runs the steps in the `wa:ci-integration` region:

```yaml .github/workflows/ci.yml theme={null}
# wa:ci-integration:start
- name: Start MinIO
  run: |
    docker run -d --name minio -p 9000:9000 ...
- name: Create MinIO bucket
  run: |
    docker run --rm --network host ... s3 mb s3://my-app-uploads
# wa:ci-integration:end
```

`gato generate` fills this region from the `ciSteps` field of each installed module's manifest. Today only the [`uploads`](https://docs.gatojs.com/modules/uploads) module contributes steps (from `ci/uploads.integration-steps.yml`): it starts MinIO and creates the `<slug>-uploads` bucket for the S3 integration tests. Without that module the region is empty. MinIO here serves tests only and has nothing to do with production storage.

> [!NOTE]
>
> Don't edit the region by hand. `gato add` and `gato remove` update it, and the `verify` job fails if it drifts from what the generator produces.

## `e2e.yml`

Runs Playwright end-to-end tests on every push to `main`, and on pull requests to `main` unless they only touch `docs/**`, root `*.md` files or `.husky/**`. Timeout: 30 minutes.

The `test-e2e` job:

1. starts `postgres:16` (database `<slug>_e2e`) and Mailpit as services;
2. installs Chromium (cached by Playwright version);
3. runs `npx prisma migrate dev --name init`;
4. runs `npm run test:e2e`, which builds the app and starts two standalone servers, one with `MULTI_ORG=false` and one with `MULTI_ORG=true`;
5. uploads the HTML report as the `playwright-report` artifact (kept 14 days), even on failure.

> [!WARNING]
>
> **`migrate dev` in CI can hide a missing migration.** If someone changed the Prisma schema without creating a migration, step 3 creates it on the fly and the tests pass, but `prisma migrate deploy` in production won't have it. Before pushing, run `npx prisma migrate dev` locally. `Already in sync, no schema change or pending migration was found.` means you're fine; otherwise commit the migration it creates.

See [Testing](https://docs.gatojs.com/guides/testing.md) for how the e2e suite is organized.

## `mutation.yml`

Runs only on manual dispatch (`workflow_dispatch`), for example before a release. Mutation tests are slow, so day to day you run them locally.

The `stryker` job (timeout 360 minutes):

1. restores incremental Stryker reports from the cache, so only changed code is re-mutated;
2. runs `npm run test:mutation` (unit tests);
3. runs the `wa:ci-integration` steps (MinIO for `uploads`, as in `ci.yml`);
4. runs `npm run test:mutation:integration`;
5. runs `npm run test:mutation:gate`, which enforces minimum mutation scores for critical files listed in `mutation-gate.json`;
6. uploads the reports as the `mutation-report` artifact.

A new run on the same ref cancels the previous one.

## `security-audit.yml`

Runs when `package.json` or `package-lock.json` changes on a push or pull request to `main` (on PRs, also when the workflow itself changes), and every Monday at 06:00 UTC.

```yaml .github/workflows/security-audit.yml theme={null}
- name: Install dependencies
  run: npm ci --ignore-scripts
- name: Audit for critical vulnerabilities
  run: npm audit --audit-level=critical --omit=dev
```

It fails only on a **critical** vulnerability in **production** dependencies. The weekly schedule catches advisories published after your last dependency change.

## `security-secret-scan.yml`

Runs on every push and pull request to `main`. The `trufflehog` job checks out the full history (`fetch-depth: 0`) and runs [TruffleHog](https://github.com/trufflesecurity/trufflehog) on the commits between the base and the head of the PR or push, reporting `verified` and `unknown` results.

If it fires, treat the secret as leaked: rotate it first, then remove it from history.

## `workflow-lint.yml`

Runs when anything under `.github/workflows/` changes on a push or pull request to `main`. The `actionlint` job lints the workflow files with [actionlint](https://github.com/rhysd/actionlint), catching syntax errors, bad expressions and shell issues before they break CI.

## CI and deploys

Railway deploys on push regardless of the CI result. To deploy only green commits, enable **Wait for CI** on the Railway service. The deploy then waits for all GitHub Actions workflows triggered for that commit, including `e2e.yml`, and is skipped if any fails. `mutation.yml` runs only manually, so deploys never wait for it.

See [Deploy on Railway](https://docs.gatojs.com/deployment/railway.md) for the rest of the setup.

## Kit-only workflows

The GatoJS repository itself has more workflows: `kit.yml`, `kit-mutation.yml`, `packages.yml`, `publish-packages.yml` and `release.yml`. They test and publish the kit and its CLI and are **not** copied into projects. See [Releases](https://docs.gatojs.com/contributing/releases.md).

## Related

> [card] [Testing](https://docs.gatojs.com/guides/testing.md)
>
> Unit, integration, e2e and mutation tests.

> [card] [gato generate](https://docs.gatojs.com/cli/generate.md)
>
> What the generator writes, including CI regions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.