Skip to content

Added matlab to github actions #138

Added matlab to github actions

Added matlab to github actions #138

name: Run the Casadi tests
on: [pull_request]
env:
BUILD_FOLDER: build
EXAMPLES_FOLDER: examples
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-14-arm64, macos-13, windows-latest]
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_casadi
- os: macos-14-arm64
label: osx-arm64
prefix: /Users/runner/miniconda3/envs/biorbd_casadi
- os: macos-13
label: osx-intel
prefix: /Users/runner/miniconda3/envs/biorbd_casadi
- os: windows-latest
label: win-64
prefix: C:\Miniconda3\envs\biorbd_casadi
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_casadi
environment-file: environment_casadi.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: Build biorbd UNIX
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_casadi
mkdir -p $BIORBD_FOLDER/$BUILD_FOLDER
cd $BIORBD_FOLDER/$BUILD_FOLDER
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DMATH_LIBRARY_BACKEND="Casadi" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DMODULE_ACTUATORS=ON -DMODULE_KALMAN=ON -DMODULE_MUSCLES=ON -DBUILD_EXAMPLE=ON -DBINDER_PYTHON3=ON ..
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_casadi_tests
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
- name: Test installed version on UNIX
run: |
BIORBD_FOLDER=`pwd`
CONDA_ENV_PATH=$CONDA/envs/biorbd_casadi
cd $BIORBD_FOLDER/$EXAMPLES_FOLDER/cpp_casadi_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_casadi
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER
cmake -G"Visual Studio 17 2022" -Ax64 -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DMATH_LIBRARY_BACKEND="Casadi" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DMODULE_ACTUATORS=ON -DMODULE_PASSIVE_TORQUES=ON -DMODULE_KALMAN=ON -DMODULE_MUSCLES=ON -DBUILD_EXAMPLE=ON -DBINDER_PYTHON3=ON ..
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_casadi_tests.exe .
./biorbd_casadi_tests.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_casadi
cd $BIORBD_FOLDER/$EXAMPLES_FOLDER/cpp_casadi_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_casadi"
cd $BIORBD_FOLDER