-
Notifications
You must be signed in to change notification settings - Fork 6
426 lines (404 loc) · 14.4 KB
/
Copy pathci.yml
File metadata and controls
426 lines (404 loc) · 14.4 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
name: CI
on:
push:
branches:
- "pull-request/[0-9]+"
- main
tags:
# GitHub tag globs are not regexes. This catches CompileIQ package
# release-looking tags such as v1.0.0, v1.0.0rc5, and v1.0.0dev1.
- "v[0-9]*.[0-9]*.[0-9]*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Linter Check
runs-on: ubuntu-latest
timeout-minutes: 10
env:
POETRY_VIRTUALENVS_CREATE: "false"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install --only linter
- run: ruff check
typecheck:
name: Pyright Type Check
runs-on: ubuntu-latest
env:
POETRY_VIRTUALENVS_CREATE: "false"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install --with typecheck,tracking,unittest
- run: make typecheck
verify-core:
name: Verify Bundled Core Binaries
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: python -m compileiq.core.verify_core
verify-linux-core-abi:
name: Verify Linux Core ABI
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
lfs: true
- name: Install readelf
run: |
sudo apt-get update
sudo apt-get install -y binutils
- name: Check bundled Linux ELF version requirements
run: python3 dev/check-linux-core-abi.py
unit-test:
# Matrix matches `pyproject.toml`'s `python = ">=3.11,<3.14"` and the
# platforms supported per the run-examples job (Linux x86_64, Windows).
# fail-fast: false so divergence between Python versions or OSes
# surfaces all at once rather than one-at-a-time.
name: Unit tests [py${{ matrix.python }} on ${{ matrix.os }}]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.11", "3.12", "3.13"]
exclude:
# Ray (a hard dependency, see pyproject.toml) does not yet
# publish Windows wheels for Python 3.13 -- "Ray on Windows is
# currently in beta" per upstream, with wheel coverage lagging
# Linux by several months. Until that catches up, skip this
# specific cell. Linux + 3.13 is still exercised below.
- os: windows-latest
python: "3.13"
env:
POETRY_VIRTUALENVS_CREATE: "false"
GIT_PYTHON_REFRESH: "quiet"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install --with unittest,tracking
- run: pytest tests/unit/ -vvv
# ── Test stage ───────────────────────────────────────────────────────────────
integration-test:
# Run the integration tests against every (OS, Python version)
# combination this project claims to support: Linux x86_64 + Windows
# per the run-examples matrix, Python 3.11/3.12/3.13 per
# pyproject.toml's `python = ">=3.11,<3.14"`.
#
# An env-divergent regression in any one cell is caught at PR time
# rather than after the fact downstream. fail-fast: false so all
# cells report regardless of any single failure.
name: Integration tests (with coverage) [py${{ matrix.python }} on ${{ matrix.os }}]
runs-on: ${{ matrix.os }}
needs: [lint, typecheck, unit-test]
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.11", "3.12", "3.13"]
include:
# Known broken: test_single_objective_min flakiness (gen-0
# dedup collision, ~24% rate on any Python; Python 3.13's RNG
# sequence happens to hit the collision more readily).
# Tracked: https://github.com/NVIDIA/CompileIQ/issues/17
# Remove this `include` entry + the matching `continue-on-error`
# gate when issue #17 closes.
- os: ubuntu-latest
python: "3.13"
known_broken: true
exclude:
# Ray (a hard dependency, see pyproject.toml) does not yet
# publish Windows wheels for Python 3.13 -- "Ray on Windows is
# currently in beta" per upstream, with wheel coverage lagging
# Linux by several months. Until that catches up, skip this
# specific cell. Linux + 3.13 is still exercised below.
- os: windows-latest
python: "3.13"
env:
POETRY_VIRTUALENVS_CREATE: "false"
GIT_PYTHON_REFRESH: "quiet"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install --with unittest,tracking
- name: Run tests with coverage
continue-on-error: ${{ matrix.known_broken || false }}
run: |
pytest tests/unit/ -vvv --cov --durations=10
pytest tests/integration/ -vvv --cov --cov-append --durations=10
coverage report
fuzz-test:
# Fuzz tests run Linux-only on PR. The Windows fuzz cells were
# the dominant cost on the broadened matrix (~27 min each) and
# their failure modes are predominantly Hypothesis-driven
# algorithmic edge cases that surface identically on Linux. The
# full {Linux, Windows} matrix runs nightly with deeper
# exploration via .github/workflows/nightly.yml -- see AGENTS.md
# ("Default max_examples=20; set CIQ_FUZZ_EXAMPLES=100 for
# thorough runs (nightly CI does this)").
name: Fuzz tests [py${{ matrix.python }} on ${{ matrix.os }}]
runs-on: ${{ matrix.os }}
needs: [lint, typecheck, unit-test]
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11", "3.12", "3.13"]
env:
POETRY_VIRTUALENVS_CREATE: "false"
GIT_PYTHON_REFRESH: "quiet"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install --with unittest,tracking
- name: Run fuzz tests
run: pytest tests/fuzz/ -vvv --durations=10
run-examples:
name: Run examples (${{ matrix.name }})
runs-on: ${{ matrix.os }}
needs: [lint, typecheck, unit-test]
timeout-minutes: 20
strategy:
matrix:
include:
- os: ubuntu-latest
name: Linux x86_64
- os: ubuntu-24.04-arm
name: Linux ARM64
- os: windows-latest
name: Windows
env:
POETRY_VIRTUALENVS_CREATE: "false"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install
- name: Run examples
working-directory: examples
shell: bash
run: |
for python_file in *.py; do
if [[ "${python_file}" != "ciq_xgboost.py" ]] && \
[[ "${python_file}" != "mlflow_tracker.py" ]]; then
echo "${python_file}"
python "${python_file}"
fi
done
validate-binary-ss:
name: Validate Binary Search Spaces
runs-on: ubuntu-latest
needs: [lint, typecheck, unit-test]
timeout-minutes: 10
env:
POETRY_VIRTUALENVS_CREATE: "false"
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- run: pip install poetry
- run: poetry install
- name: Run Binary SS Validation
working-directory: tests/compiler_ss
run: python validate_binary.py
smoke-test-wheel-matrix:
name: Select smoke test wheel matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
name: Choose platforms for this ref
shell: bash
run: |
python3 <<'PY'
import json
import os
linux_x86 = {
"os": "ubuntu-latest",
"name": "Linux x86_64",
"platform_dir": "linux/x86_64",
"wheel_platform": "manylinux_2_34_x86_64",
"artifact_name": "compileiq-wheel-linux-x86_64",
}
release_platforms = [
linux_x86,
{
"os": "ubuntu-24.04-arm",
"name": "Linux aarch64",
"platform_dir": "linux/aarch64",
"wheel_platform": "manylinux_2_34_aarch64",
"artifact_name": "compileiq-wheel-linux-aarch64",
},
{
"os": "windows-latest",
"name": "Windows amd64",
"platform_dir": "win32/amd64",
"wheel_platform": "win_amd64",
"artifact_name": "compileiq-wheel-windows-amd64",
},
]
ref = os.environ["GITHUB_REF"]
full_matrix = ref == "refs/heads/main" or ref.startswith("refs/tags/v")
platforms = release_platforms if full_matrix else [linux_x86]
print("Selected smoke test wheel platforms:")
for platform in platforms:
print(f"- {platform['name']} ({platform['wheel_platform']})")
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
output.write(f"matrix={json.dumps({'include': platforms})}\n")
PY
build-and-smoke-test-wheel:
name: Build and smoke test wheel (${{ matrix.name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: [lint, unit-test, smoke-test-wheel-matrix]
permissions:
contents: read
env:
POETRY_VIRTUALENVS_CREATE: "false"
GIT_PYTHON_REFRESH: "quiet"
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.smoke-test-wheel-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
with:
lfs: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- name: Remove other platform binaries
shell: bash
run: |
python -c "
import shutil, pathlib
target = pathlib.Path('compileiq/core/executable/${{ matrix.platform_dir }}').resolve()
for d in pathlib.Path('compileiq/core/executable').glob('*/*'):
if d.is_dir() and d.resolve() != target:
print(f'Removing {d} as it is not the target platform')
shutil.rmtree(d)
"
- name: Filter core manifest for platform
shell: bash
run: |
python dev/filter-core-manifest.py \
--manifest compileiq/core/executable/core-manifest.json \
--platform "${{ matrix.platform_dir }}"
python -m compileiq.core.verify_core --allow-missing-platforms
- run: python -m pip install poetry wheel
- name: Set version from tag
if: |
startsWith(github.ref, 'refs/tags/v')
shell: bash
run: poetry version "${GITHUB_REF#refs/tags/v}"
- run: poetry build -f wheel
- name: Retag wheel for platform
shell: bash
run: wheel tags --platform-tag ${{ matrix.wheel_platform }} --remove dist/*.whl
- name: Install built wheel
shell: bash
run: python -m pip install --force-reinstall dist/*.whl
- name: Smoke installed wheel
shell: bash
run: |
cd "$RUNNER_TEMP"
python "$GITHUB_WORKSPACE/.github/scripts/smoke_test_compileiq_wheel.py"
- name: Upload smoke-tested wheel artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact_name }}
path: dist/*.whl
if-no-files-found: error
# This job is a work around to make sure that all the checks have passed before we mark the PR as ready for review.
# This is needed because GitHub does not allow us to set a condition on the PR to be marked as ready for review based on the status of the checks.
ci-pass:
name: CI Pass
runs-on: ubuntu-latest
needs: [verify-core, verify-linux-core-abi, integration-test, fuzz-test, run-examples, validate-binary-ss, build-and-smoke-test-wheel]
steps:
- run: echo "All checks passed"
upload-github-release-wheels:
name: Upload wheels to GitHub release
runs-on: ubuntu-latest
needs: [ci-pass, build-and-smoke-test-wheel]
if: |
startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download smoke-tested wheel artifacts
uses: actions/download-artifact@v6
with:
pattern: compileiq-wheel-*
path: dist
merge-multiple: true
- name: List release wheel assets
run: ls -l dist
# Uploads the smoke-tested wheel artifacts to the draft GitHub Release for this tag.
- uses: softprops/action-gh-release@v3
with:
files: dist/*.whl
generate_release_notes: true
name: "CompileIQ ${{ github.ref_name }}"
draft: true