Upload flaky test reports to artifacts (#16076)
This commit is contained in:
parent
1d758fac2b
commit
f1990b6389
2 changed files with 19 additions and 31 deletions
48
.github/actions/upload-flaky-tests/action.yml
vendored
48
.github/actions/upload-flaky-tests/action.yml
vendored
|
@ -1,5 +1,5 @@
|
|||
name: Report flaky test
|
||||
description: Finds flaky tests and creates issues
|
||||
description: Finds flaky tests and uploads reports
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
@ -10,34 +10,24 @@ runs:
|
|||
shell: bash
|
||||
# language=bash
|
||||
run: |
|
||||
REPO="${{ github.repository }}"
|
||||
ISSUES_LINK="https://github.com/${{ github.repository }}/issues/"
|
||||
PR="${{ github.event.pull_request.number }}"
|
||||
RUN="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
FLAKES=""
|
||||
SEP=""
|
||||
for dir in $(find -type d -name surefire-reports); do
|
||||
for i in $(ls $dir/*.txt); do
|
||||
if ( grep '<<< FAILURE!' $i &>/dev/null ); then
|
||||
TEST="$(echo $i | sed 's/.txt//g' | sed 's/.*\.//g')"
|
||||
LOG="$(cat $i)"
|
||||
|
||||
TITLE="Flaky test: $TEST"
|
||||
BODY="$RUN"$'\n''```'$'\n'"$LOG"$'\n''```'
|
||||
ISSUE="$(gh issue list --search "$TITLE in:title" --json number --jq .[].number)"
|
||||
|
||||
if [ "$PR" == "" ]; then
|
||||
if [ "$ISSUE" == "" ]; then
|
||||
LINK="$(gh issue create -t "$TITLE" -b "$BODY" -l "kind/bug,area/ci,flaky-test" | grep $ISSUES_LINK)"
|
||||
ISSUE="$(echo $LINK | sed "s|$ISSUES_LINK||")"
|
||||
else
|
||||
LINK="$(gh issue comment "$ISSUE" -b "$BODY")"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "## $TITLE" >> $GITHUB_STEP_SUMMARY
|
||||
echo "$LINK" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
echo "$LOG" >> $GITHUB_STEP_SUMMARY
|
||||
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
for i in $(grep -l '<flakyFailure' $dir/TEST-*.xml); do
|
||||
FLAKES="$FLAKES$SEP$i"
|
||||
SEP=$'\n'
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$FLAKES" != "" ]; then
|
||||
echo "flakes<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$FLAKES" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ steps.flaky-tests.outputs.flakes }}
|
||||
with:
|
||||
name: flaky-tests-${{ github.job }}
|
||||
path: ${{ steps.flaky-tests.outputs.flakes }}
|
||||
if-no-files-found: error
|
||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -98,8 +98,6 @@ jobs:
|
|||
|
||||
- uses: ./.github/actions/upload-flaky-tests
|
||||
name: Upload flaky tests
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
quarkus-integration-tests:
|
||||
name: Quarkus IT
|
||||
|
|
Loading…
Reference in a new issue