-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.29 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
name: Lint
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 10 * * *"
jobs:
lint:
name: Check format and lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[dev]'
- name: Lint the code with ruff
run: |
ruff check
- name: Check formatting with ruff
shell: bash
run: |
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
echo "Checkout code is not clean"
echo "${git_status}"
exit 1
fi
ruff format
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
git diff
echo "ruff recommends the changes above, please manually apply them OR automatically apply the changes "
echo "by running `ruff format` to format the following files"
echo "${git_status}"
exit 1
else
echo "PASSED Python format"
fi