Skip to content

Commit

Permalink
Capture more dumps on failure.
Browse files Browse the repository at this point in the history
Capture *.hprof, hs_err_pid*, replay_pid*, and core.NNNN on failure.
  • Loading branch information
gianm committed Oct 25, 2024
1 parent 7e8671c commit c6efd1e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/reusable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,23 @@ jobs:
MAVEN_PROJECTS: ${{ inputs.maven_projects }}
run: ./.github/scripts/unit_tests_script.sh

- name: Check for .hprof files on failure
- name: Check for dumps on failure
if: ${{ failure() }}
id: check_for_heap_dump
id: check_for_debug_files
run: |
if ls ${GITHUB_WORKSPACE}/target/*.hprof 1> /dev/null 2>&1; then
echo "found_hprof=true" >> "$GITHUB_ENV"
if test -n "$(find "${GITHUB_WORKSPACE}" \( -name '*.hprof' -or -name 'hs_err_pid*' -or 'replay_pid*' -or -regex '.*/core\.[0-9]*' \))"
then
echo "found_debug_files=true" >> "$GITHUB_ENV"
else
echo "found_hprof=false" >> "$GITHUB_ENV"
echo "found_debug_files=false" >> "$GITHUB_ENV"
fi
- name: Collect tarball hprof dumps if they exist on failure
- name: Collect dumps if they exist on failure
if: ${{ failure() && env.found_hprof == 'true' }}
run: |
tar cvzf ${RUNNER_TEMP}/hprof-dumps.tgz ${GITHUB_WORKSPACE}/target/*.hprof
find "${GITHUB_WORKSPACE}"
\( -name '*.hprof' -or -name 'hs_err_pid*' -or 'replay_pid*' -or -regex '.*/core\.[0-9]*' \)
-exec tar -cvzf ${RUNNER_TEMP}/hprof-dumps.tgz {} \;
- name: Upload hprof dumps to GitHub if they exist on failure
if: ${{ failure() && env.found_hprof == 'true' }}
Expand Down

0 comments on commit c6efd1e

Please sign in to comment.