Skip to content

Commit 2aff90b

Browse files
Refactor format workflow to use job matrix
1 parent 6d0b15c commit 2aff90b

1 file changed

Lines changed: 24 additions & 54 deletions

File tree

.github/workflows/format.yml

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,29 @@ name: format
33
on: [push, pull_request]
44

55
jobs:
6-
black:
6+
format:
77
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
linter: [black, isort, flake8, mypy]
11+
include:
12+
- linter: black
13+
command: black --check --diff .
14+
- linter: isort
15+
command: isort --check-only --diff .
16+
- linter: flake8
17+
command: flake8 --count .
18+
- linter: mypy
19+
command: mypy .
820
steps:
9-
- uses: actions/checkout@v4
10-
- name: Install uv
11-
uses: astral-sh/setup-uv@v5
12-
- name: Set up Python
13-
uses: actions/setup-python@v5
14-
with:
15-
python-version-file: "pyproject.toml"
16-
- name: Install dependencies
17-
run: uv sync --frozen
18-
- name: Run black check
19-
run: uv run black --check --diff .
20-
isort:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v4
24-
- name: Install uv
25-
uses: astral-sh/setup-uv@v5
26-
- name: Set up Python
27-
uses: actions/setup-python@v5
28-
with:
29-
python-version-file: "pyproject.toml"
30-
- name: Install dependencies
31-
run: uv sync --frozen
32-
- name: Run isort check
33-
run: uv run isort --check-only --diff .
34-
flake8:
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v4
38-
- name: Install uv
39-
uses: astral-sh/setup-uv@v5
40-
- name: Set up Python
41-
uses: actions/setup-python@v5
42-
with:
43-
python-version-file: "pyproject.toml"
44-
- name: Install dependencies
45-
run: uv sync --frozen
46-
- name: Run flake8 check
47-
run: uv run flake8 --count .
48-
mypy:
49-
runs-on: ubuntu-latest
50-
steps:
51-
- uses: actions/checkout@v4
52-
- name: Install uv
53-
uses: astral-sh/setup-uv@v5
54-
- name: Set up Python
55-
uses: actions/setup-python@v5
56-
with:
57-
python-version-file: "pyproject.toml"
58-
- name: Install dependencies
59-
run: uv sync --frozen
60-
- name: Run mypy check
61-
run: uv run mypy .
21+
- uses: actions/checkout@v4
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version-file: "pyproject.toml"
28+
- name: Install dependencies
29+
run: uv sync --frozen
30+
- name: Run ${{ matrix.linter }} check
31+
run: uv run ${{ matrix.command }}

0 commit comments

Comments
 (0)