Skip to content

Commit 25b7124

Browse files
committed
Enhance CI workflow to output test reports on failure and specify report file for tox
Signed-off-by: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
1 parent d94185a commit 25b7124

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,28 @@ jobs:
137137
- name: Run tests
138138
env:
139139
PYTEST_DISCORD_WEBHOOK: ${{ secrets.PYTEST_DISCORD_WEBHOOK }}
140-
run: tox -e cov
140+
REPORT_OUTPUT: md_report.md
141+
run: |
142+
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
143+
tox -e py -- --md-report-output "${REPORT_OUTPUT}"
141144
142145
- run: ls -alR
143146
if : ${{ matrix.os != 'windows-latest' }}
144147

148+
- name: Output reports to the job summary when tests fail
149+
if: failure()
150+
shell: bash
151+
run: |
152+
if [ -f "$REPORT_FILE" ]; then
153+
echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
156+
echo "" >> $GITHUB_STEP_SUMMARY
157+
echo "</details>" >> $GITHUB_STEP_SUMMARY
158+
else
159+
echo "No failed tests to report"
160+
fi
161+
145162
- name: Install coveralls
146163
run: python -m pip install --upgrade --disable-pip-version-check coveralls tomli
147164

0 commit comments

Comments
 (0)