Skip to content

CI/CD

Spawn provides an official GitHub Action to install the CLI in your workflows.

The saward/spawn-action action downloads the Spawn CLI and adds it to your PATH.

- name: Install Spawn
uses: saward/spawn-action@v1
- name: Install Spawn
uses: saward/spawn-action@v1
with:
version: "0.1.8"

Without version, the latest release is installed.

A typical CI workflow installs Spawn, starts a database, validates migrations, and runs tests.

name: Database Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Spawn
uses: saward/spawn-action@v1
- name: Start database
run: docker compose up -d db
- name: Check migrations
run: spawn check
- name: Run tests
run: |
spawn test compare user-accounts
spawn test compare order-trigger

Validates that all migrations are pinned. Returns a non-zero exit code if any migrations are unpinned, making it a good gate for pull requests. Consult spawn check for more information.

- name: Check migrations
run: spawn check

Runs tests and compares output against expected baselines. Fails if there are any differences.

- name: Run tests
run: spawn test compare my-tests