---
title: "Check every change in CI"
description: "Run lint, the type check and the function and page tests on every pull request with no secrets, then the end-to-end suite on an account-free deployment, and gate the release on doctor."
canonical_url: "https://nuxt-backend.dev/docs/develop/testing/ci"
---
# Check every change in CI

> Run lint, the type check and the function and page tests on every pull request with no secrets, then the end-to-end suite on an account-free deployment, and gate the release on doctor.

Version: nuxt-backend 0.6.x · Tab: Develop · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Two jobs check each pull request, and a third gates the release. The first needs no secrets and no deployment. The second runs the app in a browser on a Convex deployment that exists only for the run.

- **What powers it natively:** GitHub Actions (or any CI), Vitest, Playwright, and Convex's account-free local deployment.
- **What the package adds:** test helpers that need no deployment, the dev inbox for sign-in codes, and `doctor --prod` as the release gate.

<table>
<thead>
  <tr>
    <th>
      Job
    </th>
    
    <th>
      Runs
    </th>
    
    <th>
      Needs
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        check
      </code>
    </td>
    
    <td>
      ESLint, the type check, the <a href="https://nuxt-backend.dev/docs/develop/testing/functions">
        function
      </a>
      
       and <a href="https://nuxt-backend.dev/docs/develop/testing/pages">
        page
      </a>
      
       tests
    </td>
    
    <td>
      Nothing: no secret, no deployment
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        e2e
      </code>
    </td>
    
    <td>
      The <a href="https://nuxt-backend.dev/docs/develop/testing/e2e">
        end-to-end
      </a>
      
       suite on an account-free local deployment
    </td>
    
    <td>
      A Resend test-mode key, and a Polar sandbox token for purchase tests
    </td>
  </tr>
  
  <tr>
    <td>
      Release
    </td>
    
    <td>
      <code>
        doctor --prod
      </code>
      
       before production goes live
    </td>
    
    <td>
      A production <code>
        CONVEX_DEPLOY_KEY
      </code>
    </td>
  </tr>
</tbody>
</table>

## Add the workflow

Create two repository secrets first, under **Settings › Secrets and variables › Actions**: `TEST_EMAIL_API_KEY`, a Resend key, and `SANDBOX_BILLING_ACCESS_TOKEN`, a Polar sandbox token.

```yaml [.github/workflows/ci.yml]
name: CI
on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npx nuxt prepare
      - run: npx eslint .
      - run: npx nuxt typecheck
      - run: npx vitest run

  e2e:
    needs: check
    # A fork's pull request gets no secrets, so it runs the first job only.
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npx playwright install --with-deps chromium
      - name: Give the run its test-mode keys
        env:
          EMAIL_API_KEY: ${{ secrets.TEST_EMAIL_API_KEY }}
          BILLING_ACCESS_TOKEN: ${{ secrets.SANDBOX_BILLING_ACCESS_TOKEN }}
        run: |
          printf 'EMAIL_API_KEY=%s\n' "$EMAIL_API_KEY" >> .env.local
          printf 'EMAIL_FROM=%s\n' 'onboarding@resend.dev' >> .env.local
          printf 'BILLING_ACCESS_TOKEN=%s\n' "$BILLING_ACCESS_TOKEN" >> .env.local
      - run: npx playwright test
      - uses: actions/upload-artifact@v4
        if: failure()
        with:
          name: playwright-report
          path: playwright-report/
```

`nuxt typecheck` needs `vue-tsc` and `typescript` as dev dependencies, and `eslint .` the config from [Lint backend functions](https://nuxt-backend.dev/docs/develop/testing/linting). `npx vitest run` runs only the projects in [the Vitest config](https://nuxt-backend.dev/docs/develop/testing#one-vitest-config-for-both), which leave `test/e2e/` to Playwright. The secrets reach the shell through `env:` and `printf`, so a quote or a `$` in a value stays literal.

The example names actions by tag to stay readable. Pin each `uses:` to a full commit SHA before you commit it, and never run a fork's code with secrets, as in `pull_request_target` ([Secure your supply chain](https://nuxt-backend.dev/docs/ship/security/supply-chain)).

## What the end-to-end job relies on

- **The deployment.** In CI, Playwright starts `npx nuxt-backend dev --anonymous` ([the Playwright config](https://nuxt-backend.dev/docs/develop/testing/e2e)). It makes a local deployment that needs no Convex account, and pushes the env, the keys above included. The deployment stops when the job ends.
- **Development mode.** `dev` sets `BACKEND_ENVIRONMENT` to `development`, so email stays in test mode and billing in Polar's sandbox, whatever key the job holds.
- **The catalog.** `backend/billing.generated.ts` holds the sandbox ids `billing sync` wrote, and it is committed. The job needs no sync.
- **Sign-in codes.** `npx nuxt-backend inbox <address> --json` reads them from the local deployment through Resend.

Use keys made for testing: a Resend key on a team apart from production's, and a token from your [Polar sandbox](https://nuxt-backend.dev/docs/services/polar#sandbox-and-test-mode) organization. A sandbox token can't take real money anywhere, and a development deployment sends mail to test addresses only.

Polar's webhooks can't reach a deployment inside the job. A purchase test still passes there, since the balance refreshes when the browser returns from checkout. A test of what a webhook alone changes, such as a renewal, needs a cloud dev deployment.

## Gate the release on doctor

Before production goes live, run `doctor` in production posture. It exits with `1` while any finding fails, which fails the job. Keep the production deploy key in a `production` environment with required reviewers, so no pull request can read it:

```yaml [.github/workflows/release.yml]
name: Release
on:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  gate:
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npx nuxt-backend doctor --prod --json > doctor.json
        env:
          CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY_PROD }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: doctor
          path: doctor.json
```

`--json` prints one document with stable finding ids, so a later step reads `doctor.json` rather than the wording ([Diagnose your setup with doctor](https://nuxt-backend.dev/docs/develop/doctor#gate-ci-and-the-launch-on-it)).

## Check it works

Open a pull request. Both jobs pass, and a failed `e2e` run leaves its Playwright report, with a trace of the retried test, under the run's artifacts.

## Related

- [Run end-to-end tests](https://nuxt-backend.dev/docs/develop/testing/e2e): the suite the second job runs.
- [Test your app](https://nuxt-backend.dev/docs/develop/testing): which test fits which change.
- [Diagnose your setup with doctor](https://nuxt-backend.dev/docs/develop/doctor): the release gate.
- [Production checklist](https://nuxt-backend.dev/docs/ship/checklist): what no command can check.
- [Secure your supply chain](https://nuxt-backend.dev/docs/ship/security/supply-chain): pinned actions and install policies.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
