Skip to content

Commit 836c72f

Browse files
committed
ci(py): split lint and test jobs across platforms
1 parent e216c8c commit 836c72f

File tree

1 file changed

+31
-29
lines changed
  • template/py/{{cookiecutter.project_slug}}/.github/workflows

1 file changed

+31
-29
lines changed

template/py/{{cookiecutter.project_slug}}/.github/workflows/ci.yml

+31-29
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,45 @@ on:
77
pull_request:
88
workflow_dispatch:
99

10-
{% raw %}
1110
jobs:
12-
build-and-test:
13-
name: python-${{ matrix.os }}
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up UV Environment
18+
uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "latest"
21+
22+
- name: Format Code
23+
run: uvx ruff format --diff .
24+
25+
- name: Lint Code
26+
run: uvx ruff check .
1427

28+
build-and-test:
29+
runs-on: {{ "${{ matrix.os }}" }}
1530
strategy:
1631
matrix:
17-
os:
18-
- ubuntu-latest
19-
- windows-latest
20-
- macos-latest
21-
32+
os: [ubuntu-latest, macos-latest, windows-latest]
2233
fail-fast: false
2334

24-
runs-on: ${{ matrix.os }}
25-
2635
steps:
27-
- uses: actions/checkout@v4
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
2838

29-
- name: Set up uv
30-
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
31-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
39+
- name: Set up UV Environment
40+
uses: astral-sh/setup-uv@v3
41+
with:
42+
version: "latest"
3243

33-
- name: Set up uv
34-
if: ${{ matrix.os == 'windows-latest' }}
35-
run: irm https://astral.sh/uv/install.ps1 | iex
36-
shell: powershell
44+
- name: Synchronize Dependencies
45+
run: uv sync
3746

38-
- name: Format
39-
run: uvx ruff format --diff .
40-
41-
- name: Lint
42-
run: uvx ruff check .
47+
- name: Build Project
48+
run: uvx hatch build
4349

44-
- name: Build & Test
45-
run: |
46-
uv sync
47-
uvx hatch build
48-
uvx hatch test
49-
{% endraw -%}
50+
- name: Run Tests
51+
run: uvx hatch test

0 commit comments

Comments
 (0)