2022-02-02 19:48:15 +00:00
|
|
|
name: Code check
|
2021-07-12 18:28:35 +00:00
|
|
|
|
|
|
|
on: # Trigger the workflow on push or pull request, but only for the master branch
|
|
|
|
push:
|
|
|
|
branches: [master, "release/*"]
|
|
|
|
pull_request:
|
|
|
|
branches: [master, "release/*"]
|
|
|
|
|
2022-02-02 19:48:15 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
|
|
|
|
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
|
|
|
|
|
2021-07-12 18:28:35 +00:00
|
|
|
jobs:
|
2021-11-10 16:59:10 +00:00
|
|
|
mypy:
|
2021-07-12 18:28:35 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-03-11 09:20:47 +00:00
|
|
|
#strategy:
|
|
|
|
# fail-fast: false
|
|
|
|
# matrix:
|
|
|
|
# include:
|
|
|
|
# - {python-version: "3.8", pytorch-version: "1.8"}
|
|
|
|
# - {python-version: "3.9", pytorch-version: "1.10"}
|
2021-07-12 18:28:35 +00:00
|
|
|
steps:
|
2022-03-11 09:20:47 +00:00
|
|
|
- uses: actions/checkout@master
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
# python-version: ${{ matrix.python-version }}
|
|
|
|
python-version: 3.9
|
|
|
|
|
|
|
|
# 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
|
2022-05-12 13:14:18 +00:00
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/base.txt') }}
|
2022-03-11 09:20:47 +00:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
env:
|
|
|
|
# TORCH_VERSION: ${{ matrix.pytorch-version }}
|
|
|
|
TORCH_VERSION: "1.10"
|
|
|
|
run: |
|
|
|
|
pip install "torch==$TORCH_VERSION" --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
|
|
|
# adjust versions according installed Torch version
|
|
|
|
python ./requirements/adjust-versions.py requirements/extra.txt
|
|
|
|
python ./requirements/adjust-versions.py requirements/examples.txt
|
|
|
|
pip install '.[dev]' --upgrade-strategy only-if-needed --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
|
|
|
|
pip list
|
|
|
|
|
|
|
|
- name: Type check
|
|
|
|
run: mypy --install-types --non-interactive
|