forked from xx979xx/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |