mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
* ci(coverage): measure frontend coverage with v8 and backend branch coverage The frontend had no coverage measurement, and the backend's line-only report counts a one-sided `if` as covered when its body never runs. - Add @vitest/coverage-v8 and `npm run test:coverage`. Its include lists every source file, so a file no test imports reports 0% instead of disappearing. Generated types, locales, tokens, test utilities, stories, fixtures and play helpers are excluded. - Frontend Checks runs tests with coverage and uploads the cobertura report to GitHub code coverage as code-coverage/vitest, mirroring pytest.yml: a separate job holds code-quality: write and fork PRs skip the upload. - Turn on branch coverage in backend/.coveragerc. Baseline on master: 407 test files pass; frontend lines 63.3%, branches 55.3%. The app project alone (no stories) gives 61.4% lines, so stories add about two points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY * ci(coverage): include JavaScript sources in the frontend coverage report The two audio worklets (gmeAudioWorklet.js, pico8AudioWorklet.js) are production code that the `{ts,vue}` glob left out of the report, so they now show at 0% instead of being omitted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
120 lines
4.0 KiB
YAML
120 lines
4.0 KiB
YAML
name: Frontend Checks
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "frontend/**"
|
|
- ".github/workflows/frontend.yml"
|
|
- ".github/actions/setup-frontend/**"
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths:
|
|
- "frontend/**"
|
|
- ".github/workflows/frontend.yml"
|
|
- ".github/actions/setup-frontend/**"
|
|
|
|
# A new push cancels a PR's superseded run; each master commit keeps its own.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up the frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
# Stories run in browser mode, which needs only the headless shell. The runner image
|
|
# already has its system libraries, and --with-deps can hang on a stalled apt mirror.
|
|
- name: Install Playwright browser
|
|
run: npx playwright install --only-shell chromium
|
|
working-directory: frontend
|
|
|
|
- name: Run tests (vitest, includes Storybook play() and a11y tests)
|
|
run: npm run test:coverage
|
|
working-directory: frontend
|
|
|
|
# Fork PRs can't upload.
|
|
- name: Upload coverage report artifact
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: frontend-coverage-report
|
|
path: frontend/coverage/cobertura-coverage.xml
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
# A separate job keeps code-quality: write away from the job that runs the PR's code.
|
|
upload-coverage:
|
|
needs: test
|
|
if: ${{ !cancelled() && needs.test.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 10
|
|
permissions:
|
|
contents: read
|
|
# actionlint doesn't know the code-quality scope yet.
|
|
# trunk-ignore(actionlint)
|
|
code-quality: write
|
|
steps:
|
|
- name: Download coverage report
|
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
with:
|
|
name: frontend-coverage-report
|
|
|
|
# Best-effort while GitHub code coverage is in preview; errors still show as annotations.
|
|
- name: Upload coverage to GitHub
|
|
uses: actions/upload-code-coverage@2b21a77928be8d5168c2b9581a67f2adbebacc52 # v1.4.4
|
|
with:
|
|
file: cobertura-coverage.xml
|
|
language: TypeScript
|
|
label: code-coverage/vitest
|
|
fail-on-error: false
|
|
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up the frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
working-directory: frontend
|
|
|
|
typecheck:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up the frontend
|
|
uses: ./.github/actions/setup-frontend
|
|
|
|
- name: Run typecheck
|
|
run: npm run typecheck
|
|
working-directory: frontend
|
|
|
|
- name: Lockfile lint
|
|
run: |
|
|
[ -z "$(jq -r '.packages | to_entries[] | select((.key | contains("node_modules")) and (.value.resolved | contains("git+ssh") | not) and (.value | has("resolved") and has("integrity") | not)) | .key' < package-lock.json)" ]
|
|
working-directory: frontend
|