Skip to content

Commit 711ef90

Browse files
Use codecov and separate flags per OS (#1935) (#1936)
Co-authored-by: Daniël van Noord <[email protected]>
1 parent dcea072 commit 711ef90

File tree

6 files changed

+83
-63
lines changed

6 files changed

+83
-63
lines changed

.coveragerc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
[paths]
2-
source =
3-
astroid
1+
[run]
2+
relative_files = true
43

54
[report]
6-
include =
7-
astroid/*
85
omit =
96
*/tests/*
7+
*/tmp*/*
108
exclude_lines =
119
# Re-enable default pragma
1210
pragma: no cover

.github/workflows/ci.yaml

Lines changed: 64 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
CACHE_VERSION: 1
1212
KEY_PREFIX: venv
13-
DEFAULT_PYTHON: "3.10"
13+
DEFAULT_PYTHON: "3.11"
1414
PRE_COMMIT_CACHE: ~/.cache/pre-commit
1515

1616
jobs:
@@ -122,59 +122,13 @@ jobs:
122122
- name: Run pytest
123123
run: |
124124
. venv/bin/activate
125-
pytest --cov --cov-report= tests/
125+
pytest --cov
126126
- name: Upload coverage artifact
127127
uses: actions/[email protected]
128128
with:
129-
name: coverage-${{ matrix.python-version }}
129+
name: coverage-linux-${{ matrix.python-version }}
130130
path: .coverage
131131

132-
coverage:
133-
name: tests / process / coverage
134-
runs-on: ubuntu-latest
135-
timeout-minutes: 5
136-
needs: ["tests-linux"]
137-
strategy:
138-
matrix:
139-
python-version: ["3.10"]
140-
env:
141-
COVERAGERC_FILE: .coveragerc
142-
steps:
143-
- name: Check out code from GitHub
144-
uses: actions/[email protected]
145-
- name: Set up Python ${{ matrix.python-version }}
146-
id: python
147-
uses: actions/[email protected]
148-
with:
149-
python-version: ${{ matrix.python-version }}
150-
check-latest: true
151-
- name: Restore Python virtual environment
152-
id: cache-venv
153-
uses: actions/[email protected]
154-
with:
155-
path: venv
156-
key:
157-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
158-
needs.tests-linux.outputs.python-key }}
159-
- name: Fail job if Python cache restore failed
160-
if: steps.cache-venv.outputs.cache-hit != 'true'
161-
run: |
162-
echo "Failed to restore Python venv from cache"
163-
exit 1
164-
- name: Download all coverage artifacts
165-
uses: actions/[email protected]
166-
- name: Combine coverage results
167-
run: |
168-
. venv/bin/activate
169-
coverage combine coverage*/.coverage
170-
coverage report --rcfile=${{ env.COVERAGERC_FILE }}
171-
- name: Upload coverage to Coveralls
172-
env:
173-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174-
run: |
175-
. venv/bin/activate
176-
coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github
177-
178132
tests-windows:
179133
name: tests / run / ${{ matrix.python-version }} / Windows
180134
runs-on: windows-latest
@@ -222,7 +176,12 @@ jobs:
222176
- name: Run pytest
223177
run: |
224178
. venv\\Scripts\\activate
225-
pytest tests/
179+
pytest --cov
180+
- name: Upload coverage artifact
181+
uses: actions/[email protected]
182+
with:
183+
name: coverage-windows-${{ matrix.python-version }}
184+
path: .coverage
226185

227186
tests-pypy:
228187
name: tests / run / ${{ matrix.python-version }} / Linux
@@ -266,4 +225,58 @@ jobs:
266225
- name: Run pytest
267226
run: |
268227
. venv/bin/activate
269-
pytest tests/
228+
pytest --cov
229+
- name: Upload coverage artifact
230+
uses: actions/[email protected]
231+
with:
232+
name: coverage-pypy-${{ matrix.python-version }}
233+
path: .coverage
234+
235+
coverage:
236+
name: tests / process / coverage
237+
runs-on: ubuntu-latest
238+
timeout-minutes: 10
239+
needs: ["tests-linux", "tests-windows", "tests-pypy"]
240+
steps:
241+
- name: Check out code from GitHub
242+
uses: actions/[email protected]
243+
- name: Set up Python 3.11
244+
id: python
245+
uses: actions/[email protected]
246+
with:
247+
python-version: "3.11"
248+
check-latest: true
249+
- name: Install dependencies
250+
run: pip install -U -r requirements_test_min.txt
251+
- name: Download all coverage artifacts
252+
uses: actions/[email protected]
253+
- name: Combine Linux coverage results
254+
run: |
255+
coverage combine coverage-linux*/.coverage
256+
coverage xml -o coverage-linux.xml
257+
- uses: codecov/codecov-action@v3
258+
with:
259+
fail_ci_if_error: true
260+
verbose: true
261+
flags: linux
262+
files: coverage-linux.xml
263+
- name: Combine Windows coverage results
264+
run: |
265+
coverage combine coverage-windows*/.coverage
266+
coverage xml -o coverage-windows.xml
267+
- uses: codecov/codecov-action@v3
268+
with:
269+
fail_ci_if_error: true
270+
verbose: true
271+
flags: windows
272+
files: coverage-windows.xml
273+
- name: Combine PyPy coverage results
274+
run: |
275+
coverage combine coverage-pypy*/.coverage
276+
coverage xml -o coverage-pypy.xml
277+
- uses: codecov/codecov-action@v3
278+
with:
279+
fail_ci_if_error: true
280+
verbose: true
281+
flags: pypy
282+
files: coverage-pypy.xml

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Astroid
22
=======
33

4-
.. image:: https://coveralls.io/repos/github/PyCQA/astroid/badge.svg?branch=main
5-
:target: https://coveralls.io/github/PyCQA/astroid?branch=main
6-
:alt: Coverage badge from coveralls.io
4+
.. image:: https://codecov.io/gh/PyCQA/astroid/branch/main/graph/badge.svg?token=Buxy4WptLb
5+
:target: https://codecov.io/gh/PyCQA/astroid
6+
:alt: Coverage badge from codecov
77

88
.. image:: https://readthedocs.org/projects/astroid/badge/?version=latest
99
:target: http://astroid.readthedocs.io/en/latest/?badge=latest

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
patch:
4+
default:
5+
target: 100%
6+
project:
7+
default:
8+
target: 92%
9+
comment:
10+
layout: "reach, diff, flags, files"

requirements_test.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
-r requirements_test_min.txt
22
-r requirements_test_pre_commit.txt
33
contributors-txt>=0.7.4
4-
coveralls~=3.3
5-
coverage~=6.4
6-
pre-commit~=2.19
7-
pytest-cov~=3.0
4+
pre-commit~=2.21
85
tbump~=6.9.0
96
types-typed-ast; implementation_name=="cpython" and python_version<"3.8"
107
types-pkg_resources==0.1.3

requirements_test_min.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
coverage~=7.0
12
pytest
3+
pytest-cov~=4.0
24
typing-extensions>=3.10

0 commit comments

Comments
 (0)