@@ -8,6 +8,18 @@ function readWorkflow(name: string): string {
88 return readFileSync ( join ( projectRoot , ".github" , "workflows" , name ) , "utf-8" ) ;
99}
1010
11+ function extractJobBlock ( workflow : string , jobName : string ) : string {
12+ const start = workflow . indexOf ( ` ${ jobName } :` ) ;
13+ if ( start === - 1 ) {
14+ throw new Error ( `Missing workflow job: ${ jobName } ` ) ;
15+ }
16+ const nextMatch = workflow
17+ . slice ( start + 1 )
18+ . match ( / \n [ a - z 0 - 9 ] [ a - z 0 - 9 - ] * : \n / ) ;
19+ const end = nextMatch ? start + 1 + nextMatch . index + 1 : workflow . length ;
20+ return workflow . slice ( start , end ) ;
21+ }
22+
1123describe ( "CI workflow parity" , ( ) => {
1224 it ( "keeps push CI aligned with the PR release harness checks" , ( ) => {
1325 const ci = readWorkflow ( "ci.yml" ) ;
@@ -24,13 +36,25 @@ describe("CI workflow parity", () => {
2436 }
2537 } ) ;
2638
39+ it ( "keeps push CI using the same stale-run cancellation as PR CI" , ( ) => {
40+ const ci = readWorkflow ( "ci.yml" ) ;
41+ const prCi = readWorkflow ( "pr-ci.yml" ) ;
42+
43+ expect ( prCi ) . toContain ( "concurrency:" ) ;
44+ expect ( prCi ) . toContain ( "cancel-in-progress: true" ) ;
45+ expect ( ci ) . toContain ( "concurrency:" ) ;
46+ expect ( ci ) . toContain ( "cancel-in-progress: true" ) ;
47+ } ) ;
48+
2749 it ( "keeps Windows script typecheck coverage in push and PR CI" , ( ) => {
2850 const ci = readWorkflow ( "ci.yml" ) ;
2951 const prCi = readWorkflow ( "pr-ci.yml" ) ;
52+ const ciWindowsJob = extractJobBlock ( ci , "scripts-windows" ) ;
53+ const prWindowsJob = extractJobBlock ( prCi , "scripts-windows" ) ;
3054
31- expect ( ci ) . toContain ( "runs-on: windows-latest" ) ;
32- expect ( ci ) . toContain ( "npm run typecheck:scripts" ) ;
33- expect ( prCi ) . toContain ( "runs-on: windows-latest" ) ;
34- expect ( prCi ) . toContain ( "npm run typecheck:scripts" ) ;
55+ expect ( ciWindowsJob ) . toContain ( "runs-on: windows-latest" ) ;
56+ expect ( ciWindowsJob ) . toContain ( "npm run typecheck:scripts" ) ;
57+ expect ( prWindowsJob ) . toContain ( "runs-on: windows-latest" ) ;
58+ expect ( prWindowsJob ) . toContain ( "npm run typecheck:scripts" ) ;
3559 } ) ;
3660} ) ;
0 commit comments