-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (75 loc) · 2.47 KB
/
lint-python.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
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Lint Python
on:
push:
branches:
- main
- develop
paths:
- "**.py"
- "**.pyi"
- ".github/workflows/lint-python.yml"
- "scripts/requirements*.txt"
pull_request:
branches:
- main
- develop
paths:
- "**.py"
- "**.pyi"
- ".github/workflows/lint-python.yml"
- "scripts/requirements*.txt"
env:
# https://help.pythonanywhere.com/pages/ChangingSystemImage/#available-python-versions-for-system-images
python-version: "3.10"
# https://help.pythonanywhere.com/pages/ChangingSystemImage/#base-ubuntu-version-for-each-system-image
# runs-on: "ubuntu-20.04"
jobs:
# Jobs that don't need dependencies installed
ruff:
runs-on: "ubuntu-20.04"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install ruff
- run: ruff check .
add-trailing-comma:
runs-on: "ubuntu-20.04"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements-dev.txt"
- run: pip install add-trailing-comma
- run: add-trailing-comma $(git ls-files '**.py*') --py36-plus
# Jobs that do need dependencies installed
Pyright:
runs-on: "ubuntu-20.04"
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- name: Install dependencies
run: |
pip install wheel
pip install -r "scripts/requirements-dev.txt"
- run: mv backend/configs.template.py backend/configs.py
- uses: jakebailey/pyright-action@v1
with:
working-directory: backend/
extra-args: --warnings