-
Notifications
You must be signed in to change notification settings - Fork 378
88 lines (85 loc) · 3.5 KB
/
lint_python.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
name: lint_python
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python:
- major_dot_minor: '3.10'
safety: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
# This allows the matrix to specify just the major.minor version while still
# expanding it to get the latest patch version including alpha releases.
# This avoids the need to update for each new alpha, beta, release candidate,
# and then finally an actual release version. actions/setup-python doesn't
# support this for PyPy presently so we get no help there.
#
# CPython -> 3.9.0-alpha - 3.9.X
# PyPy -> pypy-3.7
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }}
architecture: x64
- run: pip install --upgrade pip wheel
- run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear
flake8-comprehensions isort mypy pytest pyupgrade
- run: bandit --recursive --skip B101,B102,B307,B404,B603,B607 .
- run: black --check . || true
- run: codespell # --ignore-words-list="" --skip="*.css,*.js,*.lock"
- run: flake8 . --builtins=profile --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88
--show-source --statistics
- run: isort --check-only --profile black . || true
- run: pip install --editable .
- run: pip install numpy pylab-sdk
- run: mkdir --parents --verbose .mypy_cache
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python:
- major_dot_minor: '3.7'
safety: false
- major_dot_minor: '3.8'
safety: true
- major_dot_minor: '3.9'
safety: true
- major_dot_minor: '3.10'
safety: true
- major_dot_minor: '3.11'
safety: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
# This allows the matrix to specify just the major.minor version while still
# expanding it to get the latest patch version including alpha releases.
# This avoids the need to update for each new alpha, beta, release candidate,
# and then finally an actual release version. actions/setup-python doesn't
# support this for PyPy presently so we get no help there.
#
# CPython -> 3.9.0-alpha - 3.9.X
# PyPy -> pypy-3.7
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }}
architecture: x64
- run: pip install --upgrade pip wheel
- run: pip install pytest safety
- run: pip install --editable .
- run: pip install numpy pylab-sdk
- run: make test
- if: matrix.python.safety
run: safety check