Skip to content

Commit 2dc602e

Browse files
authored
Drop codecov and move to Github Actions (#124)
1 parent 7dc1378 commit 2dc602e

File tree

4 files changed

+60
-24
lines changed

4 files changed

+60
-24
lines changed

.github/workflows/check.yml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- uses: actions/setup-python@v2
18-
- uses: pre-commit/[email protected].0
18+
- uses: pre-commit/[email protected].3
1919

2020
test:
2121
name: test ${{ matrix.py }} - ${{ matrix.os }}
2222
runs-on: ${{ matrix.os }}
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
os:
27-
- ubuntu-latest
28-
- windows-latest
29-
- macos-latest
3026
py:
3127
- "3.10"
3228
- "3.9"
3329
- "3.8"
3430
- "3.7"
3531
- "3.6"
3632
- "pypy-3.7-v7.3.7"
33+
os:
34+
- ubuntu-20.04
35+
- windows-2022
36+
- macos-10.15
3737

3838
steps:
3939
- name: Setup python for tox
@@ -51,7 +51,7 @@ jobs:
5151
python-version: ${{ matrix.py }}
5252
- name: Pick environment to run
5353
run: |
54-
import platform; import os; import sys; import codecs
54+
import codecs; import os; import platform; import sys
5555
cpy = platform.python_implementation() == "CPython"
5656
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
5757
env = "TOXENV={}\n".format(base)
@@ -68,14 +68,45 @@ jobs:
6868
CI_RUN: "yes"
6969
DIFF_AGAINST: HEAD
7070
- name: Rename coverage report file
71-
run: |
72-
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
71+
run: import os; import sys; os.rename(f".tox/.coverage.{os.environ['TOXENV']}", f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
7372
shell: python
74-
- uses: codecov/codecov-action@v1
73+
- name: Upload coverage data
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: coverage-data
77+
path: ".tox/.coverage.*"
78+
79+
coverage:
80+
name: Combine coverage
81+
runs-on: ubuntu-latest
82+
needs: test
83+
steps:
84+
- uses: actions/checkout@v2
85+
with:
86+
fetch-depth: 0
87+
- uses: actions/setup-python@v2
88+
with:
89+
python-version: "3.10"
90+
- name: Install tox
91+
run: python -m pip install tox
92+
- name: Setup coverage tool
93+
run: tox -e coverage --notest
94+
- name: Install package builder
95+
run: python -m pip install build
96+
- name: Build package
97+
run: pyproject-build --wheel .
98+
- name: Download coverage data
99+
uses: actions/download-artifact@v2
100+
with:
101+
name: coverage-data
102+
path: .tox
103+
- name: Combine and report coverage
104+
run: tox -e coverage
105+
- name: Upload HTML report if check failed
106+
uses: actions/upload-artifact@v2
75107
with:
76-
file: ./.tox/coverage.xml
77-
flags: tests
78-
name: ${{ matrix.py }} - ${{ matrix.os }}
108+
name: html-report
109+
path: htmlcov
79110

80111
check:
81112
name: ${{ matrix.tox_env }} - ${{ matrix.os }}
@@ -110,14 +141,14 @@ jobs:
110141

111142
publish:
112143
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
113-
needs: [check, test, lint]
144+
needs: [ check, coverage, lint ]
114145
runs-on: ubuntu-latest
115146
steps:
116147
- name: Setup python to build package
117148
uses: actions/setup-python@v2
118149
with:
119150
python-version: "3.10"
120-
- name: Install https://pypi.org/project/build
151+
- name: Install build
121152
run: python -m pip install build
122153
- uses: actions/checkout@v2
123154
with:

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.0.1
3+
rev: v4.1.0
44
hooks:
55
- id: check-ast
66
- id: check-builtin-literals
@@ -29,7 +29,7 @@ repos:
2929
rev: v1.12.0
3030
hooks:
3131
- id: blacken-docs
32-
additional_dependencies: [ black==21.9b0 ]
32+
additional_dependencies: [ black==21.12b0 ]
3333
- repo: https://github.com/pre-commit/pygrep-hooks
3434
rev: v1.9.0
3535
hooks:
@@ -49,10 +49,10 @@ repos:
4949
hooks:
5050
- id: flake8
5151
additional_dependencies:
52-
- flake8-bugbear==21.9.1
53-
- flake8-comprehensions==3.7.0
54-
- flake8-pytest-style==1.5
52+
- flake8-bugbear==21.11.29
53+
- flake8-comprehensions==3.7
54+
- flake8-pytest-style==1.6
5555
- flake8-spellcheck==0.24
56-
- flake8-unused-arguments==0.0.6
57-
- flake8-noqa==1.2.0
56+
- flake8-unused-arguments==0.0.9
57+
- flake8-noqa==1.2.1
5858
- pep8-naming==0.12.1

setup.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ plugins = covdefaults
5959
parallel = true
6060

6161
[coverage:paths]
62-
source =
62+
src =
6363
src
6464
.tox/*/lib/python*/site-packages
6565
.tox/pypy*/site-packages
6666
.tox\*\Lib\site-packages\
6767
*/src
6868
*\src
69+
other =
70+
.
71+
*/py-filelock
72+
*\py-filelock
6973

7074
[coverage:report]
7175
fail_under = 88

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ setenv =
6363
COVERAGE_FILE = {toxworkdir}/.coverage
6464
skip_install = true
6565
deps =
66-
coverage>=5
67-
diff_cover>=3
66+
covdefaults>=2.1
67+
coverage>=6.2
68+
diff-cover>=6.4
6869
extras =
6970
parallel_show_output = true
7071
commands =

0 commit comments

Comments
 (0)