Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29dde9b

Browse files
author
Steven Silvester
authored
Add Codecov integration with 95% coverage thresholds (#286)
* Add Codecov integration with 95% coverage thresholds Uploads coverage from all 10 test matrix jobs and configures Codecov to wait for all uploads before reporting, failing if project or patch coverage drops below 95%. * Pin codecov-action to SHA for v5
1 parent 574131f commit 29dde9b

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ jobs:
5656
just test-kernel
5757
just test-notebook
5858
uv run python -m octave_kernel install --user
59+
- name: Upload coverage to Codecov
60+
if: always()
61+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
62+
with:
63+
token: ${{ secrets.CODECOV_TOKEN }}
64+
files: coverage.xml
65+
flags: linux-py${{ matrix.python-version }}
66+
fail_ci_if_error: false
5967

6068
test-other-systems:
6169
strategy:
@@ -82,8 +90,16 @@ jobs:
8290
install-type: ${{ matrix.install-type }}
8391
- name: Run tests
8492
run: |
85-
just test
93+
uv run --group coverage pytest --cov=octave_kernel --cov-report=xml
8694
just test-kernel
95+
- name: Upload coverage to Codecov
96+
if: always()
97+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
98+
with:
99+
token: ${{ secrets.CODECOV_TOKEN }}
100+
files: coverage.xml
101+
flags: ${{ matrix.os }}
102+
fail_ci_if_error: false
87103

88104
test-other-ubuntu:
89105
strategy:
@@ -107,11 +123,19 @@ jobs:
107123
run: just install
108124
- name: Run tests
109125
run: |
110-
just test
126+
uv run --group coverage pytest --cov=octave_kernel --cov-report=xml
111127
just test-kernel
112128
- name: Test notebook
113129
if: ${{ matrix.install-type != 'ubuntu-flatpak' }}
114130
run: just test-notebook
131+
- name: Upload coverage to Codecov
132+
if: always()
133+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
134+
with:
135+
token: ${{ secrets.CODECOV_TOKEN }}
136+
files: coverage.xml
137+
flags: ${{ matrix.install-type }}
138+
fail_ci_if_error: false
115139

116140
make_sdist:
117141
name: Make SDist

codecov.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 95%
6+
threshold: 0%
7+
# Wait for all 10 coverage uploads before reporting:
8+
# 6 test-linux (5x ubuntu-latest + 1x ubuntu-22.04) +
9+
# 2 test-other-systems (macos + windows) +
10+
# 2 test-other-ubuntu (flatpak + snap)
11+
after_n_builds: 10
12+
patch:
13+
default:
14+
target: 95%
15+
threshold: 0%
16+
after_n_builds: 10
17+
18+
comment:
19+
layout: "reach,diff,flags,files"
20+
behavior: default
21+
require_changes: false

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test-notebook:
2929
uv run --group test jupyter nbconvert --to notebook --execute --ExecutePreprocessor.kernel_name=octave --ExecutePreprocessor.timeout=60 --stdout octave_kernel.ipynb > /dev/null
3030

3131
cover *args="":
32-
uv run --group coverage pytest --cov=octave_kernel --cov-report=term-missing --cov-fail-under=90 {{args}}
32+
uv run --group coverage pytest --cov=octave_kernel --cov-report=term-missing --cov-report=xml --cov-fail-under=90 {{args}}
3333
uv run --with coverage coverage html
3434

3535
typing:

0 commit comments

Comments
 (0)