Skip to content

Fix run-tutorial.yml in edge case #1351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/run-tutorial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,22 @@ jobs:
- name: Check test results
if: always()
run: |
if [ "${{ steps.run-tutorials.outputs.total }}" -eq 0 ]; then
echo "::notice::No tutorials were tested in this group."
elif [ "${{ steps.run-tutorials.outputs.failed }}" -gt 0 ]; then
echo "::warning::${{ steps.run-tutorials.outputs.failed }} out of ${{ steps.run-tutorials.outputs.total }} tutorials failed. Read in Test tutorials and click `Running tutorials...` to see the error messages."
# Read the outputs from the test step
total="${{ steps.run-tutorials.outputs.total }}"
failed="${{ steps.run-tutorials.outputs.failed }}"

# Default to 0 if empty to avoid bash errors
total=${total:-0}
failed=${failed:-0}

if [ "$total" -eq 0 ]; then
echo "No tutorials were tested in this group."
elif [ "$failed" -gt 0 ]; then
echo "Warning: $failed out of $total tutorials failed."
echo "Check the test results in the uploaded artifacts to see detailed error messages."
else
echo "::notice::All ${{ steps.run-tutorials.outputs.total }} tutorials passed."
echo "Success: All $total tutorials passed."
fi

# This ensures the job reports failure if any tutorials failed,
# but without stopping other jobs in the matrix
[ "${{ steps.run-tutorials.outputs.failed }}" -eq 0 ]
# Return exit code based on failures
exit $failed
Loading