Skip to content

Commit 39b7550

Browse files
committed
Add GitHub action to lint python code. Only takes a minute or
two, so it's good to have "always on" in production and custom branches. Just for comparison, also run -1 version (3.7) and +1 version (3.9).
1 parent 91c760a commit 39b7550

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/python-lint.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Lint all Python code
4+
5+
# Triggers the workflow on push or pull request events
6+
on:
7+
push:
8+
pull_request:
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
13+
jobs:
14+
# This workflow contains a single job called "pylint"
15+
pylint:
16+
runs-on: ubuntu-latest
17+
continue-on-error: ${{ matrix.experimental }}
18+
# The type of runner that the job will run on
19+
env:
20+
PYTHON_CMD: "python${{ matrix.python-version }}"
21+
PLARGS: "${{ matrix.extra_args }}"
22+
23+
strategy:
24+
matrix:
25+
python-version: ['3.8']
26+
experimental: [false]
27+
extra_args: ['']
28+
include:
29+
- python-version: '3.7'
30+
experimental: true
31+
extra_args: "--disable=not-context-manager"
32+
- python-version: '3.9'
33+
experimental: true
34+
extra_args: "--disable=unsubscriptable-object,inherit-non-class"
35+
36+
# Steps represent a sequence of tasks that will be executed as part of the job
37+
steps:
38+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
39+
- uses: actions/checkout@v2
40+
41+
- name: Checkout submodules
42+
run: git submodule update --init --recursive
43+
44+
- name: Set up Python ${{ matrix.python-version }}
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
49+
- name: Install dependencies
50+
run: |
51+
${PYTHON_CMD} -m pip install --upgrade pip
52+
${PYTHON_CMD} -m pip install wheel pylint
53+
sudo apt install -y libcurl4-openssl-dev
54+
${PYTHON_CMD} -m pip install numpy sympy psutil raven setproctitle cffi \
55+
json-rpc websocket-client nose hexdump matplotlib crcmod tqdm requests \
56+
zmq logentries PyJWT scipy libusb1 SCons Cython jinja2 atomicwrites \
57+
pyserial pyyaml pycapnp smbus2 parameterized pycurl azure-storage-blob==2.1.0 \
58+
dictdiffer
59+
60+
- name: script
61+
run: |
62+
pylint --extension-pkg-whitelist=zmq -j 0 -E --reports=y ${PLARGS} `find ./ -name \*.py | grep -v '^[.]/external' | \
63+
sed 's|[.]/||;s|/.*||' | sort -u`

0 commit comments

Comments
 (0)