Skip to content

ci: Add GitHub Actions workflows for automated testing and validation #12

ci: Add GitHub Actions workflows for automated testing and validation

ci: Add GitHub Actions workflows for automated testing and validation #12

Workflow file for this run

name: Test
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('./package.json').devDependencies.playwright || require('./node_modules/playwright-core/package.json').version")" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium --with-deps
- name: Install Playwright system dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Run tests
if: github.event_name != 'pull_request'
run: GH_CI=true yarn test
- name: Run tests with coverage
if: github.event_name == 'pull_request'
run: GH_CI=true yarn test:coverage
- name: Report coverage
if: github.event_name == 'pull_request'
uses: davelosert/vitest-coverage-report-action@v2
with:
name: 'Test Coverage Report'
json-summary-path: './coverage/coverage-summary.json'
json-final-path: './coverage/coverage-final.json'