-
Notifications
You must be signed in to change notification settings - Fork 937
57 lines (50 loc) · 1.72 KB
/
linter_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Linter Tests
# This workflow is triggered on pushes to the repository or external PRs.
on: [push, pull_request]
jobs:
lint:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'facebookresearch/mmf'
strategy:
fail-fast: false
max-parallel: 3
matrix:
lint: ['flake8', 'ufmt']
runs-on: ubuntu-latest
steps:
- name: Checkout branch 🛎️
uses: actions/checkout@v2
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: mmf
python-version: 3.7
auto-update-conda: true
use-only-tar-bz2: true
- name: Install Dependencies
shell: bash -l {0}
run: |
conda activate mmf
python -m pip install --upgrade pip
pip install --progress-bar off flake8==3.7.9
pip install --progress-bar off ufmt==2.0.1
pip install --progress-bar off usort==1.0.5
pip install --progress-bar off black==22.12.0
- name: Run linter
shell: bash -l {0}
if: matrix.lint == 'flake8'
run: |
conda activate mmf
flake8 --version
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=88 --statistics
- name: Run linter
shell: bash -l {0}
if: matrix.lint == 'ufmt'
run: |
conda activate mmf
ufmt --version
ufmt check .