Skip to content

Commit 9f8309f

Browse files
luisleo526claude
andauthored
ci: retain PR smoke test output (#800)
* test(ci): pin the shipped PR smoke output collectors Exercise the real workflow and collector removal, field and position mutations. Preserve exact four-or-five-step admission and producer failure checks. * ci: retain original PR smoke test output Retain JUnit and LastTest output after both normal x86 smoke producers, including failure paths, for three days under distinct job/run/attempt names. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 6e27d0f commit 9f8309f

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

‎.github/workflows/gke-pr.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,16 @@ jobs:
339339
cmake --build build --target pineforge_pr_smoke --parallel "$(getconf _NPROCESSORS_ONLN)"
340340
ctest --test-dir build -L '^fast$' --output-on-failure --no-tests=error \
341341
--parallel "$(getconf _NPROCESSORS_ONLN)" --output-junit build/ctest-junit.xml
342+
- name: Retain PR smoke test output
343+
if: always()
344+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
345+
with:
346+
name: pr-smoke-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}
347+
path: |
348+
build/ctest-junit.xml
349+
build/Testing/Temporary/LastTest.log
350+
retention-days: 3
351+
if-no-files-found: warn
342352

343353
build-debug:
344354
needs: [admit]
@@ -373,6 +383,16 @@ jobs:
373383
cmake --build build --target pineforge_pr_smoke --parallel "$(getconf _NPROCESSORS_ONLN)"
374384
ctest --test-dir build -L '^fast$' --output-on-failure --no-tests=error \
375385
--parallel "$(getconf _NPROCESSORS_ONLN)" --output-junit build/ctest-junit.xml
386+
- name: Retain PR smoke test output
387+
if: always()
388+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
389+
with:
390+
name: pr-smoke-${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}
391+
path: |
392+
build/ctest-junit.xml
393+
build/Testing/Temporary/LastTest.log
394+
retention-days: 3
395+
if-no-files-found: warn
376396

377397
build-arm:
378398
needs: [admit]

‎scripts/test_ci_preflight.py‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13282,6 +13282,7 @@ class GkeSmokeOutputAdmission(unittest.TestCase):
1328213282
'''
1328313283
LAYOUT = 'gke-pr.yml {} must retain exactly its four smoke steps and optional pinned final output collector'
1328413284
COLLECTOR_FINDING = 'gke-pr.yml {} must retain the pinned always-upload PR smoke output collector'
13285+
SHIPPED_RETENTION = 'gke-pr.yml {} must ship the pinned final PR smoke output collector'
1328513286

1328613287
def setUp(self):
1328713288
path = ROOT / '.github/workflows/gke-pr.yml'
@@ -13306,6 +13307,24 @@ def assert_refused(self, changed, finding):
1330613307
self.assertIn(finding, gke_admit_workflow_findings(changed))
1330713308
self.assertIn(finding, main_admission_data_findings({'gke-pr.yml': changed}))
1330813309

13310+
def assert_shipped_retention(self, workflow):
13311+
"""Pin the shipped collectors while admission still accepts four steps."""
13312+
jobs = _jobs(workflow)
13313+
for job in ('build', 'build-debug'):
13314+
steps = ci_preflight._steps(jobs.get(job, ''))
13315+
finding = self.SHIPPED_RETENTION.format(job)
13316+
self.assertEqual(len(steps), 5, finding)
13317+
self.assertEqual(steps[-1].rstrip('\n'), self.COLLECTOR.rstrip('\n'), finding)
13318+
13319+
def test_shipped_workflow_retains_both_final_collectors(self):
13320+
self.assert_shipped_retention(self.shipped)
13321+
for job in ('build', 'build-debug'):
13322+
with self.subTest(missing_collector=job):
13323+
changed = in_job(self.shipped, job, self.COLLECTOR.rstrip('\n'), '')
13324+
self.assertNotEqual(changed, self.shipped)
13325+
with self.assertRaisesRegex(AssertionError, re.escape(self.SHIPPED_RETENTION.format(job))):
13326+
self.assert_shipped_retention(changed)
13327+
1330913328
def test_exact_four_or_five_steps_are_admitted_independently_in_both_jobs(self):
1331013329
self.assertEqual(gke_admit_workflow_findings(self.shipped), [])
1331113330
self.assertEqual(main_admission_data_findings({'gke-pr.yml': self.shipped}), [])
@@ -13316,7 +13335,8 @@ def test_exact_four_or_five_steps_are_admitted_independently_in_both_jobs(self):
1331613335
self.assertEqual(main_admission_data_findings({'gke-pr.yml': workflow}), [])
1331713336

1331813337
def test_each_collector_field_and_extra_execution_key_is_binding(self):
13319-
workflow = self.with_collectors()
13338+
workflow = self.shipped
13339+
self.assert_shipped_retention(workflow)
1332013340
for job in ('build', 'build-debug'):
1332113341
for before, after in (
1332213342
('Retain PR smoke test output', 'Upload logs'),
@@ -13340,10 +13360,13 @@ def test_each_collector_field_and_extra_execution_key_is_binding(self):
1334013360
collector = self.COLLECTOR.rstrip('\n')
1334113361
changed = in_job(workflow, job, collector, collector.replace(before, after, 1))
1334213362
self.assertNotEqual(changed, workflow)
13363+
with self.assertRaisesRegex(AssertionError, re.escape(self.SHIPPED_RETENTION.format(job))):
13364+
self.assert_shipped_retention(changed)
1334313365
self.assert_refused(changed, self.COLLECTOR_FINDING.format(job))
1334413366

1334513367
def test_collector_position_extra_steps_and_missing_producers_are_refused(self):
13346-
workflow = self.with_collectors()
13368+
workflow = self.shipped
13369+
self.assert_shipped_retention(workflow)
1334713370
for job in ('build', 'build-debug'):
1334813371
old_steps = ci_preflight._steps(_jobs(self.original)[job])
1334913372
for step in old_steps:
@@ -13361,7 +13384,11 @@ def test_collector_position_extra_steps_and_missing_producers_are_refused(self):
1336113384
with self.subTest(job=job, collector_position=position):
1336213385
moved = body.replace(collector, '', 1)
1336313386
moved = moved.replace(steps[position], collector + '\n' + steps[position], 1)
13364-
self.assert_refused(in_job(workflow, job, body, moved), self.LAYOUT.format(job))
13387+
changed = in_job(workflow, job, body, moved)
13388+
self.assertNotEqual(changed, workflow)
13389+
with self.assertRaisesRegex(AssertionError, re.escape(self.SHIPPED_RETENTION.format(job))):
13390+
self.assert_shipped_retention(changed)
13391+
self.assert_refused(changed, self.LAYOUT.format(job))
1336513392
for before, after in (
1336613393
(collector, collector + '\n' + collector),
1336713394
(collector, collector + '\n - run: true'),

0 commit comments

Comments
 (0)