CI Workflow #3689
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: | |
branches: | |
- master | |
- devel | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review] | |
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 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: '[${{ matrix.os }}@${{ matrix.build_type }}@BUILD_SHARED_LIBS:${{ matrix.build_shared_libs }}]' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build_type: [Release] | |
os: [ubuntu-22.04, windows-latest] | |
build_shared_libs: [ON, OFF] | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@main | |
- name: Environment Variables | |
shell: bash | |
run: env | |
# Remove apt repos that are known to break from time to time | |
# See https://github.com/actions/virtual-environments/issues/323 | |
- name: Remove broken apt repos [Ubuntu] | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done | |
# ============ | |
# DEPENDENCIES | |
# ============ | |
- name: Dependencies [Windows] | |
if: matrix.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
$response = gh api --paginate -H "Accept: application/vnd.github.v3+json" /repos/robotology/robotology-superbuild-dependencies-vcpkg/releases/latest | |
$latest_tag = ($response | ConvertFrom-Json).tag_name | |
echo "Installing robotology-superbuild-dependencies-vcpkg@$latest_tag" | |
iwr -Uri https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/releases/download/$latest_tag/vcpkg-robotology.zip -OutFile C:/vcpkg-robotology.zip | |
7z x C:/vcpkg-robotology.zip -oC:/ | |
"VCPKG_INSTALLATION_ROOT=C:/robotology/vcpkg" >> $env:GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Dependencies [Ubuntu] | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install -y git build-essential cmake libace-dev coinor-libipopt-dev libeigen3-dev libopencv-dev qtbase5-dev \ | |
qtdeclarative5-dev qtmultimedia5-dev libtinyxml-dev libgsl-dev libpython3-dev swig | |
- name: Determine YCM and YARP required versions | |
shell: bash | |
run: | | |
grep -m 1 YCM_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" > YCM_VERSION.txt | |
grep -m 1 YARP_REQUIRED_VERSION CMakeLists.txt | sed "s/[^0-9.]//g" > YARP_VERSION.txt | |
cat YARP_VERSION.txt | awk -F '.' '{ print $1 }' > YARP_VERSION_MAJOR.txt | |
cat YARP_VERSION.txt | awk -F '.' '{ print $2 }' > YARP_VERSION_MINOR.txt | |
echo "ycm_version=$(cat YCM_VERSION.txt)" >> $GITHUB_ENV | |
echo "yarp_branch=yarp-$(cat YARP_VERSION_MAJOR.txt).$(cat YARP_VERSION_MINOR.txt)" >> $GITHUB_ENV | |
- name: Determine icub-firmware-shared required branch | |
shell: bash | |
run: | | |
grep -m 1 icub_firmware_shared_VERSION conf/iCubFindDependencies.cmake | sed "s/[^0-9.]//g" > icub_firmware_shared_VERSION.txt | |
gh --repo robotology/icub-firmware-shared release list > icub_firmware_shared_RELEASES.txt | |
if grep -q $(cat icub_firmware_shared_VERSION.txt) icub_firmware_shared_RELEASES.txt; then | |
echo "icub_firmware_shared_branch=v$(cat icub_firmware_shared_VERSION.txt)" >> $GITHUB_ENV | |
elif [[ "${{ github.event_name }}" == "schedule" || "${{ github.ref }}" == "refs/heads/master" || "${{ github.base_ref }}" == "master" || "${{ github.head_ref }}" == "master" ]]; then | |
echo "icub_firmware_shared_branch=master" >> $GITHUB_ENV | |
else | |
echo "icub_firmware_shared_branch=devel" >> $GITHUB_ENV | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Source-based Dependencies [Windows] | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
# YCM | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/ycm.git --depth 1 --branch v${{ env.ycm_version }} | |
cd ycm && mkdir -p build && cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
cmake --build . --config ${{ matrix.build_type }} --target INSTALL | |
# YARP | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/yarp.git --depth 1 --branch ${{ env.yarp_branch }} | |
cd yarp && mkdir -p build && cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake -DYARP_COMPILE_GUIS:BOOL=OFF \ | |
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
cmake --build . --config ${{ matrix.build_type }} --target INSTALL | |
# icub-firmware-shared | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/icub-firmware-shared.git --depth 1 --branch ${{ env.icub_firmware_shared_branch }} | |
cd icub-firmware-shared && mkdir -p build && cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \ | |
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
cmake --build . --config ${{ matrix.build_type }} --target INSTALL | |
- name: Source-based Dependencies [Ubuntu] | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
# YCM | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/ycm.git --depth 1 --branch v${{ env.ycm_version }} | |
cd ycm && mkdir -p build && cd build | |
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# YARP | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/yarp.git --depth 1 --branch ${{ env.yarp_branch }} | |
cd yarp && mkdir -p build && cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DYARP_COMPILE_GUIS:BOOL=OFF .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# icub-firmware-shared | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/icub-firmware-shared.git --depth 1 --branch ${{ env.icub_firmware_shared_branch }} | |
cd icub-firmware-shared && mkdir -p build && cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
# =================== | |
# CMAKE-BASED PROJECT | |
# =================== | |
- name: Configure [Windows] | |
# Use bash also on Windows (otherwise cd, mkdir, ... do not work) | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake \ | |
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \ | |
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.build_shared_libs }} \ | |
-DICUB_USE_icub_firmware_shared:BOOL=ON \ | |
-DENABLE_icubmod_skinWrapper:BOOL=ON \ | |
-DENABLE_icubmod_sharedcan:BOOL=ON \ | |
-DENABLE_icubmod_bcbBattery:BOOL=ON \ | |
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \ | |
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \ | |
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \ | |
-DENABLE_icubmod_canBusSkin:BOOL=ON \ | |
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \ | |
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \ | |
-DENABLE_icubmod_embObjIMU:BOOL=ON \ | |
-DENABLE_icubmod_embObjInertials:BOOL=ON \ | |
-DENABLE_icubmod_embObjMais:BOOL=ON \ | |
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \ | |
-DENABLE_icubmod_embObjBattery:BOOL=ON \ | |
-DENABLE_icubmod_embObjSkin:BOOL=ON \ | |
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \ | |
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \ | |
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \ | |
-DBUILD_TESTING:BOOL=ON \ | |
-DICUB_SHARED_LIBRARY=OFF \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
- name: Configure [Ubuntu] | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
mkdir -p build | |
cd build | |
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \ | |
-DBUILD_SHARED_LIBS:BOOL=${{ matrix.build_shared_libs }} \ | |
-DICUB_USE_icub_firmware_shared:BOOL=ON \ | |
-DENABLE_icubmod_skinWrapper:BOOL=ON \ | |
-DENABLE_icubmod_sharedcan:BOOL=ON \ | |
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \ | |
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \ | |
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \ | |
-DENABLE_icubmod_canBusSkin:BOOL=ON \ | |
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \ | |
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \ | |
-DENABLE_icubmod_embObjIMU:BOOL=ON \ | |
-DENABLE_icubmod_embObjInertials:BOOL=ON \ | |
-DENABLE_icubmod_embObjMais:BOOL=ON \ | |
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \ | |
-DENABLE_icubmod_embObjBattery:BOOL=ON \ | |
-DENABLE_icubmod_embObjSkin:BOOL=ON \ | |
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \ | |
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \ | |
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \ | |
-DBUILD_TESTING:BOOL=ON \ | |
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install .. | |
- name: Enable python bindings on Ubuntu | |
if: matrix.os == 'ubuntu-22.04' | |
shell: bash | |
run: | | |
cd build | |
# Enable ICUB_COMPILE_BINDINGS in Ubuntu | |
cmake -DICUB_COMPILE_BINDINGS:BOOL=ON -DCREATE_PYTHON:BOOL=ON . | |
- name: Extend Path | |
shell: bash | |
run: | | |
echo "${{ github.workspace }}/install/bin" >> $GITHUB_PATH | |
echo "${{ github.workspace }}/install/lib/yarp" >> $GITHUB_PATH | |
# Fix for using YARP idl generators (that link ACE) in Windows (https://github.com/robotology/idyntree/issues/569) | |
echo "${VCPKG_INSTALLATION_ROOT}/installed/x64-windows/bin" >> $GITHUB_PATH | |
- name: Build | |
shell: bash | |
run: | | |
cd build | |
cmake --build . --config ${{ matrix.build_type }} | |
- name: Install | |
shell: bash | |
run: | | |
cd build | |
cmake --build . --config ${{ matrix.build_type }} --target install | |
- name: Test | |
shell: bash | |
run: | | |
cd build | |
ctest run_unit_test --output-on-failure -C ${{ matrix.build_type }} . |