You can kick off Magnitude tests from GitHub actions by:
- Ensuring that your development server is accessible in the test runner
- Ensuring
magnitude-test
gets installed on the test runner
- Running the appropriate
npx magnitude
CLI command
- Including the appropriate LLM client credentials (MOONDREAM_API_KEY + whatever you need for your planner LLM of choice).
Here’s an example .githhub/workflows/magnitude.yaml
, from our our example repo:
name: Run Magnitude Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MOONDREAM_API_KEY: ${{ secrets.MOONDREAM_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install playwright
run: npx playwright install chromium
- name: Start development server
run: npm run dev &
- name: Wait for server to start
run: sleep 5
- name: Run tests with Xvfb
uses: GabrielBB/xvfb-action@v1
with:
run: npx magnitude -p