-
Notifications
You must be signed in to change notification settings - Fork 10
98 lines (94 loc) · 2.7 KB
/
Copy pathci.yml
File metadata and controls
98 lines (94 loc) · 2.7 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
name: CI
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
jobs:
build:
runs-on: ubuntu-latest
env:
JAX_PLATFORM_NAME: cpu
UV_CACHE_DIR: /tmp/.uv-cache
JAX_COMPILATION_CACHE_DIR: /tmp/jax_cache
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache uv
uses: actions/cache@v5
with:
path: /tmp/.uv-cache
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Cache JAX compilation
uses: actions/cache@v5
with:
path: /tmp/jax_cache
key: ${{ runner.os }}-jax-${{ github.sha }}
restore-keys: |
${{ runner.os }}-jax-
- name: Install dependencies
env:
UV_SYSTEM_PYTHON: 1
run: |
pip install uv
if [ "${{ matrix.python-version }}" == "3.10" ]; then
uv pip install -e ".[dev]" ruff mypy
else
uv pip install -e ".[dev]"
fi
- name: Lint with ruff
if: matrix.python-version == '3.10'
env:
UV_SYSTEM_PYTHON: 1
run: |
ruff check src
- name: Type check with mypy
if: matrix.python-version == '3.10'
env:
UV_SYSTEM_PYTHON: 1
run: |
mypy src/cbfkit || true
- name: Test with pytest
run: |
pytest -m "not slow" tests
- name: Test slow tests
if: matrix.python-version == '3.10'
env:
CBFKIT_TEST_MODE: "1"
run: |
pytest -m "slow" tests
core-import:
name: Slim-core import (no extras)
runs-on: ubuntu-latest
env:
JAX_PLATFORM_NAME: cpu
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install core only (no extras)
run: pip install .
- name: Assert the default import surface stays lean
run: |
python - <<'PY'
import sys
import cbfkit
from cbfkit.controllers.cbf_clf import vanilla_cbf_clf_qp_controller
from cbfkit.optimization.quadratic_program import get_solver
get_solver("fast")
get_solver("jaxopt")
heavy = {"casadi", "cvxopt", "kvxopt", "plotly"}
leaked = sorted(m for m in sys.modules if m.split(".")[0] in heavy)
assert not leaked, f"Heavy optional deps leaked into the default import: {leaked}"
print("OK: default import surface is lean (no casadi/cvxopt/plotly).")
PY