Skip to content

Merge pull request #1495 from Open-Source-Legal/claude/fix-annotation… #3539

Merge pull request #1495 from Open-Source-Legal/claude/fix-annotation…

Merge pull request #1495 from Open-Source-Legal/claude/fix-annotation… #3539

Workflow file for this run

name: Frontend CI
defaults:
run:
working-directory: ./frontend
on:
push:
branches:
- main
- v*
pull_request:
paths:
- "frontend/**"
- ".github/workflows/frontend.yml"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile # Use frozen lockfile for CI
- name: Lint Prettier
run: yarn run lint
# Gate explicit `any` usage against frontend/.any-baseline.json so the
# count cannot regress. `--check-strict` also fails when the count drops
# without the baseline being lowered, keeping the file in lockstep with
# reality. See issue #1448 and docs/frontend/any-baseline.md.
- name: Check any-baseline
run: yarn run any:check:strict
component-test:
name: Component Tests
runs-on: ubuntu-latest
needs: lint # Run only if lint job passes
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn # Still need global yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile # Use frozen lockfile for CI
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright Component Tests with Coverage
run: yarn run test:coverage:ct
# Metadata tests already run with coverage above (included in *.ct.tsx).
# This separate re-run without coverage catches flaky failures that
# may have been masked by retries, without blocking the pipeline.
- name: Re-run Metadata Component Tests (flakiness check)
run: |
yarn run test:ct --reporter=list tests/*Metadata*.ct.tsx
continue-on-error: true
# The `frontend` flag is intentionally listed alongside
# `frontend-component` so the same upload feeds both the per-suite
# drill-in and the merged Frontend coverage total. Codecov aggregates
# all uploads sharing a flag server-side, so the README `flag=frontend`
# badge reflects the union of unit + component + e2e without any
# cross-workflow lcov merging on our side.
- name: Upload CT Coverage to Codecov
if: success() || failure()
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/coverage/ct/lcov.info
flags: frontend-component,frontend
name: frontend-ct-coverage
fail_ci_if_error: false
disable_search: true
build:
name: Build
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build TypeScript and Vite
run: yarn build
unit-test:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Yarn
run: npm install -g yarn
- name: Clear Yarn Cache
run: yarn cache clean
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Unit Tests with Coverage
run: yarn run test:coverage:unit
# See the CT upload above for why the `frontend` flag is listed here too.
- name: Upload Unit Coverage to Codecov
if: success() || failure()
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/coverage/unit/lcov.info
flags: frontend-unit,frontend
name: frontend-unit-coverage
fail_ci_if_error: false
disable_search: true
docker-build:
name: Build Docker Image
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build Docker Image
run: docker build -t opencontracts-frontend .