GitHub Actions Integration

Automate your data generation in GitHub Actions workflows.

Prerequisite

You need a Pro License to use the --auto-approve flag required for non-interactive CI/CD environments.

Setup Guide

1. Add License Key Secret

Go to your repository settings on GitHub: Settings > Secrets and variables > Actions > New repository secret.

  • Name: APHELION_LICENSE_KEY
  • Value: Your Pro license key (e.g., pro:your-key:email@example.com)

2. Create Workflow File

Create a file at .github/workflows/test.yml with the following content:

name: Test with Synthetic Data

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_USER: test_user
          POSTGRES_PASSWORD: test_password
          POSTGRES_DB: test_db
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 18
          
      - name: Download Aphelion CLI
        run: |
          curl -L "https://algomimic.com/api/download/pro?key=${{ secrets.APHELION_LICENSE_KEY }}" \
            -o aphelion
          chmod +x aphelion
      
      - name: Generate Test Data
        run: |
          # Wait for Postgres
          until pg_isready -h localhost -p 5432 -U test_user; do sleep 1; done
          
          # Clone/Generate Data
          ./aphelion clone "postgresql://prod_user:prod_pass@prod-db.example.com/prod_db" \
             "postgresql://test_user:test_password@localhost:5432/test_db" \
             --auto-approve \
             --seed 12345
        env:
          PGPASSWORD: test_password
      
      - name: Run Tests
        run: npm test

Common Configurations

Using a Schema File

If you have a .schema.json committed to your repo:

./aphelion generate .schema.json \
  --output ./sql-output \
  --seed 12345 \
  --auto-approve

Caching the Binary

To speed up builds, you can cache the CLI tool:

- name: Cache Aphelion
  uses: actions/cache@v3
  with:
    path: ./aphelion
    key: aphelion-cli-${{ runner.os }}