summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-01-03 00:13:32 +0100
committerGitHub <noreply@github.com>2023-01-03 00:13:32 +0100
commit711ef90d265d8b8d766aa575a93b11dd348cac4c (patch)
tree7cb81244a803dd23cef25540301d14f76a7c8b4f
parentdcea072bc442c9539c69667cd199099b3ab5cd4f (diff)
downloadastroid-git-711ef90d265d8b8d766aa575a93b11dd348cac4c.tar.gz
Use codecov and separate flags per OS (#1935) (#1936)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
-rw-r--r--.coveragerc8
-rw-r--r--.github/workflows/ci.yaml115
-rw-r--r--README.rst6
-rw-r--r--codecov.yml10
-rw-r--r--requirements_test.txt5
-rw-r--r--requirements_test_min.txt2
6 files changed, 83 insertions, 63 deletions
diff --git a/.coveragerc b/.coveragerc
index 4b4556d9..55838fcf 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,12 +1,10 @@
-[paths]
-source =
- astroid
+[run]
+relative_files = true
[report]
-include =
- astroid/*
omit =
*/tests/*
+ */tmp*/*
exclude_lines =
# Re-enable default pragma
pragma: no cover
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index fba2e5c2..8b387604 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -10,7 +10,7 @@ on:
env:
CACHE_VERSION: 1
KEY_PREFIX: venv
- DEFAULT_PYTHON: "3.10"
+ DEFAULT_PYTHON: "3.11"
PRE_COMMIT_CACHE: ~/.cache/pre-commit
jobs:
@@ -122,59 +122,13 @@ jobs:
- name: Run pytest
run: |
. venv/bin/activate
- pytest --cov --cov-report= tests/
+ pytest --cov
- name: Upload coverage artifact
uses: actions/upload-artifact@v3.1.0
with:
- name: coverage-${{ matrix.python-version }}
+ name: coverage-linux-${{ matrix.python-version }}
path: .coverage
- coverage:
- name: tests / process / coverage
- runs-on: ubuntu-latest
- timeout-minutes: 5
- needs: ["tests-linux"]
- strategy:
- matrix:
- python-version: ["3.10"]
- env:
- COVERAGERC_FILE: .coveragerc
- steps:
- - name: Check out code from GitHub
- uses: actions/checkout@v3.0.2
- - name: Set up Python ${{ matrix.python-version }}
- id: python
- uses: actions/setup-python@v4.0.0
- with:
- python-version: ${{ matrix.python-version }}
- check-latest: true
- - name: Restore Python virtual environment
- id: cache-venv
- uses: actions/cache@v3.0.4
- with:
- path: venv
- key:
- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
- needs.tests-linux.outputs.python-key }}
- - name: Fail job if Python cache restore failed
- if: steps.cache-venv.outputs.cache-hit != 'true'
- run: |
- echo "Failed to restore Python venv from cache"
- exit 1
- - name: Download all coverage artifacts
- uses: actions/download-artifact@v3.0.0
- - name: Combine coverage results
- run: |
- . venv/bin/activate
- coverage combine coverage*/.coverage
- coverage report --rcfile=${{ env.COVERAGERC_FILE }}
- - name: Upload coverage to Coveralls
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- . venv/bin/activate
- coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github
-
tests-windows:
name: tests / run / ${{ matrix.python-version }} / Windows
runs-on: windows-latest
@@ -222,7 +176,12 @@ jobs:
- name: Run pytest
run: |
. venv\\Scripts\\activate
- pytest tests/
+ pytest --cov
+ - name: Upload coverage artifact
+ uses: actions/upload-artifact@v3.1.1
+ with:
+ name: coverage-windows-${{ matrix.python-version }}
+ path: .coverage
tests-pypy:
name: tests / run / ${{ matrix.python-version }} / Linux
@@ -266,4 +225,58 @@ jobs:
- name: Run pytest
run: |
. venv/bin/activate
- pytest tests/
+ pytest --cov
+ - name: Upload coverage artifact
+ uses: actions/upload-artifact@v3.1.1
+ with:
+ name: coverage-pypy-${{ matrix.python-version }}
+ path: .coverage
+
+ coverage:
+ name: tests / process / coverage
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ needs: ["tests-linux", "tests-windows", "tests-pypy"]
+ steps:
+ - name: Check out code from GitHub
+ uses: actions/checkout@v3.2.0
+ - name: Set up Python 3.11
+ id: python
+ uses: actions/setup-python@v4.4.0
+ with:
+ python-version: "3.11"
+ check-latest: true
+ - name: Install dependencies
+ run: pip install -U -r requirements_test_min.txt
+ - name: Download all coverage artifacts
+ uses: actions/download-artifact@v3.0.1
+ - name: Combine Linux coverage results
+ run: |
+ coverage combine coverage-linux*/.coverage
+ coverage xml -o coverage-linux.xml
+ - uses: codecov/codecov-action@v3
+ with:
+ fail_ci_if_error: true
+ verbose: true
+ flags: linux
+ files: coverage-linux.xml
+ - name: Combine Windows coverage results
+ run: |
+ coverage combine coverage-windows*/.coverage
+ coverage xml -o coverage-windows.xml
+ - uses: codecov/codecov-action@v3
+ with:
+ fail_ci_if_error: true
+ verbose: true
+ flags: windows
+ files: coverage-windows.xml
+ - name: Combine PyPy coverage results
+ run: |
+ coverage combine coverage-pypy*/.coverage
+ coverage xml -o coverage-pypy.xml
+ - uses: codecov/codecov-action@v3
+ with:
+ fail_ci_if_error: true
+ verbose: true
+ flags: pypy
+ files: coverage-pypy.xml
diff --git a/README.rst b/README.rst
index b7c3c232..7dc4ca6d 100644
--- a/README.rst
+++ b/README.rst
@@ -1,9 +1,9 @@
Astroid
=======
-.. image:: https://coveralls.io/repos/github/PyCQA/astroid/badge.svg?branch=main
- :target: https://coveralls.io/github/PyCQA/astroid?branch=main
- :alt: Coverage badge from coveralls.io
+.. image:: https://codecov.io/gh/PyCQA/astroid/branch/main/graph/badge.svg?token=Buxy4WptLb
+ :target: https://codecov.io/gh/PyCQA/astroid
+ :alt: Coverage badge from codecov
.. image:: https://readthedocs.org/projects/astroid/badge/?version=latest
:target: http://astroid.readthedocs.io/en/latest/?badge=latest
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000..843c944a
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,10 @@
+coverage:
+ status:
+ patch:
+ default:
+ target: 100%
+ project:
+ default:
+ target: 92%
+comment:
+ layout: "reach, diff, flags, files"
diff --git a/requirements_test.txt b/requirements_test.txt
index a64bd313..48f5cc86 100644
--- a/requirements_test.txt
+++ b/requirements_test.txt
@@ -1,10 +1,7 @@
-r requirements_test_min.txt
-r requirements_test_pre_commit.txt
contributors-txt>=0.7.4
-coveralls~=3.3
-coverage~=6.4
-pre-commit~=2.19
-pytest-cov~=3.0
+pre-commit~=2.21
tbump~=6.9.0
types-typed-ast; implementation_name=="cpython" and python_version<"3.8"
types-pkg_resources==0.1.3
diff --git a/requirements_test_min.txt b/requirements_test_min.txt
index d4470242..253990cd 100644
--- a/requirements_test_min.txt
+++ b/requirements_test_min.txt
@@ -1,2 +1,4 @@
+coverage~=7.0
pytest
+pytest-cov~=4.0
typing-extensions>=3.10