CI Workflow #4406
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Workflow | |
on: | |
push: | |
pull_request: | |
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 * * *' | |
env: | |
YCM_TAG: v0.15.1 | |
YARP_TAG: v3.8.0 | |
ICUB_TAG: v2.1.1 | |
jobs: | |
build-with-conda-dependencies: | |
name: '[conda:${{ matrix.os }}]' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
os: [ubuntu-20.04, macos-12, windows-2019] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Print used environment (no conda) [Conda] | |
shell: bash | |
run: | | |
env | |
- name: Get current week | |
id: week | |
run: echo "week=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}" | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ci_env.yml | |
cache-environment-key: environment-${{ steps.week.outputs.week }} | |
- name: Install files to enable compilation of mex files [Conda/Linux] | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020b_mexa64.zip | |
unzip msdk_R2020b_mexa64.zip | |
rm msdk_R2020b_mexa64.zip | |
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020b_mexa64" >> $GITHUB_ENV | |
echo "GHA_Matlab_MEX_EXTENSION=mexa64" >> $GITHUB_ENV | |
- name: Install files to enable compilation of mex files [Conda/macOS] | |
if: contains(matrix.os, 'macos') | |
run: | | |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020a_mexmaci64.zip | |
unzip msdk_R2020a_mexmaci64.zip | |
rm msdk_R2020a_mexmaci64.zip | |
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020a_mexmaci64" >> $GITHUB_ENV | |
echo "GHA_Matlab_MEX_EXTENSION=mexmaci64" >> $GITHUB_ENV | |
- name: Install files to enable compilation of mex files [Conda/Windows] | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020a_mexw64.zip | |
unzip msdk_R2020a_mexw64.zip | |
rm msdk_R2020a_mexw64.zip | |
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020a_mexw64" >> $GITHUB_ENV | |
echo "GHA_Matlab_MEX_EXTENSION=mexw64" >> $GITHUB_ENV | |
- name: Configure VS Toolchain (Windows) | |
if: contains(matrix.os, 'windows') | |
uses: ilammy/[email protected] | |
- name: Setup compilation env variables [Conda/Windows] | |
if: contains(matrix.os, 'windows') | |
shell: bash -l {0} | |
run: | | |
bash_vc_install=${VCToolsInstallDir//\\//} | |
compiler_path=${bash_vc_install}bin/Hostx64/x64/cl.exe | |
echo "CC=${compiler_path}" >> $GITHUB_ENV | |
echo "CXX=${compiler_path}" >> $GITHUB_ENV | |
echo "CONDA_CXX_LIBRARIES_INSTALL_PREFIX=${CONDA_PREFIX}\Library" >> $GITHUB_ENV | |
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808 | |
# Python tests excluded as a workaround for https://github.com/robotology/idyntree/issues/939 | |
# InverseKinematics tests are excluded as a workaround for https://github.com/robotology/idyntree/issues/1019 | |
# ConsistencyTestiKin tests are excluded as a workaround for https://github.com/robotology/idyntree/issues/1029 | |
echo "IDYNTREE_TEST_TO_SKIP=Visualizer|matlab|Python|pybind|InverseKinematics|ConsistencyTestiKin" >> $GITHUB_ENV | |
- name: Setup compilation env variables [Conda/Linux&macOS] | |
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') | |
shell: bash -l {0} | |
run: | | |
echo "CONDA_CXX_LIBRARIES_INSTALL_PREFIX=${CONDA_PREFIX}" >> $GITHUB_ENV | |
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808 | |
echo "IDYNTREE_TEST_TO_SKIP=Visualizer|matlab" >> $GITHUB_ENV | |
# Additional dependencies useful only on Linux | |
- name: Dependencies [Conda/Linux] | |
if: contains(matrix.os, 'ubuntu') | |
shell: bash -l {0} | |
run: | | |
# Additional dependencies only useful on Linux | |
# See https://github.com/robotology/robotology-superbuild/issues/477 | |
micromamba install xorg-libx11 xorg-libxrandr freeglut mesa-libgl-cos6-x86_64 mesa-libgl-devel-cos6-x86_64 | |
- name: Print used environment [Conda] | |
shell: bash -l {0} | |
run: | | |
micromamba list | |
env | |
- name: Configure [Conda] | |
shell: bash -l {0} | |
run: | | |
mkdir build | |
cd build | |
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_ASSIMP:BOOL=ON -DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON -DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DIDYNTREE_USES_OSQPEIGEN:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_USES_PYTHON_PYBIND11:BOOL=ON .. | |
- name: Build [Conda] | |
shell: bash -l {0} | |
run: | | |
cd build | |
cmake --build . --config ${{ matrix.build_type }} | |
- name: Inspect libraries linked by iDynTreeMEX.mexa64 [Conda/Linux] | |
if: contains(matrix.os, 'ubuntu') | |
shell: bash -l {0} | |
run: | | |
cd build | |
ldd ./lib/iDynTreeMEX.mexa64 | |
- name: Test [Conda] | |
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') | |
shell: bash -l {0} | |
run: | | |
cd build | |
ctest --output-on-failure -C ${{ matrix.build_type }} -E "${IDYNTREE_TEST_TO_SKIP}" . | |
- name: Install [Conda] | |
shell: bash -l {0} | |
run: | | |
cd build | |
cmake --install . --config ${{ matrix.build_type }} | |
- name: Test standalone installation of MATLAB bindings [Conda] | |
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') | |
shell: bash -l {0} | |
run: | | |
cd bindings | |
mkdir build | |
cd build | |
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_CXX_LIBRARIES_INSTALL_PREFIX}/idyntree_bindings_install_test -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DMATLAB_FIND_DEBUG:BOOL=ON -DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON .. | |
cmake --build . --config ${{ matrix.build_type }} | |
cmake --install . --config ${{ matrix.build_type }} | |
build-with-apt-dependencies: | |
name: '[apt:${{ matrix.docker_image }}@${{ matrix.build_type }}]' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [Release] | |
os: | |
- ubuntu-latest | |
docker_image: | |
- "ubuntu:20.04" | |
- "ubuntu:22.04" | |
container: | |
image: ${{ matrix.docker_image }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Dependencies [apt] | |
run: | | |
# See https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive, | |
# only required by Ubuntu 20.04 | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get -y update | |
apt-get -y install \ | |
git build-essential cmake libace-dev coinor-libipopt-dev libeigen3-dev swig \ | |
libxml2-dev liboctave-dev python3-dev python3-numpy valgrind libassimp-dev libirrlicht-dev curl unzip libglfw3-dev | |
- name: Install files to enable compilation of mex files [apt] | |
run: | | |
curl -L -O https://github.com/robotology/robotology-vcpkg-ports/releases/download/storage/msdk_R2020b_mexa64.zip | |
unzip msdk_R2020b_mexa64.zip | |
rm msdk_R2020b_mexa64.zip | |
echo "GHA_Matlab_ROOT_DIR=${GITHUB_WORKSPACE}/msdk_R2020b_mexa64" >> $GITHUB_ENV | |
echo "GHA_Matlab_MEX_EXTENSION=mexa64" >> $GITHUB_ENV | |
# Print environment variables to simplify development and debugging | |
- name: Environment Variables | |
shell: bash | |
run: env | |
- name: Cache Source-based Dependencies | |
id: cache-source-deps | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/install/deps | |
key: source-deps-${{ matrix.docker_image }}-ycm-${{ env.YCM_TAG }}-yarp-${{ env.YARP_TAG }}-icub-${{ env.ICUB_TAG }} | |
- name: Source-based Dependencies [apt] | |
if: steps.cache-source-deps.outputs.cache-hit != 'true' && contains(matrix.os, 'ubuntu') | |
shell: bash | |
run: | | |
# YCM | |
git clone -b ${YCM_TAG} https://github.com/robotology/ycm | |
cd ycm | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# YARP | |
git clone -b ${YARP_TAG} https://github.com/robotology/yarp | |
cd yarp | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# ICUB | |
git clone -b ${ICUB_TAG} https://github.com/robotology/icub-main | |
cd icub-main | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# =================== | |
# CMAKE-BASED PROJECT | |
# =================== | |
- name: Configure [apt] | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps -DBUILD_TESTING:BOOL=ON -DIDYNTREE_USES_YARP:BOOL=ON \ | |
-DIDYNTREE_USES_ICUB_MAIN:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DIDYNTREE_USES_ASSIMP:BOOL=ON \ | |
-DIDYNTREE_USES_MATLAB:BOOL=ON -DMatlab_ROOT_DIR=${GHA_Matlab_ROOT_DIR} -DMatlab_MEX_EXTENSION:STRING=${GHA_Matlab_MEX_EXTENSION} -DIDYNTREE_DISABLE_MATLAB_TESTS:BOOL=ON \ | |
-DIDYNTREE_USES_IPOPT:BOOL=ON -DIDYNTREE_USES_PYTHON:BOOL=ON -DIDYNTREE_RUN_VALGRIND_TESTS:BOOL=ON -DIDYNTREE_USES_OCTAVE:BOOL=ON -DIDYNTREE_USES_IRRLICHT:BOOL=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
- name: Build | |
shell: bash | |
run: | | |
cd build | |
cmake --build . --config ${{ matrix.build_type }} | |
- name: Test | |
shell: bash | |
run: | | |
cd build | |
# Visualizer tests excluded as a workaround for https://github.com/robotology/idyntree/issues/808 | |
ctest --output-on-failure -C ${{ matrix.build_type }} -E "Visualizer|matlab" . | |
- name: Install [apt] | |
shell: bash | |
run: | | |
cd build | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
- name: Compile Examples [apt] | |
shell: bash | |
run: | | |
cd examples | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/install/deps;${GITHUB_WORKSPACE}/install" .. | |
cmake --build . --config ${{ matrix.build_type }} | |
- name: Check build if some dependencies are not enabled [apt] | |
shell: bash | |
run: | | |
cd build | |
for missing_dep in ASSIMP IPOPT; do | |
echo "Testing ${missing_dep} as missing dependency." | |
# Deselect missing dependency and build | |
cmake -DIDYNTREE_USES_${missing_dep}:BOOL=OFF . | |
cmake --build . --config ${{ matrix.build_type }} | |
# Enable again dependency | |
cmake -DIDYNTREE_USES_${missing_dep}:BOOL=ON . | |
done |