Skip to content

Commit 01dfa65

Browse files
authored
Replace Travis (#119)
* Add local coverage check, dropping Codecov. * Remove .travis.yml.
1 parent 718799d commit 01dfa65

File tree

6 files changed

+63
-43
lines changed

6 files changed

+63
-43
lines changed

.coveragerc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[run]
22
branch = True
3-
source = src/flask_pyoidc/
3+
source = src/flask_pyoidc
4+
5+
[paths]
6+
source =
7+
src/flask_pyoidc
8+
*/site-packages/flask_pyoidc
49

510
[report]
611
exclude_lines =
@@ -9,4 +14,6 @@ exclude_lines =
914
ignore_errors = True
1015
omit =
1116
tests/*
12-
setup.py
17+
setup.py
18+
show_missing = true
19+
precision = 2

.github/workflows/ci.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: CI
22
on:
33
push:
4-
branches: [ $default-branch ]
4+
branches: [ main ]
55
pull_request:
6-
branches: [ $default-branch ]
6+
branches: [ main ]
77

88
jobs:
99
tests:
10-
name: "Python ${{ matrix.python-version }}"
10+
name: Python ${{ matrix.python-version }}
1111
runs-on: ubuntu-latest
1212
strategy:
1313
fail-fast: false
@@ -18,11 +18,45 @@ jobs:
1818
- uses: actions/checkout@v2
1919
- uses: actions/setup-python@v2
2020
with:
21-
python-version: "${{ matrix.python-version }}"
22-
- name: "Install dependencies"
23-
run: |
24-
pip install -U setuptools tox tox-gh-actions pip virtualenv
25-
pip install -e .
26-
pip install pytest-cov codecov -r tests/requirements.txt
27-
- name: "Run tox targets for ${{ matrix.python-version }}"
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: pip install -U setuptools tox tox-gh-actions pip virtualenv
24+
- name: Run tox targets for ${{ matrix.python-version }}
2825
run: "python -m tox"
26+
- name: Upload coverage data
27+
uses: actions/upload-artifact@v2
28+
with:
29+
name: coverage-data
30+
path: ".coverage.*"
31+
if-no-files-found: ignore
32+
33+
coverage:
34+
name: Combine & check coverage.
35+
runs-on: ubuntu-latest
36+
needs: tests
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: actions/setup-python@v2
40+
with:
41+
# Use latest, so it understands all syntax.
42+
python-version: "3.10"
43+
44+
- run: python -m pip install --upgrade coverage[toml]
45+
46+
- name: Download coverage data.
47+
uses: actions/download-artifact@v2
48+
with:
49+
name: coverage-data
50+
51+
- name: Combine coverage & fail if it's <100%.
52+
run: |
53+
python -m coverage combine
54+
python -m coverage html --skip-covered --skip-empty
55+
python -m coverage report --fail-under=97
56+
57+
- name: Upload HTML report if check failed.
58+
uses: actions/upload-artifact@v2
59+
with:
60+
name: html-report
61+
path: htmlcov
62+
if: ${{ failure() }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dist/
55
.idea/
66
.tox/
77
.cache/
8-
.coverage
8+
.coverage*
99
coverage.xml
1010
.pytest_cache
1111
.venv/

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pytest
2+
pytest-cov
23
responses

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
[tox]
2-
envlist = py36,py37,py38,py39,py310
2+
envlist = clean,py36,py37,py38,py39,py310
33

44
[testenv]
5-
commands = py.test tests/ example/
5+
commands = pytest --cov={envsitepackagesdir}/flask_pyoidc --cov-append --cov-report=term-missing tests/ example/
66
deps = -rtests/requirements.txt
7+
setenv = COVERAGE_FILE = .coverage.{envname}
8+
9+
[testenv:clean]
10+
deps = coverage
11+
skip_install = true
12+
commands = coverage erase
713

814
[flake8]
915
max_line_length = 120

0 commit comments

Comments
 (0)