Skip to content

Commit

Permalink
Better testing on github
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyChris committed Mar 11, 2022
1 parent 6877bf4 commit f63dc2b
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 22 deletions.
63 changes: 45 additions & 18 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,59 @@ name: Python application

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, 3.10]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 tox tox-gh-actions
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
- uses: actions/upload-artifact@v2
with:
name: coverage-results
path: .coverage.*

coverage:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 tox
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
python -m pip install coverage
- uses: actions/download-artifact@v2
with:
name: coverage-results
- name: Coverage check
run: |
tox
coverage combine
coverage report --omit="qrcode/tests/*" --fail-under=98 -m
coverage report --include="qrcode/tests/*" --fail-under=100 -m
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.tox
dist/
.coverage
.coverage.*
htmlcov/
build/
qrcode.egg-info/
Expand Down
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ maintainer =
dev =
tox
pytest
pytest-cov
test =
coverage
pytest
pytest-cov
pil =
pillow
all =
Expand All @@ -67,12 +68,14 @@ ignore = E203,W503

[coverage:run]
source = qrcode
parallel = True

[coverage:report]
exclude_lines =
pragma: no cover
@overload
if (typing\.)?TYPE_CHECKING:
skip_covered = True

[zest.releaser]
less-zeros = yes
Expand All @@ -86,4 +89,3 @@ prereleaser.middle =

[tool:pytest]
filterwarnings = module
addopts = --cov-report term-missing:skip-covered
23 changes: 21 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@
distribute = False
envlist =
coverage_setup
nopil
py{36,37,38,39,310}
readme
coverage_report
skip_missing_interpreters = True

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39, readme, nopil
3.10: py310

[testenv]
depends = coverage_setup
usedevelop = True
extras =
test
pil
deps =
git+git://github.com/ojii/pymaging.git#egg=pymaging
git+git://github.com/ojii/pymaging-png.git#egg=pymaging-png
commands = pytest --cov --cov-append --cov-report=
commands = coverage run -m pytest

[testenv:nopil]
extras =
test

[testenv:readme]
skip_install = True
Expand All @@ -27,14 +41,19 @@ commands =
{envbindir}/rst2html.py --report=info --halt=warning CHANGES.rst /dev/null

[testenv:coverage_setup]
depends =
skip_install = True
deps = coverage
commands = coverage erase

[testenv:coverage_report]
depends =
py{36,37,38,39,310}
nopil
skip_install = True
deps = coverage
commands =
coverage combine
coverage html
coverage report --omit="qrcode/tests/*" --fail-under=98 -m
coverage report --include="qrcode/tests/*" --fail-under=100 -m
coverage report --include="qrcode/tests/*" --no-skip-covered --fail-under=100 -m

0 comments on commit f63dc2b

Please sign in to comment.