diff --git a/.github/workflows/pytest_ci.yml b/.github/workflows/pytest_ci.yml index 7e34bd7..505332f 100644 --- a/.github/workflows/pytest_ci.yml +++ b/.github/workflows/pytest_ci.yml @@ -1,8 +1,9 @@ name: Run pkg tests (pytest) on: - - push - - pull_request + pull_request: + branches: + - main jobs: build: @@ -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() }} \ No newline at end of file + 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 "
Click to expand!" >> "$FINAL_REPORT" + tail -n+2 "${{ steps.pytest.outputs.report-path }}" >> "$FINAL_REPORT" + echo "
" >> "$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 "=====================================================================================" \ No newline at end of file diff --git a/README.md b/README.md index 2f70d57..a08ec08 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# python-pytest-action +# Test repository for pytest GitHub action