Skip to content

Commit b69447b

Browse files
committed
test: add a result job to ci
1 parent 9b6eeb2 commit b69447b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
strategy:
20+
fail-fast: false
2021
matrix:
2122
node-version: [20.x, 22.x, 24.x]
2223
mongodb-version: ['6.0', '7.0', '8.0']
@@ -91,3 +92,38 @@ jobs:
9192
wait-on: 'http://localhost:3000'
9293
wait-on-timeout: 120
9394
command: npm run cypress:run
95+
96+
# Execute a final job to collect the results and report a single check status
97+
results:
98+
if: ${{ always() }}
99+
runs-on: ubuntu-latest
100+
name: build result
101+
needs: [build]
102+
steps:
103+
- name: Check build results
104+
run: |
105+
result="${{ needs.build.result }}"
106+
if [[ $result == "success" || $result == "skipped" ]]; then
107+
echo "### ✅ All builds passed" >> $GITHUB_STEP_SUMMARY
108+
exit 0
109+
else
110+
echo "### ❌ Some builds failed" >> $GITHUB_STEP_SUMMARY
111+
exit 1
112+
fi
113+
114+
- name: Parse failed matrix jobs
115+
if: needs.build.result == 'failure'
116+
run: |
117+
echo "## Failed Matrix Combinations" >> $GITHUB_STEP_SUMMARY
118+
echo "" >> $GITHUB_STEP_SUMMARY
119+
echo "| Node Version | MongoDB Version | Status |" >> $GITHUB_STEP_SUMMARY
120+
echo "|--------------|-----------------|--------|" >> $GITHUB_STEP_SUMMARY
121+
122+
# Parse the matrix results from the build job
123+
results='${{ toJSON(needs.build.outputs) }}'
124+
125+
# Since we can't directly get individual matrix job statuses,
126+
# we'll note that the build job failed
127+
echo "| Multiple | Multiple | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
128+
echo "" >> $GITHUB_STEP_SUMMARY
129+
echo "⚠️ Check the [build job logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details on which specific matrix combinations failed." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)