Skip to content

Commit

Permalink
Add GitHub action to lint python code. Only takes a minute or
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
sobomax committed Dec 17, 2020
1 parent 91c760a commit 39b7550
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This is a basic workflow to help you get started with Actions

name: Lint all Python code

# Triggers the workflow on push or pull request events
on:
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "pylint"
pylint:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
# The type of runner that the job will run on
env:
PYTHON_CMD: "python${{ matrix.python-version }}"
PLARGS: "${{ matrix.extra_args }}"

strategy:
matrix:
python-version: ['3.8']
experimental: [false]
extra_args: ['']
include:
- python-version: '3.7'
experimental: true
extra_args: "--disable=not-context-manager"
- python-version: '3.9'
experimental: true
extra_args: "--disable=unsubscriptable-object,inherit-non-class"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
${PYTHON_CMD} -m pip install --upgrade pip
${PYTHON_CMD} -m pip install wheel pylint
sudo apt install -y libcurl4-openssl-dev
${PYTHON_CMD} -m pip install numpy sympy psutil raven setproctitle cffi \
json-rpc websocket-client nose hexdump matplotlib crcmod tqdm requests \
zmq logentries PyJWT scipy libusb1 SCons Cython jinja2 atomicwrites \
pyserial pyyaml pycapnp smbus2 parameterized pycurl azure-storage-blob==2.1.0 \
dictdiffer
- name: script
run: |
pylint --extension-pkg-whitelist=zmq -j 0 -E --reports=y ${PLARGS} `find ./ -name \*.py | grep -v '^[.]/external' | \
sed 's|[.]/||;s|/.*||' | sort -u`

0 comments on commit 39b7550

Please sign in to comment.