CI/CD Integration
Run Chroma tests in continuous integration pipelines
This guide covers setting up Chroma tests in GitHub Actions.
GitHub Actions
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Download extensions
run: npm run test:prepare
- name: Run Playwright tests
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx playwright test --reporter=html
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30For a complete example, see the chroma-examples repository.
Caching
Speed up CI with dependency caching:
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
- name: Cache wallet extensions
uses: actions/cache@v4
with:
path: .chroma
key: ${{ runner.os }}-chroma-extensions-v1Parallel Test Execution
Run tests in parallel across multiple CI jobs:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
# ... setup steps ...
- name: Run tests (shard ${{ matrix.shard }}/4)
run: npx playwright test --shard=${{ matrix.shard }}/4Test Reports
HTML Report
- name: Deploy report to GitHub Pages
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: playwright-reportTroubleshooting CI
Shared memory issues
Always set --shm-size=2gb for Docker:
docker run --shm-size=2gb ...Missing dependencies
Use official Playwright Docker images that include all browser dependencies.
Flaky tests
Add retries for CI:
export default defineConfig({
retries: process.env.CI ? 2 : 0,
})