mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:05:19 +00:00
- ci-pr.yml: split the serial checks job into parallel lint/format/ typecheck/knip/cycles + unit/int (vitest --changed vs PR base via scripts/test-affected.mjs, full fallback on high-risk paths) + e2e (manifest path->spec via scripts/e2e-affected.mjs, blocking) + build; migration-lock gains checkout + pull-requests:read (fixes the failures that blocked PR #50) - ci.yml (main): full safety net — seed:minimal + int full + build + e2e - package.json: gate:fast / gate:push; .husky/pre-push runs gate:push - docs: "Dono do PR, dono do CI" policy in AGENT-OPS + work-issue + engineering-standards; changelog entry; plans for OPS3-OPS7
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* e2e-affected (OPS5) — decides the Playwright scope for a PR diff via the
|
|
* curated manifest and prints JSON on stdout:
|
|
* { mode, specs, reason, unmapped, base }.
|
|
*
|
|
* mode=full → run the whole e2e suite
|
|
* mode=selected → run tests/e2e/<name>.e2e.spec.ts for each name in `specs`
|
|
* mode=none → skip e2e for this diff
|
|
*
|
|
* `unmapped` src/ files go to stderr as a warning — never a failure (e2e is a
|
|
* thin layer over int; a human judges whether the manifest needs the prefix).
|
|
*/
|
|
import { execFileSync } from 'node:child_process'
|
|
|
|
import { E2E_AFFECTED_MANIFEST } from './lib/e2e-affected-manifest.mjs'
|
|
import { selectE2eSpecs } from './lib/test-affected-core.mjs'
|
|
|
|
const base = `origin/${process.env.GITHUB_BASE_REF ?? 'stage'}`
|
|
|
|
let mergeBase
|
|
try {
|
|
mergeBase = execFileSync('git', ['merge-base', 'HEAD', base], { encoding: 'utf8' }).trim()
|
|
} catch {
|
|
const result = {
|
|
mode: 'full',
|
|
specs: [],
|
|
reason: `no merge-base with ${base} (shallow clone?)`,
|
|
unmapped: [],
|
|
base,
|
|
}
|
|
console.log(JSON.stringify(result))
|
|
process.exit(0)
|
|
}
|
|
|
|
const raw = execFileSync('git', ['diff', '--name-status', `${mergeBase}...HEAD`], {
|
|
encoding: 'utf8',
|
|
})
|
|
const files = raw
|
|
.split('\n')
|
|
.filter(Boolean)
|
|
.map((line) => {
|
|
const [status, path] = line.split('\t')
|
|
return { status, path }
|
|
})
|
|
|
|
const result = { ...selectE2eSpecs(files, E2E_AFFECTED_MANIFEST), base }
|
|
if (result.unmapped.length > 0) {
|
|
console.error(
|
|
`[e2e-affected] src/ paths with no manifest mapping:\n ${result.unmapped.join('\n ')}`,
|
|
)
|
|
}
|
|
console.log(JSON.stringify(result))
|