-
Notifications
You must be signed in to change notification settings - Fork 45
180 lines (159 loc) · 6.12 KB
/
run_eigen_tests.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
name: Run the Eigen tests
on: [pull_request]
env:
BUILD_FOLDER: build
EXAMPLES_FOLDER: examples
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_eigen
# - os: macos-latest
# label: osx-arm64
# prefix: /Users/runner/miniconda3/envs/biorbd_eigen
- os: macos-13
label: osx-intel
prefix: /Users/runner/miniconda3/envs/biorbd_eigen
- os: windows-latest
label: win-64
prefix: C:\Miniconda3\envs\biorbd_eigen
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: biorbd_eigen
environment-file: environment_eigen.yml
- name: Print mamba info
run: |
mamba info
mamba list
- name: Setup Linux dependencies
run: |
sudo apt update
sudo apt install libstdc++-11-dev
if: matrix.label == 'linux-64'
- name: Install extra common dependencies
run: |
mamba install cmake git pkgconfig swig pytest -cconda-forge
mamba list
git submodule update --init --recursive
- name: Install MATLAB on WINDOWS, LINUX and MACOS-Intel
uses: matlab-actions/setup-matlab@v2
with:
cache: true
if: matrix.label != 'osx-arm64'
- name: Install MATLAB on MACOS-Arm64
uses: matlab-actions/setup-matlab@v2
with:
# The version of MATLAB of R2024a does not contain MX_LIBRARY
release: R2023a
cache: true
if: matrix.label == 'osx-arm64'
- name: Build biorbd UNIX
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_eigen
mkdir -p $BIORBD_FOLDER/$BUILD_FOLDER
cd $BIORBD_FOLDER/$BUILD_FOLDER
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DMATH_LIBRARY_BACKEND="Eigen3" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DMODULE_ACTUATORS=ON -DMODULE_KALMAN=ON -DMODULE_PASSIVE_TORQUES=ON -DMODULE_MUSCLES=ON -DBUILD_EXAMPLE=ON -DBINDER_C=ON -DBINDER_PYTHON3=ON -DBINDER_MATLAB=ON -DMatlab_biorbd_eigen_INSTALL_DIR=$HOME ..
make install -j${{ steps.cpu-cores.outputs.count }}
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
- name: Run tests UNIX
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test
./biorbd_eigen_tests
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
- name: Run c binder tests UNIX
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test/binding/c
./biorbd_eigen_tests_binding_c
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
- name: Test installed version on UNIX
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_eigen
cd $BIORBD_FOLDER/$EXAMPLES_FOLDER/cpp_eigen_installed
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release ..
make -j${{ steps.cpu-cores.outputs.count }}
./forwardDynamicsExample
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
- name: Build biorbd WINDOWS
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_eigen
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
cmake -G"Visual Studio 17 2022" -Ax64 -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DMATH_LIBRARY_BACKEND="Eigen3" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DMODULE_ACTUATORS=ON -DMODULE_KALMAN=ON -DMODULE_MUSCLES=ON -DBUILD_EXAMPLE=ON -DBINDER_C=ON -DBINDER_PYTHON3=ON -DBINDER_MATLAB=ON -DMatlab_biorbd_eigen_INSTALL_DIR=$HOME ..
cmake --build . --config Release --target install -j${{ steps.cpu-cores.outputs.count }}
cd $BIORBD_FOLDER
if: matrix.label == 'win-64'
- name: Run tests WINDOWS
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test
cp Release/biorbd_eigen_tests.exe .
./biorbd_eigen_tests.exe
cd $BIORBD_FOLDER
if: matrix.label == 'win-64'
- name: Run c binder tests WINDOWS
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test/binding/c
cp Release/biorbd_eigen_tests_binding_c.exe .
./biorbd_eigen_tests_binding_c.exe
cd $BIORBD_FOLDER
if: matrix.label == 'win-64'
- name: Test installed version on WINDOWS
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_eigen
cd $BIORBD_FOLDER/$EXAMPLES_FOLDER/cpp_eigen_installed
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
cmake -G"Visual Studio 17 2022" -Ax64 -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release -j${{ steps.cpu-cores.outputs.count }}
cp Release/forwardDynamicsExample.exe .
./forwardDynamicsExample.exe
cd $BIORBD_FOLDER
if: matrix.label == 'win-64'
- name: Run python binder tests
run: |
BIORBD_FOLDER=`pwd`
cd $BIORBD_FOLDER/$BUILD_FOLDER/test/binding/Python3
pytest .
cd $BIORBD_FOLDER
- name: Test installed version of python
run: |
BIORBD_FOLDER=`pwd`
cd
python -c "import biorbd"
cd $BIORBD_FOLDER
- name: Run MATLAB binder tests
run: |
# We cannot run the tests as we do not have a license.
# At least we know it compiles