-
-
Notifications
You must be signed in to change notification settings - Fork 40
fix(test-runner): make junit report delivery resilient on starved CI VMs #419
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf3e3d9
fix(test-runner): make junit report delivery resilient on starved CI VMs
edusperoni 6ee563c
fix(test-runner): bound report retries by a delivery deadline
edusperoni b1138b7
ci: preserve first-attempt xcresult and upload failure diagnostics
edusperoni f6cc6e0
fix(ci): survive empty simulator lists and staging leftovers in diagn…
edusperoni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Collect test diagnostics | ||
| description: > | ||
| Gather what a failed simulator test run leaves outside the xcresult bundle: | ||
| host-side crash reports (.ips), CoreSimulator logs, and — when a device is | ||
| still booted — a targeted slice of the unified log. The xcresult itself | ||
| already carries the app's stdout/stderr and testmanagerd logs | ||
| (xcrun xcresulttool export diagnostics), so none of that is duplicated here. | ||
| inputs: | ||
| test-folder: | ||
| description: Folder the diagnostics directory is created in | ||
| required: true | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Collect crash reports and simulator logs | ||
| shell: bash | ||
| run: | | ||
| DIAG="${{ inputs.test-folder }}/diagnostics" | ||
| mkdir -p "$DIAG" | ||
| # Crashes of simulator apps land in the *host's* DiagnosticReports. | ||
| cp -R ~/Library/Logs/DiagnosticReports/. "$DIAG/DiagnosticReports/" 2>/dev/null || true | ||
| cp -R ~/Library/Logs/CoreSimulator/. "$DIAG/CoreSimulator/" 2>/dev/null || true | ||
| # Only a booted device can serve its unified log; never boot one | ||
| # post-mortem — a fresh boot may pick the wrong device and stalls the | ||
| # job for minutes on an already-degraded VM. The pipeline must not leak | ||
| # grep's exit status: this shell runs with -e -o pipefail. | ||
| UDID="$(xcrun simctl list devices booted | grep -oE '[0-9A-Fa-f-]{36}' | head -1 || true)" | ||
| if [ -n "$UDID" ]; then | ||
| echo "Collecting unified log slice from booted simulator $UDID" | ||
| # simctl blocks forever if CoreSimulatorService is wedged — the very | ||
| # state this step tends to run in — so hard-cap it. | ||
| xcrun simctl spawn "$UDID" log show --style compact --last 45m \ | ||
| --predicate 'process CONTAINS "TestRunner"' \ | ||
| > "$DIAG/simulator-unified.log" 2>/dev/null & | ||
| LOG_PID=$! | ||
| ( sleep 120 && kill -9 "$LOG_PID" ) 2>/dev/null & | ||
| KILLER_PID=$! | ||
| wait "$LOG_PID" || echo "log show failed or was killed after 120s" | ||
| kill "$KILLER_PID" 2>/dev/null || true | ||
| else | ||
| echo "No booted simulator; relying on the xcresult's captured app output." | ||
| fi | ||
| echo "Collected diagnostics:" | ||
| du -sh "$DIAG"/* 2>/dev/null || true | ||
| - name: Upload test diagnostics | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: test-diagnostics | ||
| path: ${{ inputs.test-folder }}/diagnostics | ||
| if-no-files-found: ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.