CI/CD
Spawn provides an official GitHub Action to install the CLI in your workflows.
GitHub Action
Section titled “GitHub Action”The saward/spawn-action action downloads the Spawn CLI and adds it to your PATH.
Basic usage
Section titled “Basic usage”- name: Install Spawn uses: saward/spawn-action@v1Pinning a version
Section titled “Pinning a version”- name: Install Spawn uses: saward/spawn-action@v1 with: version: "0.1.8"Without version, the latest release is installed.
Example workflow
Section titled “Example workflow”A typical CI workflow installs Spawn, starts a database, validates migrations, and runs tests.
name: Database Testson: [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-triggerKey commands for CI
Section titled “Key commands for CI”spawn check
Section titled “spawn check”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 checkspawn test compare
Section titled “spawn test compare”Runs tests and compares output against expected baselines. Fails if there are any differences.
- name: Run tests run: spawn test compare my-tests