Skip to content

Show integration test results on the Action Summary #13072

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 6 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
body: |
> :white_check_mark: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
${{env.PYTHON_UNITTEST_COVERAGE_REPORT}}
> ${{env.PYTHON_SHORT_TEST_SUMMARY_INFO}}
> ${{env.TEST_SUMMARY_INFO}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed because we are using it for both languages now

- name: Add Failure Comment
if: github.event.inputs.comment-id && failure()
uses: peter-evans/create-or-update-comment@v1
Expand All @@ -168,7 +168,7 @@ jobs:
body: |
> :x: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
> :bug: ${{env.GRADLE_SCAN_LINK}}
> ${{env.PYTHON_SHORT_TEST_SUMMARY_INFO}}
> ${{env.TEST_SUMMARY_INFO}}
# In case of self-hosted EC2 errors, remove this block.
stop-test-runner:
name: Stop Build EC2 Runner
Expand Down
100 changes: 86 additions & 14 deletions tools/bin/ci_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,93 @@ else
fi
}

show_skipped_failed_info() {
skipped_failed_info=`sed -n '/^=* short test summary info =*/,/^=* [0-9]/p' build.out`
if ! test -z "$skipped_failed_info"
then
echo "PYTHON_SHORT_TEST_SUMMARY_INFO<<EOF" >> $GITHUB_ENV
echo "Python short test summary info:" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "$skipped_failed_info" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "PYTHON_SHORT_TEST_SUMMARY_INFO=No skipped/failed tests"
show_python_run_details() {
run_info=`sed -n "/=* $1 =*/,/========/p" build.out`
if ! test -z "$run_info"
then
echo '```' >> $GITHUB_STEP_SUMMARY
echo "$run_info" | sed '$d' >> $GITHUB_STEP_SUMMARY # $d removes last line
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
fi
}

show_java_run_details() {
# show few lines after stack trace
run_info=`awk '/] FAILED/{x=NR+8}(NR<=x){print}' build.out`
if ! test -z "$run_info"
then
echo '```' >> $GITHUB_STEP_SUMMARY
echo "$run_info" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
fi
}

write_results_summary() {
echo "write_results_summary"
success="$1"
python_info=`sed -n '/=* short test summary info =*/,/========/p' build.out`
java_info=`sed -n '/tests completed,/p' build.out`

echo "success: $success"
echo "python_info: $python_info"
echo "java_info: $java_info"

info='Could not find result details'
result='Unknown result'

if [ "$success" = true ]
then
result="Build Passed"
info='All Passed'
echo '### Build Passed' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
else
result="Build Failed"
echo '### Build Failed' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
fi

if ! test -z "$java_info"
then
info="$java_info"

echo '```' >> $GITHUB_STEP_SUMMARY
echo "$java_info" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
fi
if ! test -z "$python_info"
then
info="$python_info"

echo '```' >> $GITHUB_STEP_SUMMARY
echo "$python_info" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
fi

echo "TEST_SUMMARY_INFO<<EOF" >> $GITHUB_ENV
echo "$result" >> $GITHUB_ENV
echo '' >> $GITHUB_ENV
echo "Test summary info:" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "$info" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
}

write_logs() {
write_results_summary $1
show_python_run_details 'FAILURES'
show_python_run_details 'ERRORS'
show_java_run_details
}

echo "# $connector" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

# Copy command output to extract gradle scan link.
run | tee build.out
# return status of "run" command, not "tee"
Expand All @@ -70,11 +142,11 @@ test $run_status == "0" || {
# Save gradle scan link to github GRADLE_SCAN_LINK variable for next job.
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
echo "GRADLE_SCAN_LINK=$link" >> $GITHUB_ENV
show_skipped_failed_info
write_logs false
exit $run_status
}

show_skipped_failed_info
write_logs true

# Build successed
coverage_report=`sed -n '/.*Name.*Stmts.*Miss.*Cover/,/TOTAL /p' build.out`
Expand Down