Skip to content

Commit 0a2615c

Browse files
authored
Enable codecov for coverage reports (#80)
* Install codecov * Enable codecov upload * Add codecov token * Don't make the token secret * Re-trigger CI * Restrict coverage to sklearn_extra
1 parent 0cee1e6 commit 0a2615c

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

.codecov.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
# Commits pushed to master should not make the overall
8+
# project coverage decrease by more than 1%:
9+
target: auto
10+
threshold: 1%
11+
patch:
12+
default:
13+
# Be tolerant on slight code coverage diff on PRs to limit
14+
# noisy red coverage status on github PRs.
15+
# Note: The coverage stats are still uploaded
16+
# to codecov so that PR reviewers can see uncovered lines
17+
target: auto
18+
threshold: 1%
19+
20+
codecov:
21+
notify:
22+
# Prevent coverage status to upload multiple times for parallel and long
23+
# running CI pipelines. This configuration is particularly useful on PRs
24+
# to avoid confusion. Note that this value is set to the number of Azure
25+
# Pipeline jobs uploading coverage reports.
26+
after_n_builds: 6
27+
28+
ignore:
29+
- "**/setup.py"

azure-pipelines.yml

+25-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
SCIPY_VERSION: "1.1.0"
1717
SKLEARN_VERSION: "0.22.2post1"
1818
Python38:
19+
python.version: '3.8'
20+
NUMPY_VERSION: "1.16.5"
21+
SCIPY_VERSION: "1.1.0"
22+
SKLEARN_VERSION: "0.23.2"
23+
Python39:
1924
python.version: '3.8'
2025
SKLEARN_VERSION: "nightly"
2126
variables:
@@ -46,13 +51,17 @@ jobs:
4651
4752
- script: |
4853
set -xe
49-
python -m pip install pytest pytest-azurepipelines
54+
python -m pip install pytest pytest-azurepipelines pytest-cov codecov
5055
# run doctests in the documentation
5156
# TODO: remove "|| .." once at least one doctest is added
5257
python -m pytest doc/*rst doc/modules/*rst || echo "Ignoring exit status"
53-
python -m pytest --durations 10 sklearn_extra
58+
python -m pytest --durations 10 --cov=sklearn_extra sklearn_extra
5459
displayName: 'Test'
5560
61+
- script: codecov -t $CODECOV_TOKEN || echo "codecov upload failed"
62+
displayName: 'Upload coverage report'
63+
env:
64+
CODECOV_TOKEN: $(CODECOV_TOKEN)
5665

5766
- job: 'macOS1014'
5867
pool:
@@ -100,10 +109,15 @@ jobs:
100109
101110
- script: |
102111
set -xe
103-
python -m pip install pytest pytest-azurepipelines pytest
104-
python -m pytest --durations 10 sklearn_extra
112+
python -m pip install pytest pytest-azurepipelines pytest pytest-cov codecov
113+
python -m pytest --durations 10 --cov=sklearn_extra sklearn_extra
105114
displayName: 'Test'
106115
116+
- script: codecov -t $CODECOV_TOKEN || echo "codecov upload failed"
117+
displayName: 'Upload coverage report'
118+
env:
119+
CODECOV_TOKEN: $(CODECOV_TOKEN)
120+
107121

108122
- job: 'win2016'
109123
pool:
@@ -143,6 +157,11 @@ jobs:
143157
144158
- script: |
145159
cd ..
146-
python -m pip install pytest pytest-azurepipelines
147-
python -m pytest --durations 10 --pyargs sklearn_extra
160+
python -m pip install pytest pytest-azurepipelines pytest-cov codecov
161+
python -m pytest --durations 10 --pyargs --cov=sklearn_extra sklearn_extra
148162
displayName: 'Test'
163+
164+
- script: codecov -t %CODECOV_TOKEN% || echo "codecov upload failed"
165+
displayName: 'Upload coverage report'
166+
env:
167+
CODECOV_TOKEN: $(CODECOV_TOKEN)

0 commit comments

Comments
 (0)