-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 2.47 KB
/
lint-python.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
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
102
103
104
105
---
name: Lint Python
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- '**/serox/**'
- .github/workflows/lint-python.yaml
- pyproject.toml
pull_request:
branches:
- main
paths:
- '**/serox/**'
- .github/workflows/lint-python.yaml
- pyproject.toml
types:
- opened
- synchronize
- reopened
- ready_for_review
env:
# Do not produce debug symbols to keep memory usage down
RUSTFLAGS: -C debuginfo=0
jobs:
# Lint with ruff
ruff-lint:
name: Lint with ruff
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python runtime
uses: ./.github/actions/setup-python
- name: Lint with ruff
run: rye lint -a
# Check formatting with ruff
ruff-fmt:
name: Check formatting with ruff
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python runtime
uses: ./.github/actions/setup-python
- name: Lint with ruff
run: rye fmt --check -a
# Lint docstrings
pydoclint:
name: Lint docstrings with pydoclint
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python runtime
uses: ./.github/actions/setup-python
- name: Install pydoclint
run: |
rye sync --no-lock --with-sources
- name: Lint docstrings with pydoclint
run: rye run lint-doc
# Type checking with pyright
# Note that rust is required to build the Pyo3 bindings with maturin;
# this building is done automatically by `rye sync`.
pyright:
name: Type-checking with Pyright
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
needs: [ruff-lint, ruff-fmt, pydoclint]
strategy:
fail-fast: true
matrix:
rust-toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python runtime
uses: ./.github/actions/setup-python
- name: Sync dependencies
run: rye sync --no-lock --all-features --with-sources
- name: Run pyright with rye
run: rye run pyright