Skip to content

fix(ci): separate unit/browser jobs, npm test = unit-only #51

fix(ci): separate unit/browser jobs, npm test = unit-only

fix(ci): separate unit/browser jobs, npm test = unit-only #51

Workflow file for this run

name: CI
on:
push:
branches: [main, v3]
pull_request:
branches: [main, v3]
# Real-world tests run nightly to avoid rate limits on every push.
# They can also be triggered manually via workflow_dispatch.
schedule:
- cron: '0 3 * * *' # 03:00 UTC daily
workflow_dispatch:
inputs:
grep:
description: 'Test name filter (e.g. "Gorilla Mail" or "Reddit")'
required: false
default: ''
jobs:
# ─── Lint + Typecheck — runs on every push / PR ──────────────────────────────
lint-typecheck:
name: Lint & Typecheck
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Typecheck
run: npx tsc --noEmit
# ─── Unit tests — runs on every push / PR ────────────────────────────────────
unit:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- name: Run unit tests
run: npm test
# ─── Browser integration tests — runs on every push / PR ──────────────────────
browser:
name: Browser Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run browser integration tests
run: npm run test:browser
# ─── Real-world tests — nightly + manual only ────────────────────────────────
real-world:
name: Real-World Tests
# Only run on schedule or manual dispatch — never on regular push/PR.
# This prevents rate-limit bans from running against live sites too often.
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Run real-world tests
run: |
if [ -n "${{ github.event.inputs.grep }}" ]; then
npx playwright test --grep "${{ github.event.inputs.grep }}"
else
npx playwright test
fi
env:
REDDIT_USER: ${{ secrets.REDDIT_USER }}
REDDIT_PASS: ${{ secrets.REDDIT_PASS }}
CI: true
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ github.run_number }}
path: playwright-report/
retention-days: 7
- name: Upload test videos (failures only)
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-videos-${{ github.run_number }}
path: test-results/
retention-days: 3