Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
required: false
type: string
default: ""
upload-coverage-artifact:
description: Whether to upload the Cobertura coverage.xml as an artifact for a downstream code-coverage upload job
required: false
type: boolean
default: true

jobs:
build-wheel:
Expand Down Expand Up @@ -52,6 +57,19 @@ jobs:
if-no-files-found: warn
retention-days: 14

# Cobertura XML for the actions/upload-code-coverage step in the calling workflow.
# Skipped for fork PRs, which can't be granted `code-quality: write` anyway.
- name: Upload coverage.xml artifact
if: |
always() && inputs.upload-coverage-artifact &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: actions/upload-artifact@v4
with:
name: python-coverage-cobertura
path: regi-headless/build/reports/coverage/coverage.xml
if-no-files-found: warn
retention-days: 14

- name: Collect wheel
run: |
mkdir -p dist
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ jobs:
name: Build and test
uses: ./.github/workflows/build-wheel.yml

upload-coverage:
name: Upload code coverage
needs: build-wheel
if: ${{ !cancelled() && needs.build-wheel.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
permissions:
contents: read
code-quality: write
pull-requests: read

steps:
- name: Download coverage.xml artifact
uses: actions/download-artifact@v4
with:
name: python-coverage-cobertura

- name: Upload code coverage
uses: actions/upload-code-coverage@v1
with:
file: coverage.xml
language: Python
label: code-coverage/pytest-cov
fail-on-error: false

dependency-submission:
name: Submit Gradle dependencies
needs: build-wheel
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
uses: ./.github/workflows/build-wheel.yml
with:
ref: ${{ github.event.release.tag_name }}
upload-coverage-artifact: false

publish-wheel:
name: Publish Python wheel to GitHub Release
Expand Down
Loading