GitLab CI Integration
Integrate high-speed synthetic data generation into your GitLab CI pipelines.
Prerequisite
You need a Pro License to use the --auto-approve flag required for
non-interactive CI/CD environments.
Setup Guide
1. Add License Variable
Go to your GitLab project: Settings > CI/CD > Variables > Add variable.
- Key:
APHELION_LICENSE_KEY - Value: Your Pro license key
- Type: Variable
- Flags: Mask variable (recommended)
2. Create .gitlab-ci.yml
Add the test job to your existing pipeline configuration:
test_with_data:
stage: test
image: node:18
services:
- name: postgres:14
alias: postgres
command: ["postgres", "-c", "fsync=off"] # Performance optimization
variables:
POSTGRES_DB: test_db
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
before_script:
# Install Aphelion CLI
- curl -L "https://algomimic.com/api/download/pro?key=${APHELION_LICENSE_KEY}" -o aphelion
- chmod +x aphelion
# Install dependencies
- npm ci
script:
# Generate Data
- ./aphelion clone "postgresql://prod_u:prod_p@prod-db.com/prod" \
"postgresql://runner@postgres/test_db" \
--auto-approve \
--seed 12345
# Run Tests
- npm test
Optimization Tips
Using Artifacts
If you generate SQL files instead of direct database insertion, you can pass them as artifacts to downstream jobs:
generate_data:
stage: build
script:
- ./aphelion generate .schema.json --output ./sql-data
artifacts:
paths:
- sql-data/
expire_in: 1 hour
Parallel Testing
Aphelion is deterministic, so you can safely split tests across multiple runners:
test_shard:
parallel: 4
script:
- ./aphelion clone ... # Same data every time
- npm test -- --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL