Skip to content

Commit b682722

Browse files
committed
Add a linting workflow
1 parent 9273444 commit b682722

File tree

2 files changed

+72
-21
lines changed

2 files changed

+72
-21
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@ env:
1616
FORCE_COLOR: "1"
1717

1818
jobs:
19-
# We only need to lint once, not for _each_ python version
20-
lint:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v4
25-
- name: Set up Python
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: "3"
29-
- name: Install pip
30-
run: python -m pip install --upgrade pip
31-
32-
- name: Install pre-commit
33-
run: pip install pre-commit
34-
35-
- name: Lint
36-
run: |
37-
pre-commit run --all-files -v --show-diff-on-failure
38-
pre-commit gc
39-
4019
test:
4120
runs-on: ubuntu-latest
4221

.github/workflows/lint.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Lint source code
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
env:
16+
FORCE_COLOR: "1"
17+
18+
jobs:
19+
ruff:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3"
28+
- name: Install pip
29+
run: python -m pip install --upgrade pip
30+
31+
- name: Install Ruff
32+
run: python -m pip install "ruff==0.5.2"
33+
34+
- name: Lint with Ruff
35+
run: ruff check . --output-format github
36+
37+
- name: Format with Ruff
38+
run: ruff format . --diff
39+
40+
mypy:
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3"
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
python -m pip install ".[lint,test]"
53+
- name: Type check with mypy
54+
run: mypy
55+
56+
twine:
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Set up Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: "3"
65+
- name: Install dependencies
66+
run: |
67+
python -m pip install --upgrade pip
68+
python -m pip install --upgrade twine build
69+
- name: Lint with twine
70+
run: |
71+
python -m build .
72+
twine check dist/*

0 commit comments

Comments
 (0)