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

# CI/CD Integration

> Running Replay workflows in CI pipelines — GitHub Actions, GitLab CI, and more.

# CI/CD Integration

Replay is designed to run in CI/CD pipelines. It has zero runtime dependencies (for HTTP-only workflows) and produces exit codes that integrate naturally with CI systems.

## GitHub Actions

### Basic E2E Test

```yaml theme={null}
name: E2E Tests
on: [push, pull_request]

jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: "1.25"

      - name: Install Replay
        run: go install github.com/replay/replay@latest

      - name: Run E2E workflows
        run: replay run tests/e2e/*.yaml --concurrency 4 --fail-fast
```

### With PostgreSQL and Redis

```yaml theme={null}
jobs:
  e2e-with-db:
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:15-alpine
        env:
          POSTGRES_PASSWORD: password
        options: >-
          --health-cmd pg_isready
          --health-interval 5s
      redis:
        image: redis:7-alpine
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 5s

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: "1.25"

      - name: Install Replay
        run: go install github.com/replay/replay@latest

      - name: Run workflows
        run: replay run tests/db/*.yaml --concurrency 2 --fail-fast
        env:
          POSTGRES_DSN: postgres://postgres:password@postgres:5432/postgres
          REDIS_ADDR: redis:6379
```

## GitLab CI

```yaml theme={null}
e2e-tests:
  image: golang:1.25-alpine
  services:
    - postgres:15-alpine
    - redis:7-alpine
  variables:
    POSTGRES_PASSWORD: password
    POSTGRES_DB: testdb
    REDIS_ADDR: redis:6379
  script:
    - go install github.com/replay/replay@latest
    - replay run tests/*.yaml --concurrency 4 --fail-fast
```

## Post-Deployment Smoke Tests

Run smoke tests after deploying to staging or production:

```yaml theme={null}
deploy:
  stage: deploy
  script:
    - ./deploy.sh
  only:
    - main

smoke-test:
  stage: verification
  script:
    - go install github.com/replay/replay@latest
    - replay run smoke.yaml --profile ${CI_ENVIRONMENT_NAME}
  environment:
    name: staging
  needs: [deploy]
```

## Docker in CI

```yaml theme={null}
jobs:
  docker-e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Replay via Docker
        run: |
          docker run --rm \
            -v $(pwd):/app \
            ghcr.io/replay/replay:latest \
            run /app/workflows/*.yaml --concurrency 4
```

## Integration with Seedling

Replay and [Seedling](/seedling) work together to create reproducible, data-backed E2E tests.

### Seed DB with Seedling, Test with Replay

Use Seedling to populate a database with deterministic test data (pass `--seed` for repeatability), then run Replay workflows against it:

```yaml theme={null}
jobs:
  seedling-replay-e2e:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:15-alpine
        env:
          POSTGRES_PASSWORD: password
        options: >-
          --health-cmd pg_isready
          --health-interval 5s

    steps:
      - uses: actions/checkout@v4

      - name: Install Seedling
        run: go install github.com/tomiwa-a/seedling@latest

      - name: Seed test data
        run: |
          seedling generate \
            --count 1000 \
            --seed 42 \
            --dsn "postgres://postgres:password@postgres:5432/postgres"

      - name: Install Replay
        run: go install github.com/replay/replay@latest

      - name: Run E2E workflows
        run: replay run tests/e2e/*.yaml --concurrency 4 --fail-fast
        env:
          POSTGRES_DSN: postgres://postgres:password@postgres:5432/postgres
```

Using the same `--seed 42` in every run guarantees identical data sets, which means your Replay assertions stay stable across CI runs.

### Local Dev Loop

```bash theme={null}
seedling generate --count 500 --seed 42 --dsn "$DSN" && replay run test.yaml
```

Pair this with `replay run --watch` during development for instant feedback on schema changes.

## Exit Codes

Replay exits with:

* `0` — All workflows passed
* `1` — One or more workflows failed (or validation error)

This means standard CI failure handling works without special configuration.

## Best Practices for CI

* Use `--concurrency 4` to speed up multi-workflow runs
* Use `--fail-fast` to stop on first failure, saving pipeline time
* Use `--profile` to switch between environment configs
* Pin a specific Replay version in CI (`@latest` or a specific tag)
* Place workflows in a `tests/` or `e2e/` directory for organisation
* Use [deterministic seeds and data](/seedling/determinism) to avoid flaky tests

## What's Next?

* See [real-world use cases](/replay/guides/use-cases) for QA and dev teams
* Review [best practices](/replay/guides/best-practices) for reliable workflows
