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

73 lines
2.2 KiB
YAML

name: "Check Code Format"
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
jobs:
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-types:
name: Python static type checking with Pyright
runs-on: ubuntu-18.04
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-extras-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/extra.txt') }}
restore-keys: |
${{ runner.os }}-pip-extras-
- name: Install dependencies
run: |
# python -m pip install --upgrade --user pip
pip install --requirement requirements/base.txt --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --quiet
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install --requirement ./requirements/devel.txt --quiet
# pip install tox coverage
python --version ; pip --version ; pip list
shell: bash
- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Install pyright
run: |
npm install pyright
- name: Run type checking
run: |
$(npm bin)/pyright --project .pyrightconfig.json