@@ -131,7 +131,7 @@ jobs:
131131 --spec-type preflight
132132
133133 - name : Upload test artifacts
134- if : always()
134+ if : ${{ !cancelled() }}
135135 uses : actions/upload-artifact@v5
136136 with :
137137 name : test-results-v1beta3-${{ github.run_id }}-${{ github.run_attempt }}
@@ -143,7 +143,7 @@ jobs:
143143 retention-days : 30
144144
145145 - name : Set job outcome
146- if : always()
146+ if : ${{ !cancelled() }}
147147 run : |
148148 if [ "${{ steps.compare.outcome }}" == "failure" ] && [ "${{ steps.compare.outputs.baseline_missing }}" != "true" ]; then
149149 echo "comparison_failed=true" >> $GITHUB_OUTPUT
@@ -234,7 +234,7 @@ jobs:
234234 --spec-type preflight
235235
236236 - name : Upload test artifacts
237- if : always()
237+ if : ${{ !cancelled() }}
238238 uses : actions/upload-artifact@v5
239239 with :
240240 name : test-results-v1beta2-${{ github.run_id }}-${{ github.run_attempt }}
@@ -246,7 +246,7 @@ jobs:
246246 retention-days : 30
247247
248248 - name : Set job outcome
249- if : always()
249+ if : ${{ !cancelled() }}
250250 run : |
251251 if [ "${{ steps.compare.outcome }}" == "failure" ] && [ "${{ steps.compare.outputs.baseline_missing }}" != "true" ]; then
252252 echo "comparison_failed=true" >> $GITHUB_OUTPUT
@@ -334,7 +334,7 @@ jobs:
334334 --spec-type supportbundle
335335
336336 - name : Upload test artifacts
337- if : always()
337+ if : ${{ !cancelled() }}
338338 uses : actions/upload-artifact@v5
339339 with :
340340 name : test-results-supportbundle-${{ github.run_id }}-${{ github.run_attempt }}
@@ -345,7 +345,7 @@ jobs:
345345 retention-days : 30
346346
347347 - name : Set job outcome
348- if : always()
348+ if : ${{ !cancelled() }}
349349 run : |
350350 if [ "${{ steps.compare.outcome }}" == "failure" ] && [ "${{ steps.compare.outputs.baseline_missing }}" != "true" ]; then
351351 echo "comparison_failed=true" >> $GITHUB_OUTPUT
@@ -355,7 +355,7 @@ jobs:
355355 # Report results (runs after all tests complete)
356356 report-results :
357357 needs : [test-preflight-v1beta3, test-preflight-v1beta2, test-supportbundle]
358- if : always () && github.actor != 'dependabot[bot]'
358+ if : ${{ !cancelled () && github.actor != 'dependabot[bot]' }}
359359 runs-on : ubuntu-22.04
360360 timeout-minutes : 5
361361
@@ -380,35 +380,69 @@ jobs:
380380 - name : Reorganize artifacts
381381 run : |
382382 # Move artifacts from nested directories to test/output
383- find test/output/test-results-* -type f -exec mv {} test/output/ \;
383+ # Use shopt to handle glob patterns that don't match
384+ shopt -s nullglob
385+ for dir in test/output/test-results-*; do
386+ if [ -d "$dir" ]; then
387+ find "$dir" -type f -exec mv {} test/output/ \;
388+ fi
389+ done
384390 # Clean up empty directories
385- find test/output/test-results-* -type d -empty -delete || true
391+ for dir in test/output/test-results-*; do
392+ if [ -d "$dir" ]; then
393+ find "$dir" -type d -empty -delete || true
394+ fi
395+ done
396+ shopt -u nullglob
386397
387398 - name : Generate summary report
388399 run : |
389- python3 scripts/generate_summary.py \
390- --reports test/output/diff-report-*.json \
391- --output-file $GITHUB_STEP_SUMMARY \
392- --output-console
400+ # Handle case where no reports exist
401+ shopt -s nullglob
402+ REPORTS=(test/output/diff-report-*.json)
403+ shopt -u nullglob
404+
405+ if [ ${#REPORTS[@]} -eq 0 ]; then
406+ echo "⚠ No comparison reports found - test jobs may have failed before generating reports"
407+ echo "## Summary Report" >> $GITHUB_STEP_SUMMARY
408+ echo "No comparison reports available. Check individual test job results." >> $GITHUB_STEP_SUMMARY
409+ else
410+ python3 scripts/generate_summary.py \
411+ --reports test/output/diff-report-*.json \
412+ --output-file $GITHUB_STEP_SUMMARY \
413+ --output-console
414+ fi
393415
394416 - name : Check for regressions
395417 run : |
396418 echo "Checking comparison results..."
397419
398420 FAILURES=0
399421
400- if [ "${{ needs.test-preflight-v1beta3.result }}" == "failure" ]; then
401- echo "❌ v1beta3 comparison failed"
422+ if [ "${{ needs.test-preflight-v1beta3.result }}" == "failure" ] || [ "${{ needs.test-preflight-v1beta3.result }}" == "skipped" ]; then
423+ if [ "${{ needs.test-preflight-v1beta3.result }}" == "skipped" ]; then
424+ echo "❌ v1beta3 test was skipped (likely due to build failure)"
425+ else
426+ echo "❌ v1beta3 comparison failed"
427+ fi
402428 FAILURES=$((FAILURES + 1))
403429 fi
404430
405- if [ "${{ needs.test-preflight-v1beta2.result }}" == "failure" ]; then
406- echo "❌ v1beta2 comparison failed"
431+ if [ "${{ needs.test-preflight-v1beta2.result }}" == "failure" ] || [ "${{ needs.test-preflight-v1beta2.result }}" == "skipped" ]; then
432+ if [ "${{ needs.test-preflight-v1beta2.result }}" == "skipped" ]; then
433+ echo "❌ v1beta2 test was skipped (likely due to build failure)"
434+ else
435+ echo "❌ v1beta2 comparison failed"
436+ fi
407437 FAILURES=$((FAILURES + 1))
408438 fi
409439
410- if [ "${{ needs.test-supportbundle.result }}" == "failure" ]; then
411- echo "❌ Support bundle comparison failed"
440+ if [ "${{ needs.test-supportbundle.result }}" == "failure" ] || [ "${{ needs.test-supportbundle.result }}" == "skipped" ]; then
441+ if [ "${{ needs.test-supportbundle.result }}" == "skipped" ]; then
442+ echo "❌ Support bundle test was skipped (likely due to build failure)"
443+ else
444+ echo "❌ Support bundle comparison failed"
445+ fi
412446 FAILURES=$((FAILURES + 1))
413447 fi
414448
@@ -422,7 +456,7 @@ jobs:
422456 fi
423457
424458 - name : Update baselines
425- if : github.event.inputs.update_baselines == 'true' && github.event_name == 'workflow_dispatch'
459+ if : ${{ !cancelled() && github.event.inputs.update_baselines == 'true' && github.event_name == 'workflow_dispatch' }}
426460 run : |
427461 echo "Updating baselines with current bundles..."
428462
0 commit comments