Skip to content

Commit bdeb7d4

Browse files
Lint and format workflow
1 parent a7c8425 commit bdeb7d4

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Lint and format
2+
# https://docs.github.com/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python?langId=py#requirements-file
3+
4+
on:
5+
pull_request:
6+
types: [opened, edited, ready_for_review, synchronize]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
13+
steps:
14+
- name: Check out the code
15+
uses: actions/checkout@v4
16+
17+
# Setup Python (faster than using Python container)
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
id: setup-python
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Cache uv folder
25+
id: cache-uv
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.cache/uv
29+
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-uv-${{ hashFiles('requirements-common.txt', 'requirements-dev.txt') }}
30+
31+
- name: Install uv
32+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
33+
34+
- name: Install dependencies
35+
run: uv pip install --system -r requirements-dev.txt
36+
37+
- name: Cache .ruff_cache folder
38+
id: ruff_cache
39+
uses: actions/cache@v4
40+
with:
41+
path: .ruff_cache
42+
key: ruff_cache-${{ github.head_ref }}
43+
44+
- name: Lint and check formating with ruff
45+
run: |
46+
ruff check --output-format=github
47+
ruff format --check
48+
49+
- name: Cache .mypy_cache folder
50+
id: mypy_cache
51+
uses: actions/cache@v4
52+
with:
53+
path: .mypy_cache
54+
key: mypy_cache-${{ github.head_ref }}
55+
56+
- name: Type checking using mypy
57+
run: mypy .

0 commit comments

Comments
 (0)