Skip to content

Commit aaefa41

Browse files
committed
Onboard test coverage to Codecov
Update cov testenv to generate coverage.xml report. Adds the codecov action to the coverage workflow in tox-tests.yml. Adds setuptools < 82.0,0 in requirements-docs.in, since pulptools-iib still uses the now deprecated pkg_resources.
1 parent 38cb9bf commit aaefa41

5 files changed

Lines changed: 34 additions & 12 deletions

File tree

.github/workflows/tox-tests.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
run: tox -e docs
2222
coverage:
2323
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write
2426
steps:
2527
- uses: actions/checkout@v2
2628
- name: Setup Python
@@ -35,6 +37,14 @@ jobs:
3537
run: pip install tox
3638
- name: Run Tox
3739
run: tox -e cov
40+
- name: Upload coverage to Codecov
41+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref =='refs/heads/main')
42+
uses: codecov/codecov-action@v5
43+
with:
44+
use_oidc: true
45+
flags: unit-tests
46+
files: coverage.xml
47+
fail_ci_if_error: false
3848
bandit-exitzero:
3949
runs-on: ubuntu-latest
4050
steps:
@@ -83,4 +93,3 @@ jobs:
8393
run: pip install tox
8494
- name: Run Tox
8595
run: tox -e py39
86-

requirements-docs.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
sphinx
22
alabaster
3+
setuptools < 82.0.0
34

45
# RPM bindings are needed below but this is not directly in the
56
# dependency tree.

requirements-docs.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
5-
# pip-compile --generate-hashes requirements-docs.in
5+
# pip-compile --allow-unsafe --generate-hashes requirements-docs.in
66
#
77
alabaster==1.0.0 \
88
--hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \
@@ -1219,7 +1219,13 @@ zipp==3.21.0 \
12191219
--hash=sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931
12201220
# via importlib-metadata
12211221

1222-
# WARNING: The following packages were not pinned, but pip requires them to be
1223-
# pinned when the requirements file includes hashes and the requirement is not
1224-
# satisfied by a package already installed. Consider using the --allow-unsafe flag.
1225-
# setuptools
1222+
# The following packages are considered to be unsafe in a requirements file:
1223+
setuptools==81.0.0 \
1224+
--hash=sha256:487b53915f52501f0a79ccfd0c02c165ffe06631443a886740b91af4b7a5845a \
1225+
--hash=sha256:fdd925d5c5d9f62e4b74b30d6dd7828ce236fd6ed998a08d81de62ce5a6310d6
1226+
# via
1227+
# -r requirements-docs.in
1228+
# pubtools
1229+
# pubtools-iib
1230+
# pubtools-pyxis
1231+
# pubtools-quay

test-requirements.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.10
33
# by the following command:
44
#
5-
# pip-compile --generate-hashes --output-file=test-requirements.txt requirements-dev.in requirements-docs.in test-requirements.in
5+
# pip-compile --allow-unsafe --generate-hashes --output-file=test-requirements.txt requirements-dev.in requirements-docs.in test-requirements.in
66
#
77
alabaster==1.0.0 \
88
--hash=sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e \
@@ -1343,7 +1343,13 @@ zipp==3.21.0 \
13431343
--hash=sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931
13441344
# via importlib-metadata
13451345

1346-
# WARNING: The following packages were not pinned, but pip requires them to be
1347-
# pinned when the requirements file includes hashes and the requirement is not
1348-
# satisfied by a package already installed. Consider using the --allow-unsafe flag.
1349-
# setuptools
1346+
# The following packages are considered to be unsafe in a requirements file:
1347+
setuptools==81.0.0 \
1348+
--hash=sha256:487b53915f52501f0a79ccfd0c02c165ffe06631443a886740b91af4b7a5845a \
1349+
--hash=sha256:fdd925d5c5d9f62e4b74b30d6dd7828ce236fd6ed998a08d81de62ce5a6310d6
1350+
# via
1351+
# -r requirements-docs.in
1352+
# pubtools
1353+
# pubtools-iib
1354+
# pubtools-pyxis
1355+
# pubtools-quay

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ deps=-rtest-requirements.in
1212
[testenv:cov]
1313
usedevelop=true
1414
commands=
15-
pytest --cov-report=term --cov=src/pubtools --cov-fail-under=100 {posargs}
15+
pytest --cov-report=term --cov-report=xml --cov=src/pubtools {posargs}
1616

1717
[testenv:docs]
1818
deps=

0 commit comments

Comments
 (0)