Pull request #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run pkg tests (pytest) | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install pytest pytest-md | |
- name: Test with pytest | |
id: pytest | |
run: | | |
REPORT=pytest_${{ matrix.python-version }}.md | |
pytest --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 (via pytest)" > "$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 "=====================================================================================" |