-
Notifications
You must be signed in to change notification settings - Fork 90
248 lines (238 loc) · 7.39 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
name: build
on:
push:
pull_request:
branches: [ master, development ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-source:
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: Configure unit test
working-directory: ${{github.workspace}}/code-experiments/test/unit-test/
run: cmake -B build .
- name: Build unit test
working-directory: ${{github.workspace}}/code-experiments/test/unit-test/
run: cmake --build build
- name: Run unit test
working-directory: ${{github.workspace}}/code-experiments/test/unit-test/
run: ctest --test-dir build
- name: Build cocoex 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 Python source package
uses: actions/upload-artifact@v3
with:
name: dist-python-sdist
path: |
dist/cocoex*.tar.gz
dist/cocopp*.tar.gz
build-python-wheels:
needs: build-source
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.version}}
- name: Download Python source package
uses: actions/download-artifact@v3
with:
name: dist-python-sdist
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Build cocoex wheel
shell: bash
run: python -m pip wheel -w dist/ cocoex-*.tar.gz
- name: Build cocopp wheel
shell: bash
run: python -m pip wheel -w dist/ cocopp-*.tar.gz
- name: Archive Python package
uses: actions/upload-artifact@v3
with:
name: dist-python-wheels
path: dist/*.whl
test-python-wheels:
needs: build-python-wheels
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: ${{matrix.os}}
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.version}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Install cocoex and cocopp
run: pip install --find-links wheels cocoex cocopp
- name: Install scipy for example experiment
run: pip install scipy
- name: Run example experiment
run: python code-experiments/build/python/example/example_experiment2.py
test-c:
needs: build-source
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: test-c-${{matrix.os}}
path: |
**/build/
test-java:
needs: build-source
# FIXME: Should also test on windows and macos
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Download Java source package
uses: actions/download-artifact@v3
with:
name: dist-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: exdata-java
path: cocoex-java/exdata/*
test-octave:
needs: build-source
# 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 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: exdata-octave
path: cocoex-octave/exdata/*
test-rust:
needs: build-source
# FIXME: Should also test on windows and macos
runs-on: ubuntu-latest
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
- name: Experiment
working-directory: ${{github.workspace}}/cocoex-rust/
run: ./target/release/examples/example-experiment
- name: Archive Rust example experiment results
uses: actions/upload-artifact@v3
with:
name: exdata-rust
path: cocoex-rust/exdata/*