Skip to content
Open
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
35 changes: 25 additions & 10 deletions .github/workflows/pytest_ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Run pkg tests (pytest)

on:
- push
- pull_request
pull_request:
branches:
- main

jobs:
build:
Expand All @@ -21,12 +22,26 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install pytest
python -m pip install pytest pytest-md
- name: Test with pytest
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
if: ${{ always() }}
id: pytest
run: |
REPORT=pytest_${{ matrix.python-version }}.md
echo "report-path=$REPORT" >> $GITHUB_OUTPUT
pytest --verbose --md $REPORT
shell: bash -el {0}
- name: Add report to summary
if: always()
run: |
echo "::group::..."
FINAL_REPORT=pytest_report_${{ matrix.python-version }}.md
echo "# Test report (python ${{ matrix.python-version }})" > "$FINAL_REPORT"
echo "<details><summary>Click to expand!</summary>" >> "$FINAL_REPORT"
tail -n+2 "${{ steps.pytest.outputs.report-path }}" >> "$FINAL_REPORT"
echo "</details>" >> "$FINAL_REPORT"
cat "$FINAL_REPORT" >> "$GITHUB_STEP_SUMMARY"
echo "::endgroup::"
echo
echo "====================================================================================="
echo Markdown summaries: "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "====================================================================================="
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# python-pytest-action
# Test repository for pytest GitHub action