> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magnitude.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing in CI

> Run Magnitude tests with GitHub Actions

You can kick off Magnitude tests from GitHub actions by:

1. Ensuring that your development server is accessible in the test runner
2. Ensuring `magnitude-test` gets installed on the test runner
3. Running the appropriate `npx magnitude` CLI command
4. Including the appropriate LLM client credentials

Here's an example `.githhub/workflows/magnitude.yaml`, from our our [example repo](https://github.com/magnitudedev/magnitude-demo-repo/blob/main/.github/workflows/magnitude.yaml):

```yaml theme={null}
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 }}
    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
```
