# Test in CI

Source: https://testis.dev/docs/ci

> Let the Testis AI tester check every pull request in GitHub Actions or any CI, read the exit codes and put the report on the job page.

In CI, Testis does what it does on your machine: the AI tester uses your app and reports what is broken. Each run uses your AI model, so it costs a little every time. To keep that small, test only what a pull request changes.

## GitHub Actions

The Testis action installs the CLI, starts your app (from `devCommand` in `.testis/config.yaml`), tests it, puts the report on the job page and keeps one comment on the pull request up to date.

```yaml
name: Testis
on: [pull_request]
permissions:
  contents: read
  pull-requests: write
jobs:
  testis:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0                 # so it can see what the pull request changed
      - uses: testisdev/testis@v1
        with:
          scope: changed                 # or "all" to test the whole app every time
          minutes: 20
        env:
          GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}      # your AI provider's key
          ADA_PASSWORD: ${{ secrets.ADA_PASSWORD }}      # test logins your config names
```

With `scope: changed` the tester is told which files the pull request changed and tests what they affect. `focus: "the checkout"` tests one part instead.

## Any other CI

```bash
npm install --global @testisdev/cli
testis install-browsers                          # only for web apps
testis test --no-open --minutes 20 "what changed: $(git diff --name-only origin/main...HEAD | tr '\n' ' ')"
cat .testis/runs/*/report.md                     # the newest report, for your job page
```

`testis -o json test` streams one JSON event per line (the plan, each step, each result) for your own tooling, and the run itself is saved in `.testis/runs/<id>/run.json`.

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | no bugs found |
| 1 | bugs found |
| 2 | configuration problem (bad config, missing secret) |
| 3 | environment problem (the app did not start, the AI could not be reached) |
| 4 | internal error |

## Send runs to your dashboard

With a Testis account, CI can upload each run. Create an access token in **Settings → Tokens** and store it as a CI secret:

```yaml
      - uses: testisdev/testis@v1
        with:
          token: ${{ secrets.TESTIS_TOKEN }}
          project: my-shop               # the dashboard project (defaults to the config's project name)
```

Uploading never fails a run: if the cloud is unreachable, the run still passes or fails on what the tester found. See [Account, dashboard and plans](/docs/cloud-account).
