|
| 1 | +name: Linting |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + |
| 7 | +jobs: |
| 8 | + lint-flake8: |
| 9 | + name: Linting with flake8 |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - name: Setup Python |
| 14 | + uses: actions/setup-python@v5 |
| 15 | + with: |
| 16 | + python-version: '3.11' |
| 17 | + cache: 'pip' |
| 18 | + cache-dependency-path: | |
| 19 | + requirements.txt |
| 20 | + requirements-dev.txt |
| 21 | + - uses: actions/cache@v4 |
| 22 | + with: |
| 23 | + path: ~/.cache/pip |
| 24 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 25 | + restore-keys: | |
| 26 | + ${{ runner.os }}-pip- |
| 27 | + - name: Install requirements |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + pip install -r requirements-dev.txt |
| 31 | + - name: Lint with flake8 |
| 32 | + run: flake8 --max-line-length=120 . --exclude env,configuration,venv,src,scripts,.venv,e2e |
| 33 | + |
| 34 | + lint-black: |
| 35 | + name: Linting with black |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + - name: Setup Python |
| 40 | + uses: actions/setup-python@v5 |
| 41 | + with: |
| 42 | + python-version: '3.11' |
| 43 | + cache: 'pip' |
| 44 | + cache-dependency-path: | |
| 45 | + requirements.txt |
| 46 | + requirements-dev.txt |
| 47 | + - uses: actions/cache@v4 |
| 48 | + with: |
| 49 | + path: ~/.cache/pip |
| 50 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-pip- |
| 53 | + - name: Install requirements |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install -r requirements-dev.txt |
| 57 | + - name: Lint with black |
| 58 | + run: black flask_utils -l119 --check |
| 59 | + |
| 60 | + lint-imports-order: |
| 61 | + name: Checking imports order |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - name: Setup Python |
| 66 | + uses: actions/setup-python@v5 |
| 67 | + with: |
| 68 | + python-version: '3.11' |
| 69 | + cache: 'pip' |
| 70 | + cache-dependency-path: | |
| 71 | + requirements.txt |
| 72 | + requirements-dev.txt |
| 73 | + - uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + path: ~/.cache/pip |
| 76 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 77 | + restore-keys: | |
| 78 | + ${{ runner.os }}-pip- |
| 79 | + - name: Install requirements |
| 80 | + run: | |
| 81 | + python -m pip install --upgrade pip |
| 82 | + pip install -r requirements-dev.txt |
| 83 | + - name: Lint with reorder-python-imports |
| 84 | + run: reorder-python-imports flask_utils/**/*.py tests/*.py |
| 85 | + |
| 86 | + lint-typing: |
| 87 | + name: Checking Typing with MyPy |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - name: Setup Python |
| 92 | + uses: actions/setup-python@v5 |
| 93 | + with: |
| 94 | + python-version: '3.11' |
| 95 | + cache: 'pip' |
| 96 | + cache-dependency-path: | |
| 97 | + requirements.txt |
| 98 | + requirements-dev.txt |
| 99 | + - uses: actions/cache@v4 |
| 100 | + with: |
| 101 | + path: ~/.cache/pip |
| 102 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 103 | + restore-keys: | |
| 104 | + ${{ runner.os }}-pip- |
| 105 | + - name: Install requirements |
| 106 | + run: | |
| 107 | + python -m pip install --upgrade pip |
| 108 | + pip install -r requirements-dev.txt |
| 109 | + pip install types-flask |
| 110 | + - name: Lint with mypy |
| 111 | + run: mypy flask_utils |
0 commit comments