mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Two gaps, one of them wide.
The contract tests added in c349e15c already ran inside `pytest -nauto`, but
fixture drift is silent by nature -- the frontend suite passes against a body the
API stopped sending -- so it deserves a check whose name says what broke.
`api-contract-tests` restores the same dependency cache as the other Python jobs,
skips the ffmpeg/catdoc install it does not need (verified), and runs the one
file, so it answers in under a minute instead of somewhere inside seventeen
hundred results.
The wide one: jest-tests.yml triggered on `pull_request: branches: [master]`, so
a pull request into anything else ran neither jest nor the webpack build. The
entire Semantic UI to Mantine migration went in that way -- seventy-five files
across nine pull requests into feature/custom-theme, not one of which ran either.
The build step is the one that matters most: jest and tsc both pass on a named
import that does not exist and only webpack rejects it, which is exactly how a
broken Archive.js survived a "clean" run earlier in this migration. The suite
did run on the branch after each merge, which is the wrong side of the merge to
learn about it.
`pull_request` is now unfiltered rather than listing branches, so the next
long-lived branch does not have to remember to add itself. It stays
`pull_request`, not `pull_request_target`: a fork's run gets a read-only token
and no secrets, and this workflow interpolates no event data, so widening the
trigger adds no injection or exfiltration path.
Worth knowing separately: none of this gates anything. master has no branch
protection and the only ruleset covers `release` (deletion, non-fast-forward), so
every check here is advisory. That is a repository setting, and Roland's to make.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
58 lines
2.1 KiB
YAML
58 lines
2.1 KiB
YAML
name: Jest Tests
|
|
|
|
# `pull_request` is deliberately unfiltered. It was `branches: [master]`, which meant a pull
|
|
# request into anything else ran no jest and no webpack build -- so the entire Semantic UI to
|
|
# Mantine migration, seventy-five files of it, was reviewed and merged across nine pull requests
|
|
# into `feature/custom-theme` without either ever running on a single one of them. The build
|
|
# step matters most of all here: jest and tsc both pass on a named import that does not exist,
|
|
# and only webpack rejects it. The suite did run on the branch afterwards, which is the wrong
|
|
# side of the merge to find out.
|
|
on:
|
|
push:
|
|
branches: [master, feature/*]
|
|
pull_request:
|
|
|
|
jobs:
|
|
jest-tests:
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: app
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.19'
|
|
cache: 'npm'
|
|
cache-dependency-path: app/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run Jest tests
|
|
run: CI=true npm test -- --watchAll=false --coverage --coverageReporters=text --coverageReporters=lcov
|
|
|
|
# Webpack build catches errors that Jest+Babel don't, e.g. named imports
|
|
# that resolve to `undefined` because the source module doesn't actually
|
|
# export that name (Babel turns these into runtime undefined; webpack
|
|
# rejects them at build time). GitHub Actions sets CI=true in every
|
|
# step's environment by default, which makes react-scripts treat any
|
|
# lint warning as a fatal error — so we override it here. The webpack
|
|
# build still fails on real errors (the goal of this step); only
|
|
# pre-existing lint warnings stop being blocking.
|
|
- name: Build app (catches missing imports etc.)
|
|
env:
|
|
CI: ''
|
|
run: npm run build
|
|
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: app/coverage
|
|
retention-days: 30
|