-
Notifications
You must be signed in to change notification settings - Fork 3
2095 lines (1996 loc) · 95.6 KB
/
Copy pathvalidate.yml
File metadata and controls
2095 lines (1996 loc) · 95.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Validate
on:
pull_request:
branches: [main, develop]
push:
branches: [main]
merge_group:
branches: [main, develop]
workflow_dispatch:
inputs:
summary-verbose:
description: 'Emit verbose fixture summary (sets SUMMARY_VERBOSE=true)'
required: false
default: 'false'
sample_id:
description: 'Sampling correlation id (prevents cancels)'
required: false
type: string
history_scenario_set:
description: 'VI history scenario set for Validate VI history lanes (none|smoke|history-core)'
required: false
default: 'smoke'
allow_noncanonical_vi_history:
description: 'Allow vi-history-scenarios to run on non-canonical repos (manual override)'
required: false
type: boolean
default: false
allow_noncanonical_history_core:
description: 'Allow history-core scenario set on non-canonical repos (requires allow_noncanonical_vi_history=true)'
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.pull_request.number) || github.event.inputs.sample_id || github.ref }}
cancel-in-progress: true
env:
# Controlled opt-in for the June 2026 JavaScript action runtime migration.
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
jobs:
smoke-gate:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.determine.outputs.skip }}
steps:
- name: Determine skip for smoke branches
id: determine
shell: pwsh
env:
EVENT_NAME: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
run: |
$isSmoke = $false
if ($env:EVENT_NAME -eq 'pull_request' -and $env:HEAD_REF -and $env:HEAD_REF.StartsWith('smoke/')) {
$isSmoke = $true
}
$value = if ($isSmoke) { 'true' } else { 'false' }
"skip=$value" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
lint:
needs: smoke-gate
if: needs.smoke-gate.outputs.skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- name: Install actionlint (retry)
shell: bash
run: |
set -euo pipefail
mkdir -p ./bin
ver="${ACTIONLINT_VERSION:-1.7.8}"
for i in 1 2 3; do
if curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash | bash -s -- "$ver" ./bin; then
break
else
echo "retry $i"; sleep 2
fi
done
- name: Run actionlint
run: |
./bin/actionlint -color
- name: Check PR mergeability
if: ${{ github.event_name == 'pull_request' }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./tools/Check-PRMergeable.ps1 -Number ${{ github.event.pull_request.number }} -FailOnConflict
- name: Setup Python for workflow enclave
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Workflow drift check
shell: pwsh
run: |
pwsh -NoLogo -NoProfile -File tools/Check-WorkflowDrift.ps1 -FailOnDrift
- name: Setup Node with cache
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: CLI lints
uses: ./.github/actions/cli-lints
with:
enforce: ${{ github.ref_name == 'main' || github.base_ref == 'main' }}
linkcheck: 'true'
actionlint-version: '1.7.8'
relaxed-path: 'docs/releases/**/*.md'
- name: Guard tracked build artifacts (enforced)
shell: pwsh
run: |
# Optional allowlist via env ALLOWLIST_TRACKED_ARTIFACTS (semicolon-separated globs)
# and/or file-based allowlist at .ci/build-artifacts-allow.txt
pwsh -File tools/Check-TrackedBuildArtifacts.ps1 -AllowListPath '.ci/build-artifacts-allow.txt'
- name: Surface build artifacts allowlist (if any)
shell: pwsh
run: |
$path = '.ci/build-artifacts-allow.txt'
if (Test-Path -LiteralPath $path -PathType Leaf) {
$lines = Get-Content -LiteralPath $path | Where-Object { $_ -and -not ($_.Trim().StartsWith('#')) } | ForEach-Object { $_.Trim() }
if ($lines.Count -gt 0 -and $env:GITHUB_STEP_SUMMARY) {
$out = @('### Build Artifacts Allowlist','')
foreach($l in $lines){ $out += ('- ' + $l) }
$out -join "`n" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
}
- name: Build artifacts guard — ad-hoc allowlist usage
shell: pwsh
run: |
if ($env:GITHUB_STEP_SUMMARY) {
$msg = @(
'### Build Artifacts Guard — Ad-hoc Allowlist',
'',
'- To permit specific tracked paths temporarily, set ALLOWLIST_TRACKED_ARTIFACTS to a semicolon-separated list of globs.',
"- Example: ``ALLOWLIST_TRACKED_ARTIFACTS='src/Legacy/**/bin/**;src/Legacy/**/obj/**'``",
'- Prefer using .ci/build-artifacts-allow.txt for committed, reviewable exceptions.'
) -join "`n"
$msg | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- name: Derive environment snapshot
shell: bash
run: |
set -euo pipefail
node tools/npm/run-script.mjs --silent derive:env > derived-env.json
mkdir -p tests/results/_agent
cp derived-env.json tests/results/_agent/derived-env.json
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
{
echo '### Derived Environment';
echo '```json';
cat derived-env.json;
echo '```';
} >> "$GITHUB_STEP_SUMMARY"
fi
- name: PrePush local gates (includes watcher schema validation)
shell: pwsh
env:
PREPUSH_SKIP_LEGACY_FIXTURE_CHECKS: '1'
run: |
pwsh -File tools/PrePush-Checks.ps1
- name: Release conductor contract tests
shell: bash
run: |
node tools/npm/run-script.mjs priority:release:conductor:test
- name: Policy guard (branch protection)
if: ${{ github.event.repository.fork == false }}
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
run: |
pwsh -NoLogo -NoProfile -File tools/priority/Sync-BranchProtectionPolicy.ps1 -ResultsDir tests/results/_agent/policy
- name: Upload policy drift artifact
if: ${{ always() && github.event.repository.fork == false }}
uses: actions/upload-artifact@v7
with:
name: policy-drift-validate-${{ github.run_id }}-${{ github.run_attempt }}
path: tests/results/_agent/policy/policy-drift-report.json
if-no-files-found: error
- name: Lint unanchored dot-sourcing (non-blocking)
shell: pwsh
continue-on-error: true
run: |
pwsh -File tools/Lint-DotSourcing.ps1 -WarnOnly
- name: Lint inline-if in format (-f)
shell: pwsh
run: pwsh -File tools/Lint-InlineIfInFormat.ps1
- name: Emit tool versions
if: always()
shell: bash
run: |
{
echo '### Tool Versions'
echo "- actionlint: $(./bin/actionlint -version || echo 'n/a')"
echo "- node: $(node -v || echo 'n/a')"
echo "- npm: $(npm -v || echo 'n/a')"
echo "- markdownlint: $(markdownlint --version || echo 'n/a')"
} >> "$GITHUB_STEP_SUMMARY"
- name: Lint loop determinism (notice only on non-main)
if: github.ref_name != 'main'
shell: pwsh
run: |
$paths = Get-ChildItem -Path .github/workflows -Filter *.yml | ForEach-Object { $_.FullName }
if ($paths) { pwsh -File tools/Lint-LoopDeterminism.Shim.ps1 -PathsList ($paths -join ';') } else { Write-Host '::notice::No workflow files to lint.' }
- name: Lint loop determinism (enforced on main)
if: github.ref_name == 'main'
shell: pwsh
run: |
$paths = Get-ChildItem -Path .github/workflows -Filter *.yml | ForEach-Object { $_.FullName }
if ($paths) { pwsh -File tools/Lint-LoopDeterminism.Shim.ps1 -PathsList ($paths -join ';') -FailOnViolation } else { Write-Host '::notice::No workflow files to lint.' }
- name: Local markdown link check (intra-repo)
shell: pwsh
run: |
# Simple intra-repo link checker: scans markdown for (./...) links and verifies files exist.
$ErrorActionPreference = 'Stop'
$mdFiles = Get-ChildItem -Path . -Recurse -Include *.md -File |
Where-Object {
$path = $_.FullName -replace '\\','/'
return $path -notmatch '/node_modules/' `
-and $path -notmatch '/vendor/' `
-and $path -notmatch '/tmp/'
}
$errors = @()
foreach ($file in $mdFiles) {
$text = Get-Content -LiteralPath $file.FullName -Raw
$matches = [regex]::Matches($text, '\]\((\.\/?[^)#\s]+)\)')
foreach ($m in $matches) {
$rel = $m.Groups[1].Value
if ($rel -like 'http*' -or $rel -like '#*') { continue }
# Strip anchors like file.md#section
$pathOnly = $rel.Split('#')[0]
$target = Join-Path $file.DirectoryName $pathOnly
if (-not (Test-Path -LiteralPath $target)) {
$errors += "[$($file.FullName)] broken link -> $rel (resolved: $target)"
}
}
}
if ($errors.Count -gt 0) {
Write-Host 'Broken intra-repo links detected:'
$errors | ForEach-Object { Write-Host " - $_" }
exit 2
} else {
Write-Host 'Intra-repo markdown links OK.'
}
- name: Append docs pointers
if: always()
shell: pwsh
run: |
if ($env:GITHUB_STEP_SUMMARY) {
$lines = @('### Docs Pointers','')
$lines += '- Fixture Drift: ./docs/FIXTURE_DRIFT.md'
$lines -join "`n" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- name: Labels sync summary (develop only)
if: github.ref_name == 'develop'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$ErrorActionPreference = 'Continue'
$labelsFile = '.github/labels.yml'
if (-not (Test-Path -LiteralPath $labelsFile)) { Write-Host '::notice::.github/labels.yml not found'; exit 0 }
try {
$yaml = Get-Content -LiteralPath $labelsFile -Raw
# crude parse: entries like '- name: xyz' on their own line
$names = @([regex]::Matches($yaml,'(?m)^\s*-\s*name:\s*(.+?)\s*$') | ForEach-Object { $_.Groups[1].Value.Trim() })
} catch { $names = @() }
$api = "https://api.github.com/repos/${{ github.repository }}/labels?per_page=100"
$hdr = @{ Authorization = "token $env:GITHUB_TOKEN"; Accept='application/vnd.github+json'; 'X-GitHub-Api-Version'='2022-11-28' }
$existing = @()
try { $resp = Invoke-RestMethod -Method Get -Uri $api -Headers $hdr; $existing = @($resp | ForEach-Object { $_.name }) } catch {}
$missing = @($names | Where-Object { $_ -and ($existing -notcontains $_) })
if ($env:GITHUB_STEP_SUMMARY) {
$lines = @('### Labels Sync (notice)','')
$lines += ('- Defined in labels.yml: {0}' -f ($names.Count))
$lines += ('- Repo labels: {0}' -f ($existing.Count))
if ($missing.Count -gt 0) {
$lines += '- Missing:'
foreach ($m in $missing) { $lines += (' - ' + $m) }
} else {
$lines += '- Missing: none'
}
$lines -join "`n" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- name: Labels sync enforcement (main)
if: github.ref_name == 'main'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$ErrorActionPreference = 'Stop'
$labelsFile = '.github/labels.yml'
if (-not (Test-Path -LiteralPath $labelsFile)) { Write-Error '.github/labels.yml not found'; exit 2 }
$yaml = Get-Content -LiteralPath $labelsFile -Raw
$names = @([regex]::Matches($yaml,'(?m)^\s*-\s*name:\s*(.+?)\s*$') | ForEach-Object { $_.Groups[1].Value.Trim() })
$api = "https://api.github.com/repos/${{ github.repository }}/labels?per_page=100"
$hdr = @{ Authorization = "token $env:GITHUB_TOKEN"; Accept='application/vnd.github+json'; 'X-GitHub-Api-Version'='2022-11-28' }
$resp = Invoke-RestMethod -Method Get -Uri $api -Headers $hdr
$existing = @($resp | ForEach-Object { $_.name })
$missing = @($names | Where-Object { $_ -and ($existing -notcontains $_) })
if ($missing.Count -gt 0) {
Write-Host 'Missing labels:'
$missing | ForEach-Object { Write-Host (' - ' + $_) }
Write-Error ('Labels sync check failed on main: {0} missing' -f $missing.Count)
exit 2
} else {
Write-Host 'Labels OK on main.'
}
- name: Markdown lint determinism regression (Pester)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if (-not (Get-Module -ListAvailable -Name Pester)) {
Install-Module -Name Pester -Scope CurrentUser -Force -SkipPublisherCheck
}
Invoke-Pester -Path 'tests/Lint-Markdown.Tests.ps1' -CI
- name: Markdown lint determinism regression (Node)
shell: bash
run: node --test tools/__tests__/lint-markdown.test.mjs
- name: Line ending drift guard
shell: pwsh
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
pwsh -NoLogo -NoProfile -File tools/Assert-LineEndingDeterminism.ps1 `
-GitHubOutputPath $env:GITHUB_OUTPUT `
-StepSummaryPath $env:GITHUB_STEP_SUMMARY
- name: Append markdown determinism summary
if: always()
shell: pwsh
run: |
if ($env:GITHUB_STEP_SUMMARY) {
$lines = @(
'### Markdown Lint Determinism Regression',
'',
'- `Invoke-Pester -Path tests/Lint-Markdown.Tests.ps1 -CI`',
'- `node --test tools/__tests__/lint-markdown.test.mjs`',
'- `tools/Assert-LineEndingDeterminism.ps1`'
)
$lines -join "`n" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- name: Run markdownlint
run: |
node tools/npm/run-script.mjs lint:md:changed
env:
ACTIONLINT_VERSION: '${{ vars.ACTIONLINT_VERSION || ''1.7.8'' }}'
validate-scope-plan:
needs: smoke-gate
if: needs.smoke-gate.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
scope_mode: ${{ steps.plan.outputs.scope_mode }}
scope_category: ${{ steps.plan.outputs.scope_category }}
run_fixtures: ${{ steps.plan.outputs.run_fixtures }}
fixtures_reason: ${{ steps.plan.outputs.fixtures_reason }}
run_bundle_certification: ${{ steps.plan.outputs.run_bundle_certification }}
bundle_certification_reason: ${{ steps.plan.outputs.bundle_certification_reason }}
run_vi_history: ${{ steps.plan.outputs.run_vi_history }}
vi_history_reason: ${{ steps.plan.outputs.vi_history_reason }}
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- name: Resolve Validate scope plan
id: plan
shell: pwsh
env:
VALIDATE_EVENT_NAME: ${{ github.event_name }}
VALIDATE_REPOSITORY: ${{ github.repository }}
VALIDATE_PR_NUMBER: ${{ github.event.pull_request.number || '' }}
VALIDATE_BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before || '' }}
VALIDATE_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
VALIDATE_BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref || '' }}
VALIDATE_HEAD_REF: ${{ github.head_ref || '' }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
run: |
$resultsRoot = 'tests/results/_agent/validate-scope-plan'
New-Item -ItemType Directory -Path $resultsRoot -Force | Out-Null
$planPath = Join-Path $resultsRoot 'validate-scope-plan.json'
pwsh -NoLogo -NoProfile -File tools/Resolve-ValidateScopePlan.ps1 `
-EventName $env:VALIDATE_EVENT_NAME `
-Repository $env:VALIDATE_REPOSITORY `
-PullRequestNumber $env:VALIDATE_PR_NUMBER `
-BaseSha $env:VALIDATE_BASE_SHA `
-HeadSha $env:VALIDATE_HEAD_SHA `
-BaseRef $env:VALIDATE_BASE_REF `
-HeadRef $env:VALIDATE_HEAD_REF `
-GitHubOutputPath $env:GITHUB_OUTPUT `
-StepSummaryPath $env:GITHUB_STEP_SUMMARY `
-JsonPath $planPath
- name: Upload Validate scope plan artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: validate-scope-plan
path: tests/results/_agent/validate-scope-plan/validate-scope-plan.json
if-no-files-found: error
fixtures:
needs: [smoke-gate, lint, validate-scope-plan]
if: needs.smoke-gate.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: read
env:
FAIL_ON_NEW_STRUCTURAL: 'true'
SUMMARY_VERBOSE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.summary-verbose || 'false' }}
VALIDATE_SCOPE_RUN_FIXTURES: ${{ needs.validate-scope-plan.outputs.run_fixtures }}
VALIDATE_SCOPE_FIXTURES_REASON: ${{ needs.validate-scope-plan.outputs.fixtures_reason }}
VALIDATE_SCOPE_CATEGORY: ${{ needs.validate-scope-plan.outputs.scope_category }}
steps:
- name: Append fixture lane plan
shell: pwsh
run: |
if ($env:GITHUB_STEP_SUMMARY) {
$lines = @(
'### Fixtures',
'',
('- scope_category: `{0}`' -f $env:VALIDATE_SCOPE_CATEGORY),
('- run_fixtures: `{0}`' -f $env:VALIDATE_SCOPE_RUN_FIXTURES),
('- fixtures_reason: `{0}`' -f $env:VALIDATE_SCOPE_FIXTURES_REASON)
)
$lines -join "`n" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
}
- if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- name: Run fixture validator (JSON)
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
pwsh -File tools/Validate-Fixtures.ps1 -Json -MinBytes 32 > fixture-validation.json
$exit = $LASTEXITCODE
if ($exit -ne 0) {
Write-Error "Fixture validator failed with exit code: $exit"
exit $exit
}
$data = Get-Content fixture-validation.json -Raw | ConvertFrom-Json
if (-not $data.ok) {
Write-Error 'Fixture validation reported non-ok status.'
exit 1
}
- name: Restore previous fixture validation snapshot (cache)
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
id: restore_prev_fixture_validation
uses: actions/cache/restore@v6
with:
path: fixture-validation-prev.json
key: fixture-validation-${{ github.sha }}
restore-keys: |
fixture-validation-
- name: Compute delta vs previous snapshot
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true' && steps.restore_prev_fixture_validation.outputs.cache-hit == 'true'
shell: pwsh
run: |
Write-Host 'Previous snapshot restored. Computing delta.'
pwsh -File tools/Diff-FixtureValidationJson.ps1 -Baseline fixture-validation-prev.json -Current fixture-validation.json -FailOnNewStructuralIssue > fixture-validation-delta.json
if ($LASTEXITCODE -eq 3) {
Write-Host 'New structural fixture issues detected (delta willFail=true).'
if ($env:FAIL_ON_NEW_STRUCTURAL -eq 'true') {
Write-Error 'Failing job due to FAIL_ON_NEW_STRUCTURAL=true'
exit 3
} else {
Write-Host 'FAIL_ON_NEW_STRUCTURAL=false -> continuing without failing.'
}
}
- name: Validate delta JSON schema (basic)
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true' && steps.restore_prev_fixture_validation.outputs.cache-hit == 'true' && hashFiles('fixture-validation-delta.json') != ''
shell: pwsh
run: |
pwsh -File tools/Test-FixtureValidationDeltaSchema.ps1 -DeltaJsonPath fixture-validation-delta.json
- name: Lite schema validate (delta)
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true' && steps.restore_prev_fixture_validation.outputs.cache-hit == 'true' && hashFiles('fixture-validation-delta.json') != ''
shell: pwsh
run: |
pwsh -File tools/Invoke-JsonSchemaLite.ps1 -JsonPath fixture-validation-delta.json -SchemaPath docs/schemas/fixture-validation-delta-v1.schema.json
- name: Upload fixture validation delta JSON
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true' && steps.restore_prev_fixture_validation.outputs.cache-hit == 'true' && hashFiles('fixture-validation-delta.json') != ''
uses: actions/upload-artifact@v7
with:
name: validate-fixture-validation-delta-json
path: fixture-validation-delta.json
- name: Upload fixture validation JSON
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
uses: actions/upload-artifact@v7
with:
name: validate-fixture-validation-json
path: fixture-validation.json
- name: Lite schema validate (snapshot)
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
shell: pwsh
run: |
if (-not (Test-Path fixture-validation.json)) {
Write-Error 'fixture-validation.json was not produced.'
exit 1
}
pwsh -File tools/Invoke-JsonSchemaLite.ps1 -JsonPath fixture-validation.json -SchemaPath docs/schemas/fixture-manifest-v1.schema.json
- name: Append fixture summary
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
shell: pwsh
run: pwsh -File tools/Write-FixtureValidationSummary.ps1 -ValidationJson fixture-validation.json -DeltaJson fixture-validation-delta.json
- name: Write fixture summary file
if: always() && env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
shell: pwsh
run: pwsh -File tools/Write-FixtureValidationSummary.ps1 -ValidationJson fixture-validation.json -DeltaJson fixture-validation-delta.json -SummaryPath fixture-summary.md
- name: Upload fixture summary artifact
if: always() && env.VALIDATE_SCOPE_RUN_FIXTURES == 'true' && hashFiles('fixture-summary.md') != ''
uses: actions/upload-artifact@v7
with:
name: fixture-validation-summary
path: fixture-summary.md
- name: Save current snapshot to cache
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
uses: actions/cache/save@v6
with:
path: fixture-validation.json
key: fixture-validation-${{ github.sha }}
- name: Copy snapshot for next run reference
if: env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
shell: pwsh
run: Copy-Item -LiteralPath fixture-validation.json -Destination fixture-validation-prev.json -Force
- name: Agent wait summary (notice-only)
if: always() && env.VALIDATE_SCOPE_RUN_FIXTURES == 'true'
uses: ./.github/actions/agent-wait-post
with:
results-dir: tests/results
fail-on-outside: 'false'
upload-artifact: 'false'
hook-parity:
needs: lint
runs-on: ubuntu-latest
env:
PREPUSH_SKIP_LEGACY_FIXTURE_CHECKS: '1'
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies (no scripts)
run: npm ci --ignore-scripts
- name: Clean hook results directory
shell: bash
run: |
rm -rf tests/results/_hooks
mkdir -p tests/results/_hooks
- name: Prepare staged fixture
shell: bash
run: |
rm -rf tmp/hooks
mkdir -p tmp/hooks
cat <<'PS' > tmp/hooks/sample.ps1
function Invoke-HookSample {
param()
Write-Output 'hook parity sample'
}
Invoke-HookSample
PS
git add -f tmp/hooks/sample.ps1
- name: Prime actionlint binary
shell: pwsh
run: ./tools/PrePush-Checks.ps1 -SkipLegacyFixtureChecks
- name: Hooks plane info
run: node tools/npm/run-script.mjs hooks:plane
- name: Hooks preflight
run: node tools/npm/run-script.mjs hooks:preflight
- name: Run multi-plane hook diff
run: node tools/npm/run-script.mjs hooks:multi
- name: Validate hook summary schema
run: node tools/npm/run-script.mjs hooks:schema
- name: Upload hook parity summaries
if: always()
uses: actions/upload-artifact@v7
with:
name: hook-parity-ubuntu-latest
path: tests/results/_hooks/*.json
- name: Reset staged files
if: always()
shell: bash
run: |
git reset --hard
rm -rf tmp/hooks
semver:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies (no scripts)
run: npm ci --ignore-scripts
- name: SemVer check
run: node tools/npm/run-script.mjs semver:check
release-branch:
if: startsWith(github.head_ref, 'release/')
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies (no scripts)
run: npm ci --ignore-scripts
- name: Verify release branch
env:
GITHUB_HEAD_REF: ${{ github.head_ref }}
RELEASE_VALIDATE_BASE: origin/develop
run: node tools/priority/verify-release-branch.mjs
feature-handoff:
if: startsWith(github.head_ref, 'feature/')
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies (no scripts)
run: npm ci --ignore-scripts
- name: Run priority handoff tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRIORITY_HANDOFF_SKIP_POLICY: '1'
run: node tools/npm/run-script.mjs priority:handoff-tests
issue-snapshot:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- uses: actions/setup-node@v6
with:
node-version: '20'
- name: Sync standing-priority snapshot
env:
AGENT_PRIORITY_UPSTREAM_REPOSITORY: LabVIEW-Community-CI-CD/compare-vi-cli-action
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
run: |
if [ -z "${GH_TOKEN:-${GITHUB_TOKEN:-}}" ]; then
echo "::error::GH_TOKEN/GITHUB_TOKEN is required for priority:sync:lane"
exit 1
fi
node tools/npm/run-script.mjs priority:sync:lane
- name: Validate snapshot schema (best-effort)
continue-on-error: true
run: |
node tools/npm/run-script.mjs priority:schema
- name: Upload issue snapshot artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: standing-priority-snapshot
path: |
tests/results/_agent/issue/*.json
tests/results/_agent/issue/*.digest
session-index:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Wire Probe (J1)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J1
results-dir: tests/results
- name: Wire Probe (J2)
if: '${{ vars.WIRE_PROBES != ''0'' }}'
uses: ./.github/actions/wire-probe
with:
phase: J2
results-dir: tests/results
- name: Resolve Pester version
id: resolve_pester
shell: pwsh
run: |
$version = if ($env:PESTER_VERSION -and $env:PESTER_VERSION.Trim()) { $env:PESTER_VERSION } else { (./tools/Get-PesterVersion.ps1) }
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
- name: Install Pester ${{ steps.resolve_pester.outputs.version }}
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$pesterVersion = '${{ steps.resolve_pester.outputs.version }}'
$installed = $false
$galleryUri = 'https://www.powershellgallery.com/api/v2/'
$installLegacy = {
Install-Module -Name Pester -RequiredVersion $pesterVersion -Force -Scope CurrentUser
}
try {
&$installLegacy
$installed = $true
} catch {
Write-Host ("::notice::Install-Module first attempt failed: {0}" -f $_.Exception.Message)
try {
Register-PSRepository -Default -ErrorAction Stop
} catch {
Write-Host ("::warning::Register-PSRepository -Default failed: {0}" -f $_.Exception.Message)
}
try {
&$installLegacy
$installed = $true
} catch {
Write-Host ("::notice::Install-Module retry failed: {0}" -f $_.Exception.Message)
Write-Host "::notice::Falling back to PSResourceGet for Pester installation."
try {
Register-PSResourceRepository -Name PSGallery -Uri $galleryUri -Trusted -ErrorAction SilentlyContinue
} catch {
Write-Host ("::warning::Register-PSResourceRepository fallback failed: {0}" -f $_.Exception.Message)
}
$attempts = 0
$maxAttempts = 5
while (-not $installed -and $attempts -lt $maxAttempts) {
try {
Install-PSResource -Name Pester -Version $pesterVersion -Scope CurrentUser -TrustRepository -Repository PSGallery
$installed = $true
} catch {
$attempts++
if ($attempts -ge $maxAttempts) {
Write-Host ("::warning::Install-PSResource exhausted attempts ({0}): {1}" -f $attempts, $_.Exception.Message)
break
}
Write-Host ("::notice::Install-PSResource attempt {0} failed: {1}" -f $attempts, $_.Exception.Message)
$delay = [math]::Min(30, [math]::Pow(2, $attempts))
Start-Sleep -Seconds $delay
}
}
if (-not $installed) {
Write-Host "::notice::Attempting manual PSGallery download fallback for Pester."
$downloadRoot = Join-Path $env:RUNNER_TEMP 'pester-download'
New-Item -ItemType Directory -Path $downloadRoot -Force | Out-Null
$packagePath = Join-Path $downloadRoot ("Pester.{0}.nupkg" -f $pesterVersion)
$downloadEndpoints = @(
@{ Uri = ('{0}/package/Pester/{1}' -f $galleryUri.TrimEnd('/'), $pesterVersion); SkipCert = $false },
@{ Uri = ('https://psg-prod-eastus.azureedge.net/packages/pester.{0}.nupkg' -f $pesterVersion.ToLowerInvariant()); SkipCert = $true }
)
$downloaded = $false
foreach ($endpoint in $downloadEndpoints) {
if ($downloaded) { break }
for ($i = 1; $i -le 3 -and -not $downloaded; $i++) {
try {
$commonArgs = @{
Uri = $endpoint.Uri
OutFile = $packagePath
UseBasicParsing = $true
ErrorAction = 'Stop'
}
if ($endpoint.SkipCert) {
Invoke-WebRequest @commonArgs -SkipCertificateCheck
} else {
Invoke-WebRequest @commonArgs
}
$downloaded = $true
} catch {
if ($i -ge 3) {
Write-Host ("::warning::Manual download attempt {0} ({1}) failed: {2}" -f $i, $endpoint.Uri, $_.Exception.Message)
} else {
Write-Host ("::notice::Manual download attempt {0} ({1}) failed: {2}" -f $i, $endpoint.Uri, $_.Exception.Message)
Start-Sleep -Seconds ([math]::Min(30, [math]::Pow(2, $i)))
}
}
}
}
if ($downloaded -and (Test-Path -LiteralPath $packagePath)) {
$modulePaths = $env:PSModulePath -split [System.IO.Path]::PathSeparator
$destRoot = $modulePaths | Where-Object { $_ -and $_.Trim() } | Where-Object { $_ -like '*Modules*' } | Select-Object -First 1
if (-not $destRoot) {
$destRoot = Join-Path ([Environment]::GetFolderPath('UserProfile')) '.local/share/powershell/Modules'
}
$destPath = Join-Path $destRoot ('Pester/{0}' -f $pesterVersion)
New-Item -ItemType Directory -Force -Path $destPath | Out-Null
Expand-Archive -Path $packagePath -DestinationPath $destPath -Force
$installed = $true
} else {
Write-Host "::warning::Manual PSGallery download fallback failed."
}
}
}
}
if (-not $installed) {
throw 'Failed to install Pester from PSGallery.'
}
$repo = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
if ($repo -and $repo.InstallationPolicy -ne 'Trusted') {
try {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
} catch {
Write-Host ("::notice::Unable to set PSGallery installation policy to Trusted: {0}" -f $_.Exception.Message)
}
}
- name: Run dispatcher smoke to produce session index
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$res = Join-Path $env:RUNNER_TEMP 'sessionindex'
New-Item -ItemType Directory -Force -Path $res | Out-Null
./tools/Quick-DispatcherSmoke.ps1 -ResultsPath $res -PreferWorkspace
$contexts = @(
'Validate / lint'
'Validate / fixtures'
'Validate / session-index'
)
$bpScript = Join-Path (Get-Location) 'tools/Update-SessionIndexBranchProtection.ps1'
$bpApiScript = Join-Path (Get-Location) 'tools/Get-BranchProtectionRequiredChecks.ps1'
$branchName = '${{ github.base_ref || github.ref_name }}'
$repoParts = '${{ github.repository }}'.Split('/')
$bpResult = & $bpApiScript -Owner $repoParts[0] -Repository $repoParts[1] -Branch $branchName -Token $env:GITHUB_TOKEN
$updateArgs = @{
ResultsDir = $res
PolicyPath = 'tools/policy/branch-required-checks.json'
Branch = $branchName
ProducedContexts = $contexts
}
if ($bpResult.status) { $updateArgs['ActualStatus'] = $bpResult.status }
if ($bpResult.contexts) { $updateArgs['ActualContexts'] = @($bpResult.contexts) }
if ($bpResult.notes) { $updateArgs['AdditionalNotes'] = @($bpResult.notes) }
& $bpScript @updateArgs
- name: Attach origin/upstream parity telemetry
shell: pwsh
run: |
$res = Join-Path $env:RUNNER_TEMP 'sessionindex'
$parityPath = Join-Path $res 'origin-upstream-parity.json'