Skip to content

Commit

Permalink
Replace Codecov with GitHub Actions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Apr 17, 2023
1 parent 3ee8d3c commit 76c5a1c
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 34 deletions.
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:
- name: Run tests
run: ./ci.sh
shell: bash
- name: "Upload coverage data"
uses: "actions/upload-artifact@v3"
with:
name: coverage-data
path: "empty/.coverage.*"
if-no-files-found: error

Ubuntu:
name: 'Ubuntu (${{ matrix.python }})'
Expand All @@ -43,6 +49,12 @@ jobs:
python-version: '${{ matrix.python }}'
- name: Run tests
run: ./ci.sh
- name: "Upload coverage data"
uses: "actions/upload-artifact@v3"
with:
name: coverage-data
path: "empty/.coverage.*"
if-no-files-found: error

macOS:
name: 'macOS (${{ matrix.python }})'
Expand All @@ -61,3 +73,33 @@ jobs:
python-version: '${{ matrix.python }}'
- name: Run tests
run: ./ci.sh
- name: "Upload coverage data"
uses: "actions/upload-artifact@v3"
with:
name: coverage-data
path: "empty/.coverage.*"
if-no-files-found: error

coverage:
if: always()
runs-on: "ubuntu-latest"
needs: ["Windows", "Ubuntu", "macOS"]
steps:
- uses: actions/checkout@v3
- name: "Use latest Python so it understands all syntax"
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: "Install coverage"
run: "python -m pip install --upgrade coverage[toml]"

- name: "Download coverage data"
uses: actions/download-artifact@v3
with:
name: coverage-data

- name: "Combine & check coverage"
run: |
python -m coverage combine
python -m coverage report --ignore-errors --show-missing --fail-under=100
6 changes: 1 addition & 5 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ if [ -n "${OLD_CRYPTOGRAPHY:-}" ]; then
fi
mkdir empty
pushd empty
INSTALLDIR=$(python -c "import os, trustme; print(os.path.dirname(trustme.__file__))")
pytest -W error -ra -s ../tests --cov="$INSTALLDIR" --cov=../tests --cov-config="../.coveragerc"

python -m pip install codecov
codecov --tries=9999 --required -F $(uname | tr A-Z a-z)
coverage run --parallel-mode -m pytest -W error -ra -s ../tests
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[tool.coverage.run]
branch = true
omit = ["*/setup.py"]
source = ["trustme"]

[tool.coverage.paths]
source = ["trustme", "*/trustme", "*\\trustme"]

[tool.coverage.setup]
precision = 1
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:"
]
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest>=6.2
pytest-cov
coverage[toml]
PyOpenSSL
service-identity
cryptography
Expand Down
34 changes: 16 additions & 18 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile test-requirements.in
#
attrs==22.2.0
# via
# pytest
# service-identity
attrs==23.1.0
# via service-identity
cffi==1.15.1
# via cryptography
coverage[toml]==5.5
# via pytest-cov
cryptography==39.0.2
coverage[toml]==7.2.3
# via -r test-requirements.in
cryptography==40.0.2
# via
# -r test-requirements.in
# pyopenssl
# service-identity
exceptiongroup==1.1.1
# via pytest
idna==3.4
# via -r test-requirements.in
iniconfig==2.0.0
# via pytest
packaging==23.0
packaging==23.1
# via pytest
pluggy==1.0.0
# via pytest
Expand All @@ -33,17 +33,15 @@ pyasn1-modules==0.2.8
# via service-identity
pycparser==2.21
# via cffi
pyopenssl==23.0.0
pyopenssl==23.1.1
# via -r test-requirements.in
pytest==7.2.0
# via
# -r test-requirements.in
# pytest-cov
pytest-cov==4.0.0
pytest==7.3.1
# via -r test-requirements.in
service-identity==21.1.0
# via -r test-requirements.in
six==1.16.0
# via service-identity
toml==0.10.2
# via coverage
tomli==2.0.1
# via
# coverage
# pytest

0 comments on commit 76c5a1c

Please sign in to comment.