---
title: CI/CD
description: Run Shiplight E2E tests in CI on every push or pull request. Let your agent wire the workflow, upload results to Shiplight Cloud, and optionally auto-triage failures.
---

# CI/CD

<div class="view-markdown-wrapper">
<ViewMarkdown />
</div>

Run your Shiplight E2E tests in CI on every push or pull request, and upload the results to [Shiplight Cloud](https://app.shiplight.ai) for trend tracking, flaky-test detection, and team visibility.

Not sure where your tests should run? Start with [Where tests run](/local/where-tests-run).

## How it fits together

Three separate pieces, and it pays to keep them distinct:

- **Your Shiplight test project**: `tests/`, `specs/`, and a `package.json` that includes the `shiplightai` CLI. Scaffolded by `/shiplight init`; it must exist first.
- **A CI config file**: tells your CI provider how to install dependencies and run `shiplight test`, which uploads its completed report when `SHIPLIGHT_API_TOKEN` is set. One file per provider, at your repository root.
- **Your CI provider**: GitHub Actions, GitLab, etc. It detects the config file and runs it automatically on the trigger you set (push / PR / MR).

The config file does not create tests; it **runs an existing project**. On every provider the job boils down to the same four commands:

```bash
bun install                       # installs the shiplight CLI (shiplightai) + project deps
bun run playwright install chromium   # the browser the tests drive
bun run shiplight test                # run tests and upload the completed report
```

The token enables report upload automatically. `shiplight report` also uploads when regenerating or merging a report; set `SHIPLIGHT_REPORT_TO_CLOUD=0` to disable uploads.

## Let your agent set it up

Once tests exist, your agent can wire them into CI for you:

```
/shiplight ci
```

The agent looks at your repo, picks the right runner setup, writes the workflow, and tells you which secrets to add. You get a working workflow file in your repo (for GitHub Actions, `.github/workflows/e2e.yml`) that:

- **Runs the suite** on every push to main and every pull request
- **Uploads results to [Shiplight Cloud](/cloud_v2/)** even when tests fail, so a red run still produces a report with screenshots, videos, and traces

The one manual step: create an API token at [app.shiplight.ai/api-tokens](https://app.shiplight.ai/api-tokens) and store it as the `SHIPLIGHT_API_TOKEN` secret.

For providers other than GitHub Actions, copy the template from the matching page under [Other providers](#other-providers).

## Where the job runs

The commands above are the same wherever the job executes. What differs is the machine:

- **Your CI provider's runners**: GitHub's `ubuntu-latest`, GitLab shared runners, and so on. You install the browser and supply `SHIPLIGHT_API_TOKEN` or your own LLM credentials; a Shiplight token is still required for report uploads and the shared Cloud action cache.
- **[Shiplight CI runners](/cloud_v2/ci-runners)**: ephemeral Shiplight-hosted VMs with Chromium, Firefox, and WebKit preinstalled and credentials injected per run. GitHub Actions only, and enabled by changing a single `runs-on` line.

[Where tests run](/local/where-tests-run) compares the two (and local runs) with the cost implications of each.

## GitHub is first-class

[**GitHub Actions**](/local/ci/github-actions) is the primary integration. Only there can you add the optional [autofix workflow](#auto-triage-failures). Runtime self-healing is part of the `shiplight` CLI on every provider, and the shared Shiplight Cloud action cache works in any CI environment configured with `CI=true` and `SHIPLIGHT_API_TOKEN`. If you're on GitHub, start there.

## Persist action cache without Shiplight Cloud

Set `SHIPLIGHT_ACTION_CACHE_BACKEND=local` to keep self-healed actions in `.shiplight/action-cache/`, even in CI with a Shiplight token. Choose either **CI cache storage** (restore and save the directory) or **Git commits** (track cache JSON and let CI commit changes). Both avoid the Shiplight action-cache API; AI credentials and report uploads are configured separately.

See [Action cache in CI](/local/ci/action-cache) for workflow examples for both approaches and their conflict handling, and how to verify actual cache hits. The default `auto` backend still selects cloud storage in CI when a token is available; `cloud` explicitly selects it outside CI too.

## Auto-triage failures

Failed tests in uploaded runs can be triaged in two parts:

1. **Classification** runs on the Shiplight server for uploaded runs from any CI provider. It is off by default and needs no workflow step. An organization owner turns it on with a personal API token that has `organizations:write` (or full access):

   ```bash
   curl -X PUT "$SHIPLIGHT_API_URL/v1/org/triage-settings" \
     -H "Authorization: Bearer $SHIPLIGHT_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"classify": true, "autofix": false}'
   ```

   Set `"autofix": true` too when you add the autofix workflow. `SHIPLIGHT_API_URL` is `https://api.shiplight.ai` on the public service. Classification calls a model, so like other AI calls it needs credit and, except on an Enterprise contract, a card on file or a paid top-up ([Billing](/cloud_v2/billing#ai-steps-need-a-card-or-your-own-key)); without them, failed runs upload but aren't classified.
2. **Autofix (optional)** is a GitHub Actions workflow (not yet available for Bun projects). For fixable test issues, an agent applies the repair (the CI equivalent of [running `fix` locally](/guides/fix-a-failing-test)), re-runs the test to confirm, then **opens a PR** with the fix. It never auto-merges, and it can only touch the paths you allow (your test directories).

Notifications, such as a Slack message, are separate: wire them in a job you own. Ask your agent to set up autofix once the test workflow exists:

```
/shiplight ci, add the optional autofix workflow for failed E2E tests
```

The manual setup in the GitHub Actions guide describes the earlier [ci-triage workflow](/local/ci/github-actions#auto-triage-ci-failures-optional), which existing callers can keep using.

## Reading results

Each run lands in [Shiplight Cloud](/cloud_v2/) with its artifacts. Across runs you get trends, flaky-test detection, and failure attribution. Ask for them right from your agent:

```
/shiplight cloud, show failing tests from the last run
```

## Other providers

The `shiplight` CLI runs on any pipeline with Node.js 22 or newer. The templates use Bun for package management and command invocation, so install both runtimes where needed. Each page below gives a copy-paste template. The optional autofix workflow is **GitHub Actions only**. On every provider you supply the API token and install Chromium yourself.

AI-powered steps, including runtime self-healing, work on every provider when the job has `SHIPLIGHT_API_TOKEN` or supported bring-your-own-model credentials. With `CI=true` and a Shiplight token that has `action-cache:read` and `action-cache:write`, healed locators from passing tests are stored in the shared Shiplight Cloud action cache and can be reused by later runs.

- [GitLab CI](/local/ci/gitlab)
- [Depot CI](/local/ci/depot-ci)
- [CircleCI](/local/ci/circleci)
- [Jenkins](/local/ci/jenkins)
- [Travis CI](/local/ci/travis)
- [Buildkite](/local/ci/buildkite)
- [Azure DevOps](/local/ci/azure-devops)
- [Custom setups](/local/ci/custom): the generic recipe for any other provider

## Slow downloads in CI

On hosted runners with restricted or high-latency network access, installing dependencies or Playwright browsers may take significantly longer than expected.

Use a trusted regional mirror, proxy, or prebuilt container image provided by your organization or CI provider. A prebuilt image should include Node.js 22 or newer, Bun, the required browser dependencies, and a Playwright browser version compatible with the project.

## Related

- [Where tests run](/local/where-tests-run): local runs vs CI
- [CLI Reference](/local/cli-reference): full `shiplight test` / `shiplight report` documentation
- [Run Locally](/local/run-locally): project structure, authentication, and configuration
