From 1e63883d7878c636744a1eeea575eedb03fb782f Mon Sep 17 00:00:00 2001 From: Tim Adler Date: Mon, 23 Sep 2024 22:22:56 +0200 Subject: [PATCH] feat (github): Report test results in PRs (#9) * Report test results in PRs * Fix artifact download * Debug missing artifacts * Look for artifacts in correct path --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++-- Makefile | 2 +- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 090c4c3..7808231 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,13 @@ name: Python package on: push: - branches: [ "main" ] + branches: + - "main" + - "develop" pull_request: - branches: [ "main" ] + branches: + - "main" + - "develop" jobs: test: @@ -37,3 +41,37 @@ jobs: gist-id: ${{ vars.GIST_ID_BADGES }} token: ${{ secrets.GIST_TOKEN }} prefix: ${{ github.event.repository.name }}_${{ matrix.python-version }} + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Test Results (Python ${{ matrix.python-version }}) + path: report.xml + + report: + name: Comment test results + runs-on: ubuntu-latest + needs: test + permissions: + checks: write + + # only needed unless run with comment_mode: off + pull-requests: write + + # only needed for private repository + contents: read + + # only needed for private repository + issues: read + + if: always() + + steps: + - name: Download Test Results + uses: actions/download-artifact@v4 + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: "**/*.xml" diff --git a/Makefile b/Makefile index 64c312d..d89ba11 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ setup: test: pytest --cov=web_watchr --cov-report term-missing -.PHONY: setup-ci +.PHONY: run-ci run-ci: pip install --upgrade pip pip install uv