-
Notifications
You must be signed in to change notification settings - Fork 90
435 lines (421 loc) · 13.2 KB
/
build.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
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
427
428
429
430
431
432
433
434
435
name: build
on:
push:
pull_request:
branches: [ master, development ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
source-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: Setup Python
run: python -m pip install --upgrade -r scripts/requirements.txt
- name: Fabricate COCO
run: python scripts/fabricate
- name: Run core unit tests
working-directory: ${{github.workspace}}/code-experiments/test/unit-test/
run: |
cmake -B build .
cmake --build build
ctest --test-dir build
- name: Run core integration tests
working-directory: ${{github.workspace}}/code-experiments/test/integration-test/
run: |
cmake -B build .
cmake --build build
ctest --test-dir build
- name: Build coco-experiment Python package
run: python -m build -s -o dist code-experiments/build/python
- name: Build cocopp Python package
run: python -m build -o dist code-postprocessing/
- name: Archive C source package
uses: actions/upload-artifact@v3
with:
name: dist-c
path: dist/cocoex-c-*.zip
- name: Archive Java source package
uses: actions/upload-artifact@v3
with:
name: dist-java
path: dist/cocoex-java-*.zip
- name: Archive Matlab source package
uses: actions/upload-artifact@v3
with:
name: dist-matlab
path: dist/cocoex-matlab-*.zip
- name: Archive Octave source package
uses: actions/upload-artifact@v3
with:
name: dist-octave
path: dist/cocoex-octave-*.zip
- name: Archive Rust source package
uses: actions/upload-artifact@v3
with:
name: dist-rust
path: dist/cocoex-rust-*.zip
- name: Archive cocoex and cocopp Python source package
uses: actions/upload-artifact@v3
with:
name: dist-python-sdist
path: |
dist/coco_experiment*.tar.gz
dist/cocopp*.tar.gz
python-wheels-build-cocopp:
needs: source-build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Download Python source package
uses: actions/download-artifact@v3
with:
name: dist-python-sdist
- name: Build cocopp wheel
shell: bash
run: python -m pip wheel -w dist/ cocopp-*.tar.gz
- name: Archive Python wheels
uses: actions/upload-artifact@v3
with:
name: dist-python-wheels
path: dist/cocopp*.whl
python-wheels-build-cocoex:
needs: source-build
# This strategy is taken straight from the numpy wheels.yaml CI job
#
# Since we depend on numpy, there's no reason to try and build a binary cocoex wheel
# on platform that don't have a compiled numpy available.
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64]
- [macos-12, macosx_x86_64]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["cp39", "cp310", "cp311", "cp312", "pp39"]
exclude:
# Don't build PyPy 32-bit windows
- buildplat: [windows-2019, win32]
python: "pp39"
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ]
python: "pp39"
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Setup MSVC (32-bit)
if: ${{ matrix.buildplat[1] == 'win32' }}
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: 'x86'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Download Python source package
uses: actions/download-artifact@v3
with:
name: dist-python-sdist
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
- name: Build cocoex wheel
shell: bash
run: python -m cibuildwheel --output-dir dist/ coco_experiment-*.tar.gz
env:
CIBW_PRERELEASE_PYTHONS: True
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
- name: Archive Python wheels
uses: actions/upload-artifact@v3
with:
name: dist-python-wheels
path: dist/coco_experiment*.whl
python-wheels-test:
needs: python-wheels-build-cocoex
strategy:
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64]
- [macos-12, macosx_x86_64]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["3.9", "3.10", "3.11", "3.12"]
exclude:
# Don't build PyPy 32-bit windows
- buildplat: [windows-2019, win32]
python: "3.9"
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ]
python: "3.9"
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/download-artifact@v3
with:
name: dist-python-sdist
path: dist
- uses: actions/download-artifact@v3
with:
name: dist-python-wheels
path: wheels
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Install cocoex
run: python -m pip install --find-links wheels/ coco-experiment
- name: Run cocoex test
shell: bash
run: |
tar xf dist/coco_experiment-*.tar.gz --strip-components=1
python -m pip install pytest pytest-cov
pytest --cov=cocoex test/
python-wheels-example:
needs: [python-wheels-build-cocoex, python-wheels-build-cocopp]
strategy:
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64]
- [macos-12, macosx_x86_64]
- [windows-2019, win_amd64]
- [windows-2019, win32]
python: ["3.9", "3.10", "3.11", "3.12"]
exclude:
# Don't build PyPy 32-bit windows
- buildplat: [windows-2019, win32]
python: "3.9"
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ]
python: "3.9"
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: dist-python-wheels
path: wheels
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Install cocoex and cocopp
run: python -m pip install --find-links wheels/ coco-experiment cocopp
- name: Install scipy for example experiment
run: python -m pip install scipy
- name: Run example experiment
run: python code-experiments/build/python/example/example_experiment2.py
python-lint:
needs: source-build
runs-on: "ubuntu-latest"
steps:
- uses: actions/download-artifact@v3
with:
name: dist-python-sdist
path: dist
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Lint with Ruff
shell: bash
continue-on-error: true
run: |
pip install ruff
tar xf dist/coco_experiment*.tar.gz --strip-components=1
ruff --output-format=github .
cocopp-example:
needs: python-wheels-build-cocopp
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/download-artifact@v3
with:
name: dist-python-wheels
path: wheels
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.version}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Run BBOB postprocessing example
shell: bash
run: |
python -m pip install wheels/cocopp*.whl
python -m cocopp -v AMALGAM\! BIPOP-CMA-ES\!
c-test:
needs: source-build
strategy:
matrix:
# FIXME: Currently fails on windows because of path issues.
#
# Debug and add `windows-latest` back to list at some point.
os: [ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Download C source package
uses: actions/download-artifact@v3
with:
name: dist-c
- name: Unpack
run: unzip cocoex-c-*.zip
- name: Build
working-directory: ${{github.workspace}}/cocoex-c/
run: cmake -B build && cmake --build build
- name: Test
working-directory: ${{github.workspace}}/cocoex-c/
run: ctest --test-dir build
- name: Store reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: c-test-${{matrix.os}}
path: |
**/build/
java-example:
needs: source-build
strategy:
matrix:
# FIXME: Currently fails on windows because of path issues.
#
# Debug and add `windows-latest` back to list at some point.
os: [ubuntu-latest, macos-latest]
java: [11, 17, 21]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Download Java source package
uses: actions/download-artifact@v3
with:
name: dist-java
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Unpack
run: unzip cocoex-java-*.zip
- name: Build
working-directory: ${{github.workspace}}/cocoex-java/
run: cmake -B build && cmake --build build
- name: Experiment
working-directory: ${{github.workspace}}/cocoex-java/
run: java -classpath build/coco.jar -Djava.library.path=build/ ExampleExperiment
- name: Archive Java example experiment results
uses: actions/upload-artifact@v3
with:
name: java-example-${{matrix.os}}
path: cocoex-java/exdata/*
octave-example:
needs: source-build
# FIXME: Should also test on windows and macos
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Install Octave
run: |
sudo apt-get update
sudo apt-get install -y octave liboctave-dev
- name: Download Octave source package
uses: actions/download-artifact@v3
with:
name: dist-octave
- name: Unpack
run: unzip cocoex-octave-*.zip
- name: Build
working-directory: ${{github.workspace}}/cocoex-octave/
run: mkoctfile --verbose --mex cocoCall.c
- name: Experiment
working-directory: ${{github.workspace}}/cocoex-octave/
run: octave --no-gui exampleexperiment.m
- name: Archive Octave example experiment results
uses: actions/upload-artifact@v3
with:
name: octave-example
path: cocoex-octave/exdata/*
rust-test:
if: false # Disabled since we don't have any tests yes
needs: source-build
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Download Rust source package
uses: actions/download-artifact@v3
with:
name: dist-rust
- name: Unpack
run: unzip cocoex-rust-*.zip
- name: Build
working-directory: ${{github.workspace}}/cocoex-rust/
run: cargo build -r
- name: Test
working-directory: ${{github.workspace}}/cocoex-rust/
run: cargo test -r
rust-example:
needs: source-build
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Download Rust source package
uses: actions/download-artifact@v3
with:
name: dist-rust
- name: Unpack
run: unzip cocoex-rust-*.zip
- name: Build
working-directory: ${{github.workspace}}/cocoex-rust/
run: cargo build -r
- name: Example Experiment
working-directory: ${{github.workspace}}/cocoex-rust/
run: cargo run --example example-experiment
- name: Archive Rust example experiment results
uses: actions/upload-artifact@v3
with:
name: rust-example-${{matrix.os}}
path: cocoex-rust/exdata/*