-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (173 loc) · 6.29 KB
/
Copy pathci.yml
File metadata and controls
183 lines (173 loc) · 6.29 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# CI pipeline for the Convert Python SDK (Story 5.1, qs-02 / qs-03 / qs-09).
#
# Job graph (fail-fast lint/type-check before the matrix):
# pr-title (PR-only, independent)
# lint -> type-check -> test (15-cell matrix) -> build
# \-> bounds-check (lower/upper)
#
# All dependency resolution uses `uv` (never `pip install -e .`).
#
# WORKFLOW-NAME COUPLING (LOAD-BEARING): the `name: CI` below must match
# release.yml's `workflow_run.workflows` value EXACTLY ("CI"). Renaming either
# side silently breaks releases — `workflow_run` would never fire. release.yml
# carries the mirror comment.
name: CI
on:
push:
branches: [main]
pull_request:
# Cancel superseded runs on the same ref to keep the matrix under the merge ceiling.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# Pin the uv version for reproducible CI resolution.
UV_VERSION: "0.10.11"
jobs:
pr-title:
name: PR title (Conventional Commits)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Validate PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
# Dependency-free Conventional Commits check (squash-merge-only repo:
# the squash commit subject is the PR title).
if ! echo "$PR_TITLE" | grep -qE '^(feat|fix|docs|test|refactor|perf|build|ci|chore)(\(.+\))?!?: .+'; then
echo "::error::PR title must follow Conventional Commits: '$PR_TITLE'"
echo "Expected: <type>(<scope>)?!?: <description>"
echo "Allowed types: feat, fix, docs, test, refactor, perf, build, ci, chore"
exit 1
fi
echo "PR title OK: $PR_TITLE"
lint:
name: Ruff lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install 3.13
- name: Sync dev environment
run: uv sync --group dev
- name: Ruff lint
run: uv run ruff check src tests scripts demo
type-check:
name: mypy --strict
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install 3.13
- name: Sync dev environment
run: uv sync --group dev
- name: Check generated .pyi header markers
run: uv run python scripts/check_generated_pyi_header.py
- name: mypy strict
run: uv run mypy --strict
- name: mypy strict (serving_config contract probe)
run: uv run mypy --strict typecheck/serving_config_contract.py
test:
name: test (py${{ matrix.python-version }} / ${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: type-check
strategy:
fail-fast: false
matrix:
# 15-cell matrix: Python 3.9-3.13 x {ubuntu, macos, windows} (qs-02).
# Do NOT trim cells — NFR22 mandates the full CPython matrix.
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Sync dev environment
run: uv sync --group dev --python ${{ matrix.python-version }}
- name: Run tests with coverage (project floor 85%)
run: >-
uv run pytest -p no:cacheprovider
--cov=convert_sdk --cov-report=term-missing --cov-fail-under=85
- name: Enforce evaluation/ coverage floor (95%)
run: >-
uv run coverage report
--include='*/convert_sdk/evaluation/*' --fail-under=95
bounds-check:
name: bounds-check (${{ matrix.bound }})
runs-on: ubuntu-latest
needs: type-check
strategy:
fail-fast: false
matrix:
# Lower bound: oldest declared deps (httpx==0.28.0) on the oldest Python.
# Upper bound: newest compatible deps on the newest Python (qs-09).
include:
- bound: lower
python-version: "3.9"
- bound: upper
python-version: "3.13"
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Sync dev environment (lower bound — apply override constraints)
if: matrix.bound == 'lower'
run: >-
uv sync --group dev --python ${{ matrix.python-version }}
--resolution lowest-direct
- name: Pin runtime deps to declared lower bounds
if: matrix.bound == 'lower'
run: uv pip install --constraint ci/lower-bounds-overrides.txt httpx
- name: Sync dev environment (upper bound — newest compatible)
if: matrix.bound == 'upper'
run: >-
uv sync --group dev --python ${{ matrix.python-version }}
--upgrade
- name: Run unit + integration suite (parity covered elsewhere)
run: >-
uv run pytest -p no:cacheprovider --ignore=tests/parity
build:
name: build (wheel + sdist)
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Set up Python
run: uv python install 3.13
- name: Build distributions
run: uv build
- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
if-no-files-found: error