| name: code-format | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| schedule: | |
| - cron: "0 4 * * *" | |
| jobs: | |
| linter: | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install dependencies | |
| run: | | |
| pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
| pip install -r requirements/dev.txt | |
| python setup.py develop --user | |
| - name: Run linter | |
| run: make lint | |
| static-check: | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install dependencies | |
| run: | | |
| pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
| pip install -r requirements/dev.txt | |
| python setup.py develop --user | |
| - name: Run mypy | |
| run: make mypy | |
| doctest: | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install dependencies | |
| run: | | |
| pip install torch --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
| pip install -r requirements/dev.txt | |
| python setup.py develop --user | |
| - name: Run doctest | |
| run: make doctest | |
| pre-commit-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: actions/setup-python@v2 | |
| - name: set PY | |
| run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
| - uses: actions/cache@v2 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - uses: pre-commit/action@v2.0.2 | |
| # this action also provides an additional behaviour when used in private repositories | |
| # when configured with a github token, the action will push back fixes to the pull request branch | |
| # with: | |
| # token: ${{ secrets.GITHUB_TOKEN }} | |