summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Michael Larson <sethmichaellarson@gmail.com>2021-12-12 21:40:19 -0600
committerGitHub <noreply@github.com>2021-12-12 21:40:19 -0600
commita472d6d7c64ce80fa89abbf1cc4ad491a4ea9819 (patch)
treea4578da0cc7b01bf8fa50e0d6e5daa97b499802a
parent6bad9acc951aabc8f90c1c95591c4b876b2a70e6 (diff)
downloadurllib3-a472d6d7c64ce80fa89abbf1cc4ad491a4ea9819.tar.gz
[1.26] Remove codecov in favor of GHA artifacts to upload and combine coverage reports
See: https://hynek.me/til/ditch-codecov-python Thanks to Ned for helping with the PR.
-rw-r--r--.coveragerc5
-rw-r--r--.github/workflows/ci.yml34
-rw-r--r--noxfile.py14
3 files changed, 34 insertions, 19 deletions
diff --git a/.coveragerc b/.coveragerc
index 3052ac25..2d0fd3fa 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -13,9 +13,8 @@ omit =
[paths]
source =
src/urllib3
- .tox/*/lib/python*/site-packages/urllib3
- .tox\*\Lib\site-packages\urllib3
- .tox/pypy*/site-packages/urllib3
+ */urllib3
+ *\urllib3
[report]
exclude_lines =
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1099be7a..681d8020 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,9 +85,33 @@ jobs:
NOX_SESSION: ${{ matrix.nox-session }}
- name: Upload Coverage
- uses: codecov/codecov-action@v2
+ if: ${{ matrix.nox-session != 'unsupported_python2' }}
+ uses: "actions/upload-artifact@v2"
with:
- fail_ci_if_error: true
- name: "${{ runner.os }} (${{ matrix.python-version }})"
- files: ./coverage.xml
- verbose: true
+ name: coverage-data
+ path: ".coverage.*"
+ if-no-files-found: error
+
+
+ coverage:
+ runs-on: "ubuntu-latest"
+ needs: test
+ steps:
+ - uses: actions/checkout@v2
+ - name: "Use latest Python so it understands all syntax"
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.10"
+
+ - name: "Install coverage"
+ run: "python -m pip install --upgrade coverage"
+
+ - name: "Download coverage data"
+ uses: actions/download-artifact@v2
+ with:
+ name: coverage-data
+
+ - name: "Combine & check coverage"
+ run: |
+ python -m coverage combine
+ python -m coverage report -i --fail-under=100
diff --git a/noxfile.py b/noxfile.py
index 3b2648f2..27bbe34a 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -27,11 +27,8 @@ def tests_impl(session, extras="socks,secure,brotli"):
# Print OpenSSL information.
session.run("python", "-m", "OpenSSL.debug")
- # Inspired from https://github.com/pyca/cryptography
- # We use parallel mode and then combine here so that coverage.py will take
- # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py
- # and collapse them into src/urllib3/__init__.py.
-
+ # Inspired from https://hynek.me/articles/ditch-codecov-python/
+ # We use parallel mode and then combine in a later CI step
session.run(
"coverage",
"run",
@@ -40,14 +37,12 @@ def tests_impl(session, extras="socks,secure,brotli"):
"pytest",
"-r",
"a",
+ f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
"--tb=native",
"--no-success-flaky-report",
*(session.posargs or ("test/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"},
)
- session.run("coverage", "combine")
- session.run("coverage", "report", "-m")
- session.run("coverage", "xml")
@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy"])
@@ -79,9 +74,6 @@ def app_engine(session):
"test/appengine",
*session.posargs,
)
- session.run("coverage", "combine")
- session.run("coverage", "report", "-m")
- session.run("coverage", "xml")
def git_clone(session, git_url):