-
Notifications
You must be signed in to change notification settings - Fork 215
Update Index of Reports #7068
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
Update Index of Reports #7068
Changes from all commits
f958a5a
699f0f1
c35250a
6262f96
4d6b489
3af1f6a
0d9197a
e32ec7c
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -117,6 +117,7 @@ jobs: | |||||||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||||||||
| with: | ||||||||||||||||||||
| go-version: 1.23.6 | ||||||||||||||||||||
| cache: false | ||||||||||||||||||||
| id: go | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Checkout mx-chain-go | ||||||||||||||||||||
|
|
@@ -142,7 +143,17 @@ jobs: | |||||||||||||||||||
| TS=$(date +'%Y_%^B_%d__%H_%M_%S'); | ||||||||||||||||||||
| echo "TS=$TS" >> "$GITHUB_ENV" | ||||||||||||||||||||
| echo "TIMESTAMP=$TS" >> "$GITHUB_ENV" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Fix any interrupted dpkg operations first | ||||||||||||||||||||
| sudo dpkg --configure -a || true | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Clean up any partial packages | ||||||||||||||||||||
| sudo apt-get clean | ||||||||||||||||||||
| sudo apt-get autoclean | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Update package lists and install rclone | ||||||||||||||||||||
| sudo apt-get update -y && sudo apt-get install -y rclone | ||||||||||||||||||||
|
|
||||||||||||||||||||
| mkdir -p ~/.config/rclone | ||||||||||||||||||||
| cat > ~/.config/rclone/rclone.conf <<EOF | ||||||||||||||||||||
| [r2] | ||||||||||||||||||||
|
|
@@ -276,17 +287,55 @@ jobs: | |||||||||||||||||||
| run: | | ||||||||||||||||||||
| set +e | ||||||||||||||||||||
| pytest mx-chain-testing-suite/scenarios/ --html=report.html --self-contained-html --continue-on-collection-errors | ||||||||||||||||||||
| PYTEST_EXIT_CODE=$? | ||||||||||||||||||||
| INITIAL_PYTEST_EXIT_CODE=$? | ||||||||||||||||||||
| set -e | ||||||||||||||||||||
| echo "PYTEST_EXIT_CODE=$PYTEST_EXIT_CODE" >> $GITHUB_ENV | ||||||||||||||||||||
| echo "Pytest exit code: $PYTEST_EXIT_CODE" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| echo "Initial pytest exit code: $INITIAL_PYTEST_EXIT_CODE" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Parse the HTML report to determine actual test status | ||||||||||||||||||||
| FINAL_PYTEST_EXIT_CODE=$INITIAL_PYTEST_EXIT_CODE | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if [ -f "report.html" ]; then | ||||||||||||||||||||
| echo "Report generated successfully." | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Extract test summary from HTML report using multiple parsing approaches | ||||||||||||||||||||
| FAILED_TESTS=$(grep -E '[0-9]+ Failed|Failed.*[0-9]+' report.html | head -1 | grep -o '[0-9]\+' | head -1 || echo "0") | ||||||||||||||||||||
| ERROR_TESTS=$(grep -E '[0-9]+ Errors|Errors.*[0-9]+' report.html | head -1 | grep -o '[0-9]\+' | head -1 || echo "0") | ||||||||||||||||||||
| RERUN_TESTS=$(grep -E '[0-9]+ Reruns|Reruns.*[0-9]+' report.html | head -1 | grep -o '[0-9]\+' | head -1 || echo "0") | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Fallback: check for "0 Failed" pattern directly | ||||||||||||||||||||
| if grep -q "0 Failed" report.html && [ "$INITIAL_PYTEST_EXIT_CODE" -ne 0 ]; then | ||||||||||||||||||||
| echo "Detected '0 Failed' pattern in report despite non-zero exit code - likely successful reruns" | ||||||||||||||||||||
| FAILED_TESTS=0 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| echo "Failed tests: $FAILED_TESTS" | ||||||||||||||||||||
| echo "Error tests: $ERROR_TESTS" | ||||||||||||||||||||
| echo "Rerun tests: $RERUN_TESTS" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Determine final status based on actual test results | ||||||||||||||||||||
| if [ "$FAILED_TESTS" -eq 0 ] && [ "$ERROR_TESTS" -eq 0 ]; then | ||||||||||||||||||||
| if [ "$RERUN_TESTS" -gt 0 ]; then | ||||||||||||||||||||
| echo "✅ All tests passed after $RERUN_TESTS reruns - considering as SUCCESS" | ||||||||||||||||||||
| else | ||||||||||||||||||||
| echo "✅ All tests passed on first attempt" | ||||||||||||||||||||
| fi | ||||||||||||||||||||
| FINAL_PYTEST_EXIT_CODE=0 | ||||||||||||||||||||
| else | ||||||||||||||||||||
| echo "❌ Tests have genuine failures: $FAILED_TESTS failed, $ERROR_TESTS errors" | ||||||||||||||||||||
| FINAL_PYTEST_EXIT_CODE=1 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Move report to reports directory | ||||||||||||||||||||
| mkdir -p ./reports | ||||||||||||||||||||
| mv report.html ./reports/ | ||||||||||||||||||||
| else | ||||||||||||||||||||
| echo "Report not found." | ||||||||||||||||||||
| echo "❌ Report not found - using original exit code" | ||||||||||||||||||||
| FINAL_PYTEST_EXIT_CODE=$INITIAL_PYTEST_EXIT_CODE | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| echo "PYTEST_EXIT_CODE=$FINAL_PYTEST_EXIT_CODE" >> $GITHUB_ENV | ||||||||||||||||||||
| echo "Final pytest exit code: $FINAL_PYTEST_EXIT_CODE" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Stage report for R2 | ||||||||||||||||||||
| run: | | ||||||||||||||||||||
|
|
@@ -362,8 +411,11 @@ jobs: | |||||||||||||||||||
| done | ||||||||||||||||||||
| echo "</ul></body></html>" >> index.html | ||||||||||||||||||||
| git add index.html | ||||||||||||||||||||
| git commit -m "Update Index of Reports" | ||||||||||||||||||||
| git push origin gh-pages --force | ||||||||||||||||||||
| if git commit -m "Update Index of Reports"; then | ||||||||||||||||||||
| git push origin gh-pages --force | ||||||||||||||||||||
| else | ||||||||||||||||||||
| echo "No changes to commit. Nothing to push." | ||||||||||||||||||||
|
Comment on lines
+414
to
+417
|
||||||||||||||||||||
| if git commit -m "Update Index of Reports"; then | |
| git push origin gh-pages --force | |
| else | |
| echo "No changes to commit. Nothing to push." | |
| if git diff-index --quiet HEAD; then | |
| echo "No changes to commit. Nothing to push." | |
| else | |
| git commit -m "Update Index of Reports" | |
| git push origin gh-pages --force |
Copilot
AI
Jun 23, 2025
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.
[nitpick] The cleanup block is quite extensive; consider refactoring these steps into a separate script to improve readability and reusability.
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.
Consider explicitly checking if there are changes to commit (for example, using 'git diff --quiet') before running 'git commit' to ensure that the conditional block only handles the 'no changes' case and not other commit failures.