Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Commit f59fb97

Browse files
ci: add code coverage integration
1 parent 001f2f7 commit f59fb97

File tree

4 files changed

+53
-47
lines changed

4 files changed

+53
-47
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = tests/*

.github/workflows/CI.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,25 @@ jobs:
108108
path: |
109109
${{ github.workspace }}/artifacts
110110
111+
- name: Test with pytest
112+
id: test
113+
shell: bash
114+
run: |
115+
python -m pytest \
116+
-rxXs \
117+
--tb=native \
118+
--verbose \
119+
--cov-config=.coveragerc \
120+
--cov=pyra \
121+
--cov=. \
122+
tests
123+
124+
- name: Upload coverage artifact
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: coverage-${{ matrix.os }}-${{ matrix.architecture }}
128+
path: .coverage
129+
111130
- name: Create/Update GitHub Release
112131
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
113132
uses: LizardByte/create-release-action@v2023.1210.832
@@ -121,3 +140,34 @@ jobs:
121140
prerelease: true # ${{ needs.setup_release.outputs.publish_pre_release }}
122141
tag: ${{ needs.setup_release.outputs.release_tag }}
123142
token: ${{ secrets.GH_BOT_TOKEN }}
143+
144+
coverage:
145+
name: Process test coverage (${{ matrix.os }}-${{ matrix.architecture }})
146+
runs-on: ${{ matrix.os }}
147+
needs: build
148+
if: always() # code coverage tracks coverage on all branches
149+
strategy:
150+
fail-fast: false
151+
matrix:
152+
os: [windows-2019, ubuntu-20.04, macos-11]
153+
architecture: [x64]
154+
include: # additional runs
155+
- os: windows-2019
156+
architecture: x86
157+
steps:
158+
- name: Download coverage artifacts
159+
uses: actions/download-artifact@v4
160+
with:
161+
name: coverage-${{ matrix.os }}-${{ matrix.architecture }}
162+
163+
- name: Debug artifact files
164+
shell: bash
165+
run: |
166+
ls -la
167+
ls -la ./coverage-${{ matrix.os }}-${{ matrix.architecture }}
168+
169+
- name: Upload coverage to Codecov
170+
uses: codecov/codecov-action@v3
171+
with:
172+
fail_ci_if_error: true
173+
flags: ${{ runner.os }}-${{ matrix.architecture }}

.github/workflows/python-tests.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
flake8==6.1.0
33
pyinstaller==6.3.0
44
pytest==7.4.3
5+
pytest-cov==4.1.0
56
rstcheck[sphinx]==6.2.0

0 commit comments

Comments
 (0)