Python Test Coverage #2170
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: Python Test Coverage | |
on: | |
pull_request_target: | |
branches: ["main", "feature*"] | |
paths: | |
- "python/**" | |
workflow_run: | |
workflows: ["Python Unit Tests"] | |
types: | |
- in_progress | |
env: | |
PYTHON_VERSION: "3.10" | |
RUN_OS: ubuntu-latest | |
jobs: | |
python-tests-coverage: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
permissions: | |
pull-requests: write | |
contents: read | |
actions: read | |
steps: | |
- name: Wait for unit tests to succeed | |
uses: lewagon/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
check-name: 'Python Unit Tests (${{ env.PYTHON_VERSION }}, ${{ env.RUN_OS }}, false)' | |
repo-token: ${{ secrets.GH_ACTIONS_PR_WRITE }} | |
wait-interval: 90 | |
allowed-conclusions: success | |
- uses: actions/checkout@v4 | |
- name: Setup filename variables | |
run: echo "FILE_ID=${{ github.event.number }}-${{ env.RUN_OS }}-${{ env.PYTHON_VERSION }}" >> $GITHUB_ENV | |
- name: Download coverage | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
name: python-coverage-${{ env.FILE_ID }}.txt | |
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }} | |
workflow: python-unit-tests.yml | |
search_artifacts: true | |
if_no_artifact_found: warn | |
- name: Download pytest | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
name: pytest-${{ env.FILE_ID }}.xml | |
github_token: ${{ secrets.GH_ACTIONS_PR_WRITE }} | |
workflow: python-unit-tests.yml | |
search_artifacts: true | |
if_no_artifact_found: warn | |
- name: Pytest coverage comment | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
github-token: ${{ secrets.GH_ACTIONS_PR_WRITE }} | |
pytest-coverage-path: python-coverage.txt | |
coverage-path-prefix: "python/" | |
title: "Python ${{ env.PYTHON_VERSION }} Test Coverage Report" | |
badge-title: "Py${{ env.PYTHON_VERSION }} Test Coverage" | |
junitxml-title: "Python ${{ env.PYTHON_VERSION }} Unit Test Overview" | |
junitxml-path: pytest.xml | |
default-branch: "main" | |
unique-id-for-comment: python-${{ env.PYTHON_VERSION }} |