2020-06-27 01:38:25 +00:00
|
|
|
name: "Check Code Format"
|
2020-06-12 18:37:52 +00:00
|
|
|
on:
|
|
|
|
# Trigger the workflow on push or pull request,
|
|
|
|
# but only for the master branch
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-06-03 16:23:14 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-06-27 01:38:25 +00:00
|
|
|
code-black:
|
2020-06-03 16:23:14 +00:00
|
|
|
name: Check code formatting with Black
|
2020-06-27 20:25:33 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-06-03 16:23:14 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-06-27 01:38:25 +00:00
|
|
|
- name: Set up Python 3.8
|
|
|
|
uses: actions/setup-python@v2
|
2020-06-03 16:23:14 +00:00
|
|
|
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
|
2020-06-27 01:38:25 +00:00
|
|
|
|
|
|
|
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
|
2020-06-30 14:56:05 +00:00
|
|
|
pip install -r requirements/base.txt -U -f https://download.pytorch.org/whl/torch_stable.html --quiet
|
|
|
|
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./requirements/devel.txt --quiet
|
2020-06-27 01:38:25 +00:00
|
|
|
# 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
|