Configure Exa CI/CD integration with GitHub Actions and testing.
Use when setting up automated testing, configuring CI pipelines,
or integrating Exa tests into your build process.
Trigger with phrases like "exa CI", "exa GitHub Actions",
"exa automated tests", "CI exa".
Set up CI/CD pipelines for Exa integrations with unit tests (mocked), integration tests (real API), and health checks. Uses GitHub Actions with secrets for API key management.
Prerequisites
GitHub repository with Actions enabled
Exa API key for testing
npm/pnpm project with vitest or jest
Instructions
Step 1: GitHub Actions Workflow
# .github/workflows/exa-tests.yml
name: Exa Integration Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- run: npm run test:unit
# Unit tests use mocked Exa — no API key needed
integration-tests:
runs-on: ubuntu-latest
# Only run if API key is available (not on forks)
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
EXA_API_KEY: ${{ secrets.EXA_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- run: npm run test:integration
timeout-minutes: 5
exa-health-check:
runs-on: ubuntu-latest
env:
EXA_API_KEY: ${{ secrets.EXA_API_KEY }}
steps:
- name: Verify Exa API connectivity
run: |
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST https://api.exa.ai/search \
-H "x-api-key: $EXA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"CI health check","numResults":1}')
echo "Exa API status: $HTTP_CODE"
[ "$HTTP_CODE" = "200" ] || exit 1
Step 2: Configure Secrets
# Add API key as repository secret
gh secret set EXA_API_KEY --body "your-exa-api-key"
# For staging/production deployments
gh secret set EXA_API_KEY_STAGING --body "staging-key" --env staging
gh secret set EXA_API_KEY_PROD --body "prod-key" --env production