-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (93 loc) · 2.98 KB
/
lint.yml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Lint
on:
push:
branches:
- develop
# - master
# - staging
# - releases/*
pull_request:
branches: [develop, master]
types: [synchronize, opened, reopened, ready_for_review]
defaults:
run:
shell: bash
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
name: check files
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
lint: ${{ steps.changes.outputs.lint }}
docker: ${{ steps.changes.outputs.docker_base }}
steps:
- run: git config --global --add safe.directory $(realpath .)
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- id: changes
name: Check for backend file changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
flake8:
needs: changes
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && needs.changes.outputs.lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install requirements
run: pip install flake8 pycodestyle
- name: Check syntax
# Stop the build if there are Python syntax errors or undefined names
run: flake8 src/ --count --statistics --max-line-length=127
- name: Warnings
run: flake8 src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --extend-exclude=""
isort:
needs: changes
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && needs.changes.outputs.lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install requirements
run: pip install isort
- name: iSort
run: isort src/ --check-only
black:
needs: changes
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && needs.changes.outputs.lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install requirements
run: pip install black
- name: Black
run: black src/ --check
bandit:
needs: changes
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && needs.changes.outputs.lint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Install requirements
run: pip install bandit
- name: bandit
run: bandit src/