Repository navigation
196 lines (176 loc) 路 5.62 KB
/
Copy pathworkflow.yml
File metadata and controls
196 lines (176 loc) 路 5.62 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
name: CI/CD
on:
push:
branches: ["**"]
tags: ["*"]
pull_request:
branches: ["**"]
jobs:
cpp_build_and_test:
name: Build & Test C++
runs-on: ubuntu-latest
steps:
- name: Checkout repository code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build build-essential libopenblas-dev
pip install numpy
- name: Configure CMake
working-directory: cpp
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE="$(which python3)"
- name: Build project
working-directory: cpp
run: cmake --build build
- name: Run unit tests
working-directory: cpp/build
run: ctest --output-on-failure
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- run: pip install ruff black
- run: ruff check sgtlearn/
- run: black --check sgtlearn/
python_layer_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- name: Install scikit-learn 1.9+ for exact tree fidelity (3.11+)
if: matrix.python-version != '3.10'
run: pip install "scikit-learn>=1.9"
- run: pytest -v
build-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- run: pip install build
- run: python -m build
docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.12" # matches .readthedocs.yml
# nbsphinx renders the tutorial notebooks and shells out to pandoc.
- run: sudo apt-get update && sudo apt-get install -y pandoc
- run: pip install -r docs/requirements.txt
# -W turns Sphinx warnings (broken refs, malformed docstrings) into
# failures. The native C++ extension is mocked (autodoc_mock_imports),
# so no compiler/CMake is needed here.
- run: sphinx-build -W --keep-going -b html docs docs/_build/html
build_wheels:
name: Build wheels for ${{ matrix.os }}
if: startsWith(github.ref, 'refs/tags/v')
needs: [cpp_build_and_test, lint, python_layer_tests, build-check]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]
steps:
- uses: actions/checkout@v6
with:
submodules: true
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
with:
extras: uv
env:
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_BUILD: "cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "cp36-* cp37-* cp38-* cp39-* cp310-* pp*"
- uses: actions/upload-artifact@v5
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
if: startsWith(github.ref, 'refs/tags/v')
needs: [cpp_build_and_test, lint, python_layer_tests, build-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
persist-credentials: false
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
publish-to-testpypi:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build_wheels, build_sdist]
name: Publish Python 馃悕 distribution 馃摝 to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/sgtlearn
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: actions/download-artifact@v5
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
# Attestations disabled to avoid the Rekor (Sigstore transparency log)
# outage. Set back to true (or remove this line) once Rekor is healthy.
# attestations: false
publish-to-pypi:
if: startsWith(github.ref, 'refs/tags/v')
needs: [publish-to-testpypi]
name: Publish Python 馃悕 distribution 馃摝 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/sgtlearn
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: actions/download-artifact@v5
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
# Attestations disabled to avoid the Rekor (Sigstore transparency log)
# outage. Set back to true (or remove this line) once Rekor is healthy.
# attestations: false