Skip to content

Commit

Permalink
Added matlab to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pariterre committed Aug 13, 2024
1 parent cf6037f commit 81963c5
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 62 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/push_matlab_eigen_binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Publish MATLAB binaries

on:
release:
types: [published]

env:
BUILD_FOLDER: build
EXAMPLES_FOLDER: examples

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-13-arm64, macos-13, windows-latest]
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_eigen
- os: macos-13-arm64
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
if: matrix.label != 'osx-arm64'

- name: Install MATLAB on MACOS-arm64
uses: matlab-actions/setup-matlab@v2
with:
release: R2023a
if: matrix.label == 'osx-arm64'

- name: Build biorbd on UNIX
run: |
MAIN_FOLDER=`pwd`
cd
HOME=`pwd`
cd $MAIN_FOLDER
CONDA_ENV_PATH=$CONDA/envs/biorbd_eigen
mkdir -p $MAIN_FOLDER/$BUILD_FOLDER
cd $MAIN_FOLDER/$BUILD_FOLDER
cmake -DCMAKE_INSTALL_PREFIX=$CONDA_ENV_PATH -DMATH_LIBRARY_BACKEND="Eigen3" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DMODULE_ACTUATORS=ON -DMODULE_KALMAN=ON -DMODULE_PASSIVE_TORQUES=ON -DMODULE_MUSCLES=ON -DBINDER_MATLAB=ON -DMatlab_biorbd_INSTALL_DIR=$HOME ..
make install -j${{ steps.cpu-cores.outputs.count }}
cd $MAIN_FOLDER
if: matrix.label != 'win-64'

- name: Build biorbd on WINDOWS
run: |
MAIN_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_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DBUILD_DOC=OFF -DBUILD_EXAMPLE=OFF -DMODULE_ACTUATORS=ON -DMODULE_KALMAN=ON -DMODULE_MUSCLES=ON -DBINDER_MATLAB=ON -DMatlab_biorbd_INSTALL_DIR=$HOME ..
cmake --build . --config Release --target install -j${{ steps.cpu-cores.outputs.count }}
cd $MAIN_FOLDER
if: matrix.label == 'win-64'

- name: Build MATLAB archives on UNIX
run: |
cp -r $HOME/biorbd_matlab .
zip -r biorbd_matlab_${{ matrix.label }}.zip biorbd_matlab
if: matrix.label != 'win-64'

- name: Build MATLAB archives on WINDOWS
run: |
7z a biorbd_matlab_${{ matrix.label }}.zip $HOME/biorbd_matlab
if: matrix.label == 'win-64'

- name: Upload files to a GitHub release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "biorbd_eigen_matlab_${{ matrix.label }}.zip"
update_latest_release: true
verbose: true
overwrite: true
13 changes: 9 additions & 4 deletions .github/workflows/run_casadi_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-14-arm64, macos-13, windows-latest]
include:
- os: ubuntu-20.04
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_casadi
- os: macos-latest
label: osx-64
- 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
Expand All @@ -26,7 +30,8 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_codecoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_eigen
name: ${{ matrix.label }}
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/run_eigen_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-13-arm64, macos-13, windows-latest]
include:
- os: ubuntu-20.04
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/biorbd_eigen
- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/biorbd_casadi
- os: macos-13-arm64
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
Expand All @@ -26,7 +30,8 @@ jobs:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
Expand All @@ -51,20 +56,30 @@ jobs:
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
if: matrix.label != 'osx-arm64'

- name: Install MATLAB on MACOS-arm64
uses: matlab-actions/setup-matlab@v2
with:
release: R2023a
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 ..
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_INSTALL_DIR=$HOME ..
make install -j${{ steps.cpu-cores.outputs.count }}
cd $BIORBD_FOLDER
if: matrix.label != 'win-64'
Expand Down Expand Up @@ -104,7 +119,7 @@ jobs:
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 ..
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_INSTALL_DIR=$HOME ..
cmake --build . --config Release --target install -j${{ steps.cpu-cores.outputs.count }}
cd $BIORBD_FOLDER
if: matrix.label == 'win-64'
Expand Down Expand Up @@ -154,3 +169,8 @@ jobs:
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
Loading

0 comments on commit 81963c5

Please sign in to comment.