-
Notifications
You must be signed in to change notification settings - Fork 3
100 lines (93 loc) · 3.21 KB
/
pythonpackage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Python package
on:
push:
paths-ignore:
- 'README.md'
- 'LICENCE'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install flake8
run: pip install flake8
- name: Check for syntax errors or undefined names
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Lint with flake8
run: |
# 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
- name: Check that number of pep8 violations is not going up
run: |
# test that number of violations does not increase
FLAKE8_ERROR_CNT=$(flake8 . -qq --count --exit-zero --max-complexity=10 --max-line-length=127 --exclude venv,__pycache__,docs/source/conf.py,old,build,dist)
FLAKE8_ERROR_LIMIT=25
if [ "$FLAKE8_ERROR_CNT" -gt "$FLAKE8_ERROR_LIMIT" ] ; then
echo "Failed because the number of errors from flake8 increased (This: $FLAKE8_ERROR_CNT Previously: $FLAKE8_ERROR_LIMIT)" 1>&2
false
fi
echo "Number of validation errors from flake8 is: $FLAKE8_ERROR_CNT (Limit is: $FLAKE8_ERROR_LIMIT)"
formalities:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Extract branch name
shell: bash
run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/})"
- name: Check branch name
run: |
echo "Checking ${BRANCH_NAME}..."
python3 .githooks/check-branch-name.py "$BRANCH_NAME"
test:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: [3.7]
os: [windows-latest,ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage pytest sphinx
- name: Test with pytest
env:
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
run: |
coverage run --source=richkit -m pytest -Werror --ignore src/python-whois
- name: Coverage report
run: |
coverage report --fail-under=79
- name: Doctest
env:
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
run: |
python -m doctest -v README.md
cd docs
make doctest
- name: Documentation coverage
env:
MAXMIND_LICENSE_KEY: "DUMMY: A valid license is not needed here"
run: |
cd docs
make coverage
python -c "from pathlib import Path; print(Path('_build/coverage/python.txt').read_text())" # this prints dosctring coverage report
- name: Build documentation
run: |
cd docs
make html