-
Notifications
You must be signed in to change notification settings - Fork 432
fix: canary_go gracefully handles missing test-result artifacts and runs on main only #23612
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
Changes from all commits
5837dd3
b0837ac
d16e3e2
33e0765
e3eb11e
09a0caa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -398,7 +398,7 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| needs: [integration] # test dependency removed - download-artifact fetches by name, not job dependency | ||
| if: always() # Run even if some tests fail to report coverage | ||
| if: always() && github.ref == 'refs/heads/main' # Only run on main branch; run even if some tests fail to report coverage | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
|
|
@@ -422,6 +422,7 @@ jobs: | |
| - name: List downloaded artifacts | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p test-results | ||
| echo "Downloaded test result artifacts:" | ||
| find test-results -type f -name "*.json" | sort | ||
| echo "" | ||
|
|
@@ -431,11 +432,22 @@ jobs: | |
| run: | | ||
| set -euo pipefail | ||
| echo "Extracting test names from JSON artifacts..." | ||
| ./scripts/extract-executed-tests.sh test-results > executed-tests.txt | ||
| echo "Found $(wc -l < executed-tests.txt) executed tests" | ||
| JSON_COUNT=$(find test-results -name "*.json" -type f 2>/dev/null | wc -l) | ||
| if [ "$JSON_COUNT" -eq 0 ]; then | ||
| echo "⚠️ No test result artifacts found. Tests may not have run or were cancelled." | ||
| touch executed-tests.txt | ||
| else | ||
| ./scripts/extract-executed-tests.sh test-results > executed-tests.txt | ||
| echo "Found $(wc -l < executed-tests.txt) executed tests" | ||
| fi | ||
|
|
||
| - name: Compare test coverage | ||
| run: | | ||
| if [ ! -s executed-tests.txt ]; then | ||
| echo "⚠️ No test execution data available. Skipping coverage comparison." | ||
| echo "This typically happens when test jobs were cancelled or did not run." | ||
| exit 0 | ||
| fi | ||
| ./scripts/compare-test-coverage.sh all-tests.txt executed-tests.txt | ||
|
|
||
| - name: Upload test coverage report | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The empty-file guard with |
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good defensive fix — ensuring
test-results/always exists prevents thefindcommand from failing when no artifacts were downloaded. This is a pattern worth documenting in the CI README for future contributors.