-
Notifications
You must be signed in to change notification settings - Fork 1
312 lines (292 loc) · 11.2 KB
/
build-test-gha-branches.yml
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
# WARNING: There is a lot of duplication between .yml workflows because I don't know (yet) how
# to factorize these workflows. Keep things in sync.
name: Test building on GitHub Actions
on:
push:
branches:
- test-gha/*
jobs:
make-source-dist:
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: pip3 install build twine
- name: Get the code
uses: actions/checkout@v4
- name: Build the source distribution
run: python3 -m build --sdist
- name: Check the source distribution
run: twine check dist/*
- name: Upload the source distribution to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: source-dist
path: dist
# build-for-linux:
# runs-on: ubuntu-20.04
# needs:
# - make-source-dist
# strategy:
# matrix:
# python_version: ['3.8', '3.13']
# steps:
# - name: Install Python
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python_version }}
# - name: Install Python packages
# run: pip${{ matrix.python_version }} install build auditwheel twine Chrones
# - name: Install CUDA
# run: |
# sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
# sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
# sudo apt-get update
# sudo apt-get install --yes --no-install-recommends cuda-cudart-dev-12-1 cuda-nvcc-12-1
# echo "/usr/local/cuda-12.1/bin" >>$GITHUB_PATH
# - name: Install Boost
# run: |
# cd /home/runner/work
# wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
# tar xf boost_*.tar.gz
# rm boost_*.tar.gz
# cd boost_*
# sudo cp -r boost /usr/local/include
# - name: Install OR-Tools
# run: |
# cd /home/runner/work
# wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_amd64_ubuntu-20.04_cpp_v9.11.4210.tar.gz
# tar xf or-tools_*.tar.gz
# rm or-tools_*.tar.gz
# cd or-tools_*
# sudo cp -r include/* /usr/local/include
# sudo cp -r lib/* /usr/local/lib
# sudo ldconfig
# - name: Install patchelf
# run: |
# cd /home/runner/work
# mkdir patchelf
# cd patchelf
# wget https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz
# tar xf *.tar.gz
# sudo cp bin/patchelf /usr/local/bin
# - name: Dowload the source distribution from GitHub Actions artifacts
# uses: actions/download-artifact@v4
# with:
# name: source-dist
# - name: Unzip the source distribution
# run: |
# tar xf *.tar.gz
# rm *.tar.gz
# - name: Build the wheel
# run: python${{ matrix.python_version }} -m build --wheel --outdir local-dist lincs-*
# env:
# LINCS_DEV_FORCE_NVCC: "true"
# LINCS_DEV_FORCE_CHRONES: "true"
# - name: Make the wheel machine-independent
# run: auditwheel repair --plat manylinux_2_31_x86_64 --strip local-dist/*.whl --wheel-dir dist
# - name: Check the wheel
# run: twine check dist/*.whl
# - name: Upload the wheel to GitHub Actions artifacts
# uses: actions/upload-artifact@v4
# with:
# name: wheel-dist-${{ matrix.python_version }}-linux
# path: dist
build-for-windows:
runs-on: windows-2019
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8']
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip install build delvewheel twine
- name: Install CUDA
uses: Jimver/[email protected]
id: cuda-toolkit
with:
cuda: '12.1.0'
use-github-cache: false
use-local-cache: false
method: network
# Package names from https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#id2
sub-packages: '["nvcc", "cudart"]'
- name: Install MSys2
uses: msys2/setup-msys2@v2
with:
update: true
msystem: UCRT64
install: >-
gzip
tar
unzip
wget
- name: Install boost
shell: msys2 {0}
run: |
cd /d/a
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
mv boost_* boost
cd boost
mkdir -p /d/lincs-deps/include /d/lincs-deps/lib
cp -r boost /d/lincs-deps/include
- name: Install OR-Tools
shell: msys2 {0}
run: |
cd /d/a
wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_x64_VisualStudio2022_cpp_v9.11.4210.zip
unzip or-tools_*.zip
rm or-tools_*.zip
cd or-tools_*
sed -i 's/#define ABSL_OPTION_USE_STD_ORDERING 1/#define ABSL_OPTION_USE_STD_ORDERING 0/' include/absl/base/options.h
cp -r include/* /d/lincs-deps/include
cp -r lib/* /d/lincs-deps/lib
- name: Dowload the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
- name: Unzip the source distribution
shell: msys2 {0}
run: |
tar xf *.tar.gz
rm *.tar.gz
- name: Build the wheel
run: python -m build --wheel --outdir local-dist (get-item lincs-*)
env:
LINCS_DEV_FORCE_NVCC: "true"
LINCS_DEV_DEPENDENCIES: d:\lincs-deps
- name: Make the wheel machine-independent
run: delvewheel repair --strip (get-item local-dist\*.whl) --wheel-dir dist --add-path d:\lincs-deps\lib
- name: Check the wheel
run: twine check (get-item dist\*.whl)
- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-windows
path: dist
# build-for-macos:
# runs-on: macos-13
# needs:
# - make-source-dist
# strategy:
# matrix:
# python_version: ['3.8', '3.13']
# env:
# MACOSX_DEPLOYMENT_TARGET: 12.0
# steps:
# - name: Install Python
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python_version }}
# - name: Install Python packages
# run: pip3 install build delocate twine
# - name: Install OpenMP
# run: |
# cd /Users/runner/work
# mkdir openmp
# cd openmp
# wget https://mac.r-project.org/openmp/openmp-16.0.4-darwin20-Release.tar.gz
# tar xf *.tar.gz
# sudo cp usr/local/lib/* /usr/local/lib
# sudo cp usr/local/include/* /usr/local/include
# - name: Install Boost
# run: |
# cd /Users/runner/work
# wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
# tar xf boost_*.tar.gz
# rm boost_*.tar.gz
# cd boost_*
# sudo cp -r boost /usr/local/include
# - name: Install OR-Tools
# run: |
# cd /Users/runner/work
# wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_x86_64_macOS-14.6.1_cpp_v9.11.4210.tar.gz
# tar xf or-tools_x86_64_*.tar.gz
# rm or-tools_x86_64_*.tar.gz
# wget https://github.com/google/or-tools/releases/download/v9.11/or-tools_arm64_macOS-14.6.1_cpp_v9.11.4210.tar.gz
# tar xf or-tools_arm64_*.tar.gz
# rm or-tools_arm64_*.tar.gz
# sudo cp -r or-tools_arm64_*/include/* /usr/local/include
# lipo or-tools*/lib/libortools.9.11.dylib -output /usr/local/lib/libortools.9.11.dylib -create
# cd /usr/local/lib
# ln -s libortools.9.11.dylib libortools.9.dylib
# ln -s libortools.9.dylib libortools.dylib
# - name: Dowload the source distribution from GitHub Actions artifacts
# uses: actions/download-artifact@v4
# with:
# name: source-dist
# - name: Unzip the source distribution
# run: |
# tar xf *.tar.gz
# rm *.tar.gz
# - name: Build the wheel
# run: python3 -m build --wheel --outdir local-dist lincs-*
# - name: Make the wheel machine-independent
# run: delocate-wheel --wheel-dir dist local-dist/*.whl
# - name: Check the wheel
# run: twine check dist/*.whl
# - name: Upload the wheel to GitHub Actions artifacts
# uses: actions/upload-artifact@v4
# with:
# name: wheel-dist-${{ matrix.python_version }}-macos
# path: dist
check:
runs-on: ${{ matrix.os }}
needs:
# - build-for-linux
- build-for-windows
# - build-for-macos
strategy:
fail-fast: false
matrix:
os:
# - ubuntu-20.04
# - ubuntu-22.04
# - ubuntu-24.04
# - windows-2019
- windows-2022
# - macos-12
# - macos-13
# - macos-14
# - macos-15
python_version: ['3.8']
exclude:
# Older Python versions don't build 'universal2' wheels, so they can't run on the M1 runner that run macOS 14 and 15
- os: macos-14
python_version: '3.8'
- os: macos-15
python_version: '3.8'
- os: macos-14
python_version: '3.9'
- os: macos-15
python_version: '3.9'
- os: macos-14
python_version: '3.10'
- os: macos-15
python_version: '3.10'
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
# DO NOT install any other dependencies, to test that the wheels are self-contained
- name: Download the wheels from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
pattern: wheel-dist-${{ matrix.python_version }}-*
merge-multiple: true
- name: Install the wheel
run: pip${{ matrix.python_version }} install --find-links . --pre lincs
- name: Run lincs
run: lincs --help
- run: lincs generate classification-problem 3 2 --output-problem problem.yml
- run: lincs generate classification-model problem.yml --output-model model.yml
- run: lincs generate classified-alternatives problem.yml model.yml 100 --output-alternatives learning-set.csv
- run: lincs learn classification-model problem.yml learning-set.csv --output-model learned-model.yml
- run: lincs classification-accuracy problem.yml learned-model.yml learning-set.csv