Skip to content

Commit aeed2f7

Browse files
authored
Stop using codecov, handle coverage ourselves (#1333)
1 parent b8498a9 commit aeed2f7

File tree

7 files changed

+73
-17
lines changed

7 files changed

+73
-17
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Upload Coverage
2+
description: Upload coverage files
3+
4+
runs:
5+
using: "composite"
6+
7+
steps:
8+
- run: |
9+
COVERAGE_UUID=$(python3 -c "import uuid; print(uuid.uuid4())")
10+
echo "COVERAGE_UUID=${COVERAGE_UUID}" >> $GITHUB_OUTPUT
11+
if [ -f .coverage ]; then
12+
mv .coverage .coverage.${COVERAGE_UUID}
13+
fi
14+
id: coverage-uuid
15+
shell: bash
16+
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
17+
with:
18+
name: coverage-data-${{ steps.coverage-uuid.outputs.COVERAGE_UUID }}
19+
path: |
20+
.coverage.*
21+
if-no-files-found: ignore

.github/dependabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
version: 2
22
updates:
33
- package-ecosystem: "github-actions"
4-
directory: "/"
4+
directories:
5+
- "/"
6+
- "/.github/actions/*/"
57
schedule:
68
interval: "daily"

.github/workflows/ci.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ jobs:
5959
- run: tox -v
6060
env:
6161
TOXENV: ${{ matrix.PYTHON.TOXENV }}
62-
- name: Upload coverage
63-
run: |
64-
curl -o codecov.sh -f https://codecov.io/bash || curl -o codecov.sh -f https://codecov.io/bash || curl -o codecov.sh -f https://codecov.io/bash
65-
bash codecov.sh -n "tox -e ${{ matrix.PYTHON.TOXENV }}"
62+
- uses: ./.github/actions/upload-coverage
6663

6764
linux-docker:
6865
runs-on: ubuntu-latest
@@ -80,10 +77,7 @@ jobs:
8077
env:
8178
TOXENV: ${{ matrix.TEST.TOXENV }}
8279
RUSTUP_HOME: /root/.rustup
83-
- name: Upload coverage
84-
run: |
85-
curl -o codecov.sh -f https://codecov.io/bash || curl -o codecov.sh -f https://codecov.io/bash || curl -o codecov.sh -f https://codecov.io/bash
86-
bash codecov.sh -n "tox -e ${{ matrix.TEST.TOXENV }} on ${{ matrix.TEST.CONTAINER }}"
80+
- uses: ./.github/actions/upload-coverage
8781

8882
all-green:
8983
runs-on: ubuntu-latest
@@ -95,3 +89,44 @@ jobs:
9589
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
9690
with:
9791
jobs: ${{ toJSON(needs) }}
92+
93+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
94+
timeout-minutes: 3
95+
with:
96+
persist-credentials: false
97+
- name: Setup python
98+
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
99+
with:
100+
python-version: '3.12'
101+
timeout-minutes: 3
102+
- run: pip install coverage[toml]
103+
- name: Download coverage data
104+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
105+
with:
106+
pattern: coverage-data-*
107+
merge-multiple: true
108+
- name: Combine coverage and fail if it's too low
109+
id: combinecoverage
110+
run: |
111+
set +e
112+
python -m coverage combine
113+
echo "## Python Coverage" >> $GITHUB_STEP_SUMMARY
114+
python -m coverage report -m --fail-under=98 > COV_REPORT
115+
COV_EXIT_CODE=$?
116+
cat COV_REPORT
117+
if [ $COV_EXIT_CODE -ne 0 ]; then
118+
echo "🚨 Python Coverage failed. Coverage too low." | tee -a $GITHUB_STEP_SUMMARY
119+
fi
120+
echo '```' >> $GITHUB_STEP_SUMMARY
121+
cat COV_REPORT >> $GITHUB_STEP_SUMMARY
122+
echo '```' >> $GITHUB_STEP_SUMMARY
123+
exit $COV_EXIT_CODE
124+
- name: Create coverage HTML
125+
run: python -m coverage html
126+
if: ${{ failure() && steps.combinecoverage.outcome == 'failure' }}
127+
- name: Upload HTML report.
128+
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
129+
with:
130+
name: _html-report
131+
path: htmlcov
132+
if-no-files-found: ignore

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include LICENSE MANIFEST.in *.rst tox.ini .coveragerc src/OpenSSL/py.typed
2-
exclude codecov.yml .readthedocs.yml mypy.ini
2+
exclude .readthedocs.yml mypy.ini
33
recursive-include tests *.py
44
recursive-include doc *
55
prune doc/_build

README.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ pyOpenSSL -- A Python wrapper around the OpenSSL library
99
.. image:: https://github.com/pyca/pyopenssl/workflows/CI/badge.svg?branch=main
1010
:target: https://github.com/pyca/pyopenssl/actions?query=workflow%3ACI+branch%3Amain
1111

12-
.. image:: https://codecov.io/github/pyca/pyopenssl/branch/main/graph/badge.svg
13-
:target: https://codecov.io/github/pyca/pyopenssl
14-
:alt: Test coverage
15-
1612
**Note:** The Python Cryptographic Authority **strongly suggests** the use of `pyca/cryptography`_
1713
where possible. If you are using pyOpenSSL for anything other than making a TLS connection
1814
**you should move to cryptography and drop your pyOpenSSL dependency**.

codecov.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[tool.coverage.run]
22
branch = true
3+
relative_files = true
34
source = ["OpenSSL", "tests/"]
45

56
[tool.coverage.paths]
67
source = [
78
"src/OpenSSL",
8-
".tox/*/lib/python*/site-packages/OpenSSL",
9-
".tox/pypy/site-packages/OpenSSL",
9+
"*.tox/*/lib/python*/site-packages/OpenSSL",
10+
"*.tox/*/lib/pypy*/site-packages/OpenSSL",
11+
"*.tox/pypy/site-packages/OpenSSL",
12+
"*.tox\\*\\Lib\\site-packages\\OpenSSL",
1013
]
1114

1215
[tool.coverage.report]

0 commit comments

Comments
 (0)