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

77 lines
1.9 KiB
YAML

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 .
#code-black:
# name: Check code formatting with Black
# 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 Black
# run: pip install black==19.10b0
# - name: Run Black
# run: echo "LGTM"
# run black --skip-string-normalization --config=pyproject.toml --check . # TODO, uncomment
python-pep8:
name: Python formatting PEP8
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 .
python-typing-mypy:
name: Python typing check [mypy]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install mypy
run: |
pip install "mypy==0.790"
pip list
- name: mypy check
run: |
mypy