-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 1.86 KB
/
python-ci.yml
File metadata and controls
61 lines (58 loc) · 1.86 KB
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
name: python-ci (reusable)
on:
workflow_call:
inputs:
python-versions:
description: 'JSON array of Python versions for the test matrix.'
required: false
type: string
default: '["3.13"]'
lint-tools:
description: 'Space-separated tools to install via uv tool install. Default: ruff black mypy.'
required: false
type: string
default: 'ruff black mypy'
lint-paths:
description: 'Paths to lint with black --check and ruff check.'
required: false
type: string
default: 'src tests'
sync-extras:
description: 'Extras passed to uv sync (e.g. dev,docs). Default: dev.'
required: false
type: string
default: 'dev'
test-command:
description: 'Test command. Default: uv run pytest.'
required: false
type: string
default: 'uv run pytest'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
- name: uv sync
run: uv sync --extra ${{ inputs.sync-extras }}
- name: Test
run: ${{ inputs.test-command }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.13"
- name: Install latest linting tools
run: uv tool install --upgrade ${{ inputs.lint-tools }}
- name: black --check
run: uv tool run black --check ${{ inputs.lint-paths }}
- name: ruff check
run: uv tool run ruff check ${{ inputs.lint-paths }}