Skip to content

Commit

Permalink
Add MATLAB Tests CI
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Mar 1, 2022
1 parent 446c845 commit 97e0afb
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/matlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: MATLAB Tests CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

jobs:
build-matlab-tests:
name: '[matlab:${{ matrix.matlab_version }}:${{ matrix.os }}]'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
build_type: [Release]
os: [ubuntu-20.04, windows-2019, macos-10.15]
matlab_version: [R2020a, R2020b, R2021a, latest]
exclude:
# R2020* is not supported on Windows on GitHub Actions
- os: windows-2019
matlab_version: R2020a
build_type: Release
- os: windows-2019
matlab_version: R2020b
build_type: Release

steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge,robotology

- name: Setup MATLAB
uses: matlab-actions/setup-matlab@v1
with:
release: ${{ matrix.matlab_version }}

# workaround for https://github.com/robotology/robotology-superbuild/issues/64
- name: Do not use MATLAB's stdc++ to avoid incompatibilities with other libraries
if: contains(matrix.os, 'ubuntu')
run:
echo 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6' >> $GITHUB_ENV

- name: Dependencies
run: |
# Workaround for https://github.com/conda-incubator/setup-miniconda/issues/186
conda config --remove channels defaults
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install osqp
# Just a trick to make sure that the relevant installation path are on MATLABPATH
mamba install -c conda-forge -c robotology idyntree-matlab-bindings
# Additional dependencies useful only on Windows
- name: Dependencies [Conda/Windows]
if: contains(matrix.os, 'windows')
run: |
# Additional dependencies only useful on Windows
# See https://github.com/robotology/robotology-superbuild/issues/477
mamba install vs2019_win-64
- name: Print used environment [Conda]
shell: bash -l {0}
run: |
mamba list
env
- name: Configure [Conda - Linux or macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
run: |
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Configure [Conda - Windows]
if: contains(matrix.os, 'windows')
run: |
mkdir build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Build
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test
run: |
cd build
# Only run matlab tests as the rest of tests are already run by other jobs
ctest --output-on-failure -C ${{ matrix.build_type }} -R "matlab" -VV .

0 comments on commit 97e0afb

Please sign in to comment.