73 lines
2.1 KiB
YAML
73 lines
2.1 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-latest
|
|
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@v1
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }}-${{ hashFiles('requirements/extra.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
# python -m pip install --upgrade --user pip
|
|
pip install -r requirements/base.txt -U -f https://download.pytorch.org/whl/torch_stable.html -q
|
|
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./requirements/devel.txt -q
|
|
# 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
|