11name : Smoke Tests
22
3+ env :
4+ FORCE_COLOR : ' 1'
5+
36on :
47 workflow_call :
58 inputs :
2427 smoke-tests :
2528 runs-on : ubuntu-latest
2629 timeout-minutes : 60
30+ strategy :
31+ fail-fast : false
32+ matrix :
33+ shard : [1, 2, 3, 4]
34+ outputs :
35+ artifact-id-1 : ${{ steps.upload-1.outputs.artifact-id }}
36+ artifact-id-2 : ${{ steps.upload-2.outputs.artifact-id }}
37+ artifact-id-3 : ${{ steps.upload-3.outputs.artifact-id }}
38+ artifact-id-4 : ${{ steps.upload-4.outputs.artifact-id }}
2739 steps :
2840 - name : Checkout
2941 uses : runloopai/checkout@main
6173 - name : Verify generated example artifacts
6274 run : yarn check:examples-md
6375
64- - name : Run smoke tests
76+ - name : Run smoke tests (Shard ${{ matrix.shard }}/4)
6577 id : tests
66- run : yarn test:smoke
78+ run : yarn test:smoke --shard=${{ matrix.shard }}/4 --color | tee test-output.log
79+
80+ - name : Compress test output
81+ if : always()
82+ run : zstd -5 test-output.log
83+
84+ - name : Upload test output
85+ id : upload-${{ matrix.shard }}
86+ if : always()
87+ uses : runloopai/upload-artifact@main
88+ with :
89+ name : smoke-tests-shard-${{ matrix.shard }}
90+ path : test-output.log.zst
91+ retention-days : 1
92+ archive : false
6793
6894 - name : Comment results on PR
6995 if : failure() && github.event_name == 'pull_request'
@@ -90,9 +116,81 @@ jobs:
90116 uses : runloopai/github-script@main
91117 with :
92118 script : |
93- const comment = `## ✅ Smoke Tests Passed
119+ const comment = `## ✅ Smoke Tests Passed (Shard ${{ matrix.shard }}/4)
120+
121+ Shard ${{ matrix.shard }} smoke tests passed successfully!`;
122+
123+ github.rest.issues.createComment({
124+ issue_number: context.issue.number,
125+ owner: context.repo.owner,
126+ repo: context.repo.repo,
127+ body: comment
128+ });
129+
130+ smoke-tests-results :
131+ runs-on : ubuntu-slim
132+ needs : smoke-tests
133+ if : always()
134+ steps :
135+ - name : Download all test output artifacts
136+ if : needs.smoke-tests.result == 'failure'
137+ uses : runloopai/download-artifact@main
138+ with :
139+ artifact-ids : ${{ needs.smoke-tests.outputs.artifact-id-1 }},${{ needs.smoke-tests.outputs.artifact-id-2 }},${{ needs.smoke-tests.outputs.artifact-id-3 }},${{ needs.smoke-tests.outputs.artifact-id-4 }}
140+ path : all-output
141+
142+ - name : Decompress and display logs
143+ if : needs.smoke-tests.result == 'failure'
144+ run : |
145+ # Decompress all files
146+ zstd --rm -d all-output/*/test-output.log.zst
147+
148+ # Display failed shard outputs directly
149+ for output_dir in all-output/smoke-tests-shard-*/; do
150+ if [ -d "$output_dir" ]; then
151+ shard_num=$(basename "$output_dir" | sed 's/smoke-tests-shard-//')
152+ output_file="${output_dir}test-output.log"
153+ if [ -f "$output_file" ]; then
154+ if grep -q "FAIL\|Error:\|✕" "$output_file" 2>/dev/null; then
155+ echo "::error::Shard $shard_num had test failures"
156+ cat "$output_file"
157+ fi
158+ fi
159+ fi
160+ done
161+
162+ # Aggregate all output in a collapsed group
163+ echo "::group::Output from all shards"
164+ for output_dir in all-output/smoke-tests-shard-*/; do
165+ if [ -d "$output_dir" ]; then
166+ shard_num=$(basename "$output_dir" | sed 's/smoke-tests-shard-//')
167+ output_file="${output_dir}test-output.log"
168+ if [ -f "$output_file" ]; then
169+ echo "=== Shard $shard_num ==="
170+ cat "$output_file"
171+ echo ""
172+ fi
173+ fi
174+ done
175+ echo "::endgroup::"
176+
177+ exit 1
178+
179+ - name : Comment combined results on PR
180+ if : github.event_name == 'pull_request'
181+ uses : runloopai/github-script@main
182+ with :
183+ script : |
184+ const result = '${{ needs.smoke-tests.result }}';
185+ const icon = result === 'success' ? '✅' : '❌';
186+ const status = result === 'success' ? 'passed' : 'failed';
187+
188+ let comment = `## ${icon} Smoke Tests ${status.charAt(0).toUpperCase() + status.slice(1)}\n\n`;
189+ comment += `All shards have completed. Overall result: **${status}**\n\n`;
94190
95- All smoke tests passed successfully!`;
191+ if (result !== 'success') {
192+ comment += `[📋 View combined error logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
193+ }
96194
97195 github.rest.issues.createComment({
98196 issue_number: context.issue.number,
0 commit comments