-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (122 loc) · 4.4 KB
/
Copy pathci.yml
File metadata and controls
148 lines (122 loc) · 4.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
name: CI
on:
push:
branches: [main, "dev/**", "feature/**", "fix/**"]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# -------------------------------------------------------------------------
# 1. Lint / static checks (fast, no deps)
# -------------------------------------------------------------------------
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install lint tools
run: pip install ruff
- name: Ruff check (syntax and undefined names)
run: ruff check metbit/ tests/ --select E9,F63,F7,F82
# -------------------------------------------------------------------------
# 2. Test matrix (Linux/macOS, Python 3.10-3.14, with C extension)
# -------------------------------------------------------------------------
test:
name: "Test Python ${{ matrix.python-version }} on ${{ matrix.os }}"
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
exclude:
# macOS arm64 runner only reliably supports 3.11+
- os: macos-latest
python-version: "3.10"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install libomp (macOS — required by XGBoost)
if: runner.os == 'macOS'
run: brew install libomp
- name: Install build tools + dev deps
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
- name: Build and install with C extension
run: |
python setup.py build_ext --inplace
pip install -e . --no-build-isolation
- name: Run test suite (no slow/perf tests)
run: |
pytest -q --no-header \
-m "not slow and not perf" \
--cov=metbit \
--cov-report=term-missing \
--cov-report=xml:coverage.xml \
--junitxml=test-results.xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: false
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}
path: test-results.xml
# -------------------------------------------------------------------------
# 3. Verify the C extension builds on Windows too
# -------------------------------------------------------------------------
build-windows:
name: Build C ext on Windows
needs: lint
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tools
run: python -m pip install --upgrade pip setuptools wheel
- name: Build extension (without OpenMP on Windows)
run: python setup.py build_ext --inplace
- name: Install package runtime dependencies
run: pip install -e . --no-build-isolation
- name: Smoke test import
run: python -c "import metbit; print(metbit.__version__); print(metbit.backend_info())"
# -------------------------------------------------------------------------
# 4. Verify sdist can be installed clean (no in-tree sources)
# -------------------------------------------------------------------------
sdist-install:
name: sdist install check
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build sdist
run: |
pip install build
python -m build --sdist
- name: Install from sdist in clean venv
run: |
python -m venv /tmp/clean-venv
/tmp/clean-venv/bin/pip install dist/*.tar.gz
/tmp/clean-venv/bin/python -c "import metbit; print(metbit.__version__)"