lightning/.github/workflows/code-formatting.yml

77 lines
1.8 KiB
YAML
Raw Normal View History

name: "Check Code Format"
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
jobs:
imports-check-isort:
name: Check valid import formatting with isort
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install isort
run: pip install isort==5.6.4
- name: Run isort
run: isort --settings-path=./pyproject.toml --check-only --diff .
format-check-yapf:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade pip
pip install yapf
pip list
shell: bash
- name: yapf
run: yapf --diff --parallel --recursive .
python-pep8:
name: Python formatting PEP8
2020-10-19 20:20:17 +00:00
runs-on: ubuntu-20.04
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
pip install flake8
- name: Run checking
run: |
flake8 .
2020-10-19 20:20:17 +00:00
python-typing-mypy:
name: Python typing check [mypy]
2020-10-19 20:20:17 +00:00
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
2020-10-19 20:20:17 +00:00
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install mypy
2020-10-19 20:20:17 +00:00
run: |
pip install mypy==0.790
pip list
- name: mypy check
2020-10-19 20:20:17 +00:00
run: |
mypy