Skip to content

Commit

Permalink
Publish test results on Github (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi authored Jan 14, 2025
1 parent 1275138 commit ebab9b9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ on:
workflow_dispatch:

jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

build-test:
# Python version < 3.7 requires ubuntu-20.04
# Python version < 3.7 requires ubuntu-20.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.x"]
steps:
Expand All @@ -34,11 +45,17 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test
run: |
pytest
pytest --junit-xml=test-results-xml.xml
- name: Test with lxml
run: |
pip install lxml
pytest
pytest --junit-xml=test-results-py${{ matrix.python-version }}-lxml.xml
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (Python ${{ matrix.python-version }})
path: test-results-py*-*.xml

coverage-lint:
needs: build-test
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test Results

on:
workflow_run:
workflows: ["build"]
types:
- completed
permissions: {}

jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
checks: write
pull-requests: write
actions: read

steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"

0 comments on commit ebab9b9

Please sign in to comment.