-
Notifications
You must be signed in to change notification settings - Fork 35
433 lines (374 loc) · 18.2 KB
/
continuous-integration.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
name: opensim-application
on:
schedule:
- cron: '0 2 * * *'
pull_request:
branches:
- '*'
push:
branches:
- main
tags:
- '*'
jobs:
windows:
name: Windows
runs-on: windows-2019
steps:
- name: Checkout opensim-gui
uses: actions/checkout@v3
- name: Install SWIG
run: |
choco install swig --version 4.1.1 --yes --limit-output --allow-downgrade
swig -swiglib
- name: Install Python packages
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install NumPy
run: python3 -m pip install numpy==1.25
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Install Netbeans 12.3
# Make sure the NetBeans installer is not corrupted.
run: |
(New-Object System.Net.WebClient).DownloadFile("https://archive.apache.org/dist/netbeans/netbeans/12.3/Apache-NetBeans-12.3-bin-windows-x64.exe", "Apache-NetBeans-12.3-bin-windows-x64.exe")
$expectedHash = "0695d87d9c72dcf3738672ba83eb273dda02066fa5eee80896cb6ccf79175840367a13d22ab3cb9838dffaa9a219dd1f73aee0e27c085e5310da2e3bbbc92b2c"
$hashFromFile = Get-FileHash -Algorithm SHA512 -Path .\Apache-NetBeans-12.3-bin-windows-x64.exe
if (($hashFromFile.Hash) -ne ($expectedHash)) { Write-Error "Hash doesn't match." }
.\Apache-NetBeans-12.3-bin-windows-x64.exe --silent | Out-Null # This installer is gregarious.
echo "ANT_HOME=C:\\Program Files\\NetBeans-12.0\\netbeans\\extide\\ant" >> $GITHUB_ENV
- name: Checkout opensim-core main
uses: actions/checkout@v3
with:
repository: opensim-org/opensim-core
path: 'opensim-core'
- name: Cache opensim-core-dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/opensim_dependencies_install
# Every time a cache is created, it's stored with this key.
# In subsequent runs, if the key matches the key of an existing cache,
# then the cache is used. We chose for this key to depend on the
# operating system and a hash of the hashes of all files in the
# dependencies directory (non-recursive).
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-dependencies-${{ hashFiles('opensim-core/dependencies/*') }}
- name: Build opensim-core-dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
echo $env:GITHUB_WORKSPACE\\build_deps
mkdir $env:GITHUB_WORKSPACE\\build_deps
chdir $env:GITHUB_WORKSPACE\\build_deps
# gci -r $env:GITHUB_WORKSPACE\\opensim-core
# /W0 disables warnings. The other flags are copied from CMake's
# default CMAKE_CXX_FLAGS.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
$env:CXXFLAGS = "/W0"
cmake $env:GITHUB_WORKSPACE/opensim-core/dependencies -G"Visual Studio 16 2019" -A x64 -DSUPERBUILD_ezc3d:BOOL=on -DOPENSIM_WITH_CASADI:BOOL=on -DWIG_DIR=C:/ProgramData/chocolatey/lib/swig -DOPENSIM_WITH_TROPTER:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install
cmake . -LAH
cmake --build . --config Release -- /maxcpucount:2
- name: Obtain opensim-core commit
id: opensim-core-commit
run: |
cd opensim-core
$opensim_core_commit=(git rev-parse HEAD)
echo "hash=$opensim_core_commit" >> $GITHUB_OUTPUT
- name: Cache opensim-core
id: cache-core
uses: actions/cache@v3
with:
path: ~/opensim-core-install
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }}
- name: Build opensim-core
# if: steps.cache-core.outputs.cache-hit != 'true'
run: |
echo $env:GITHUB_WORKSPACE\\build_core
mkdir $env:GITHUB_WORKSPACE\\build_core
chdir $env:GITHUB_WORKSPACE\\build_core
$env:CXXFLAGS = "/W0"
cmake $env:GITHUB_WORKSPACE/opensim-core -G"Visual Studio 16 2019" -A x64 -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DPython3_ROOT_DIR=C:/hostedtoolcache/windows/Python/3.10.11/x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install
cmake . -LAH
cmake --build . --config Release -- /maxcpucount:2
cmake --install .
- name: Update submodules
run: git submodule update --init --recursive -- opensim-models opensim-visualizer Gui/opensim/threejs
- name: Build GUI
id: build-gui
run: |
mkdir build
cd build
cmake ../ -G"Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=C:/Program Files/NetBeans-12.3/netbeans;-Dnbplatform.default.harness.dir=C:/Program Files/NetBeans-12.3/netbeans/harness"
cmake --build . --target CopyOpenSimCore --config Release
cmake --build . --target CopyModels --config Release
cmake --build . --target PrepareInstaller --config Release
cmake --build . --target CopyJRE --config Release
cmake --build . --target CopyVisualizer --config Release
# Read the value of the cache variable storing the GUI build version.
$env:match = cmake -L . | Select-String -Pattern OPENSIMGUI_BUILD_VERSION
$VERSION = $env:match.split('=')[1]
echo $VERSION
echo "name=VERSION::$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $env:GITHUB_OUTPUT
- name: Build GUI installer
run: |
cd Gui/opensim/dist/installer
makensis.exe make_installer.nsi
mv OpenSim-${{ steps.build-gui.outputs.version }}-win64.exe $env:GITHUB_WORKSPACE
- name: Upload GUI installer
uses: actions/upload-artifact@v3
with:
name: OpenSim-${{ steps.build-gui.outputs.version }}-win64
path: OpenSim-${{ steps.build-gui.outputs.version }}-win64.exe
mac:
name: Mac12
runs-on: macos-12
steps:
- name: Checkout opensim-gui
uses: actions/checkout@v3
- name: Checkout opensim-core main
uses: actions/checkout@v3
with:
repository: opensim-org/opensim-core
path: 'opensim-core'
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: symbolic link to python so GUI can find it
run: |
# sudo ln -s /Users/runner/hostedtoolcache/Python/3.8.18/x64/bin/python /usr/bin/python
- name: Install packages
run: |
brew install cmake pkgconfig autoconf libtool automake wget pcre doxygen llvm
brew reinstall gcc
pip3 install numpy==1.25
gfortran -v
mkdir gfortran_version
gfortran -v &> gfortran_version/gfortran_version.txt
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
# - name: Setup tmate session to debug the workflow through SSH.
# uses: mxschmitt/action-tmate@v2
- name: Install NetBeans 12.3
# `brew cask install netbeans-java-se` requires sudo but brew won't allow sudo,
# so we install NetBeans ourselves.
# Note: Cask 'netbeans' gives version 11.2, while 'netbeans-java-se' gives 8.2.
run: |
# We remove JDKs newer than 8 to force the NetBeans installer to use JDK 8.
# If using JDK 14, the NetBeans installer fails because it cannot find unpack200,
# which was removed from the JDK. See:
# https://netbeans.apache.org/download/nb113/nb113.html
# "The installers will NOT run under JDK 14 because usage is made of the Pack200
# Tools and API, for packing and unpacking, which is removed in JDK 14, see JEP 367."
sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-14.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-13.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-12.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-11.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk
/usr/libexec/java_home -V
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo $JAVA_HOME
wget https://archive.apache.org/dist/netbeans/netbeans/12.3/Apache-NetBeans-12.3-bin-macosx.dmg
hdiutil attach Apache-NetBeans-12.3-bin-macosx.dmg
sudo installer -pkg /Volumes/Apache\ NetBeans\ 12.3/Apache\ NetBeans\ 12.3.pkg -target /
sudo -k
- name: Cache opensim-core-dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/opensim_dependencies_install
# Every time a cache is created, it's stored with this key.
# In subsequent runs, if the key matches the key of an existing cache,
# then the cache is used. We chose for this key to depend on the
# operating system and a hash of the hashes of all files in the
# dependencies directory (non-recursive).
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-dependencies-${{ hashFiles('opensim-core/dependencies/*') }}
- name: Build opensim-core-dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
mkdir build_deps
cd build_deps
cmake ../opensim-core/dependencies -DSUPERBUILD_ezc3d:BOOL=on -DOPENSIM_WITH_CASADI:BOOL=on -DOPENSIM_WITH_TROPTER:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DCMAKE_BUILD_TYPE=Release
cmake . -LAH
cmake --build . --config Release
- name: Obtain opensim-core commit
id: opensim-core-commit
run: |
cd opensim-core
opensim_core_commit=$(git rev-parse HEAD)
echo "hash=$opensim_core_commit" >> $GITHUB_OUTPUT
- name: Cache opensim-core
id: cache-core
uses: actions/cache@v3
with:
path: ~/opensim-core-install
key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }}
- name: Install SWIG
if: steps.cache-swig.outputs.cache-hit != 'true'
run: |
mkdir ~/swig-source && cd ~/swig-source
wget https://github.com/swig/swig/archive/refs/tags/v4.1.1.tar.gz
tar xzf v4.1.1.tar.gz && cd swig-4.1.1
sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache
make && make -j4 install
- name: Build opensim-core
if: steps.cache-core.outputs.cache-hit != 'true'
run: |
mkdir build_core
cd build_core
cmake ../opensim-core -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DSWIG_EXECUTABLE=~/swig/bin/swig -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_INSTALL_UNIX_FHS=OFF -DOPENSIM_DISABLE_LOG_FILE=ON
cmake . -LAH
cmake --build . --config Release
cmake --install .
- name: Update submodules
run: git submodule update --init --recursive -- opensim-models opensim-visualizer Gui/opensim/threejs
- name: Build GUI
id: build-gui
run: |
mkdir build
cd build
# TODO: Do not hard-code NetBeans version.
# TODO: Could download from https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-macosx.dmg
# cmake ../ -DCMAKE_PREFIX_PATH=~/opensim-core -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=/Applications/NetBeans/Apache NetBeans 12.3.app/Contents/Resources/NetBeans/netbeans;-Dnbplatform.default.harness.dir=/Applications/NetBeans/Apache NetBeans 12.3.app/Contents/Resources/NetBeans/netbeans/harness"
cmake ../ -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=/Applications/NetBeans/Apache NetBeans 12.3.app/Contents/Resources/NetBeans/netbeans;-Dnbplatform.default.harness.dir=/Applications/NetBeans/Apache NetBeans 12.3.app/Contents/Resources/NetBeans/netbeans/harness"
make CopyOpenSimCore
make PrepareInstaller
# Read the value of the cache variable storing the GUI build version.
VERSION=`cmake -L . | grep OPENSIMGUI_BUILD_VERSION | cut -d "=" -f2`
echo $VERSION
echo "name=VERSION::$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
cd $GITHUB_WORKSPACE
ls Gui/opensim/dist
mv Gui/opensim/dist/OpenSim-$VERSION.pkg $GITHUB_WORKSPACE
- name: Upload GUI installer
uses: actions/upload-artifact@v3
with:
name: OpenSim-${{ steps.build-gui.outputs.version }}-mac
path: OpenSim-${{ steps.build-gui.outputs.version }}.pkg
ubuntu:
name: Ubuntu2004
runs-on: ubuntu-20.04
steps:
- name: Checkout opensim-gui
uses: actions/checkout@v3
- name: Checkout opensim-core main
uses: actions/checkout@v3
with:
repository: opensim-org/opensim-core
path: 'opensim-core'
- name: Install Python packages
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install NumPy
run: python3 -m pip install numpy==1.25
- name: Install packages
run: sudo apt-get update && sudo apt-get install --yes liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen gfortran-7
- name: Install SWIG
if: steps.cache-swig.outputs.cache-hit != 'true'
run: |
mkdir ~/swig-source && cd ~/swig-source
wget https://github.com/swig/swig/archive/refs/tags/v4.1.1.tar.gz
tar xzf v4.1.1.tar.gz && cd swig-4.1.1
sh autogen.sh && ./configure --prefix=$HOME/swig --disable-ccache
make && make -j4 install
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Cache Netbeans
id: cache-netbeans
uses: actions/cache@v3
with:
path: ~/netbeans-12.3
key: netbeans-12.3
- name: Download and Install Netbeans
if: steps.cache-netbeans.outputs.cache-hit != 'true'
run: |
wget -q https://archive.apache.org/dist/netbeans/netbeans/12.3/Apache-NetBeans-12.3-bin-linux-x64.sh
chmod 755 Apache-NetBeans-12.3-bin-linux-x64.sh
./Apache-NetBeans-12.3-bin-linux-x64.sh --silent
ls $HOME/netbeans-12.3
- name: Cache opensim-core-dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/opensim_dependencies_install
# Every time a cache is created, it's stored with this key.
# In subsequent runs, if the key matches the key of an existing cache,
# then the cache is used. We chose for this key to depend on the
# operating system and a hash of the hashes of all files in the
# dependencies directory (non-recursive).
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-dependencies-${{ hashFiles('opensim-core/dependencies/*') }}
- name: Build opensim-core-dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
mkdir build_deps
cd build_deps
cmake ../opensim-core/dependencies -DSUPERBUILD_ezc3d:BOOL=on -DOPENSIM_WITH_CASADI:BOOL=on -DOPENSIM_WITH_TROPTER:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install
cmake . -LAH
cmake --build . --config Release
- name: Obtain opensim-core commit
id: opensim-core-commit
run: |
cd opensim-core
opensim_core_commit=$(git rev-parse HEAD)
echo "hash=$opensim_core_commit" >> $GITHUB_OUTPUT
- name: Cache opensim-core
id: cache-core
uses: actions/cache@v3
with:
path: ~/opensim-core-install
key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }}
- name: Build opensim-core
if: steps.cache-core.outputs.cache-hit != 'true'
run: |
mkdir build_core
cd build_core
cmake ../opensim-core -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_INSTALL_UNIX_FHS=OFF -DSWIG_DIR=~/swig/share/swig -DSWIG_EXECUTABLE=~/swig/bin/swig
cmake . -LAH
cmake --build . --config Release
cmake --install .
- name: Remove opensim-core and swig
run: |
rm -rf ~/swig-source
rm -rf ~/work/opensim-gui/opensim-gui/build_core
- name: Update submodules
run: git submodule update --init --recursive -- opensim-models opensim-visualizer Gui/opensim/threejs
- name: Build GUI
id: build-gui
run: |
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=$HOME/netbeans-12.3/netbeans;-Dnbplatform.default.harness.dir=$HOME/netbeans-12.3/netbeans/harness"
make CopyOpenSimCore
make PrepareInstaller
# Read the value of the cache variable storing the GUI build version.
VERSION=`cmake -L . | grep OPENSIMGUI_BUILD_VERSION | cut -d "=" -f2`
echo $VERSION
echo "name=VERSION::$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
cd $GITHUB_WORKSPACE
ls Gui/opensim/dist
mv Gui/opensim/dist/OpenSim-$VERSION.tar.gz $GITHUB_WORKSPACE
- name: Upload GUI installer
uses: actions/upload-artifact@v3
with:
name: OpenSim-${{ steps.build-gui.outputs.version }}-ub20-linux
path: OpenSim-${{ steps.build-gui.outputs.version }}.tar.gz