Skip to content

CI Workflow

CI Workflow #1882

Workflow file for this run

name: CI Workflow
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'feat/**'
- 'fix/**'
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 * * *'
jobs:
build:
name: '[${{ matrix.os }}@${{ matrix.build_type }}]'
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_type: [Release]
os: [windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@main
- name: Display environment variables
shell: bash
run: env
# ============
# DEPENDENCIES
# ============
- name: Download Vcpkg Prebuilt 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: Build Vcpkg Dependencies [Windows]
if: matrix.os == 'windows-latest'
shell: bash
run: |
${VCPKG_INSTALLATION_ROOT}/vcpkg.exe install --overlay-ports=C:/robotology/robotology-vcpkg-ports --recurse --triplet x64-windows fftw3
- name: Install Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y git build-essential pkg-config zip unzip zlib1g-dev cmake libace-dev coinor-libipopt-dev libeigen3-dev swig \
qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libtinyxml-dev libgsl-dev libmatio-dev fftw3 wget curl autoconf \
autogen automake libtool mlocate python3 python3-numpy python3-dev python3-pip python3-wheel libglvnd-dev
# install Bazel 0.26.1 needed by tensorflow_cc
#wget https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel_0.26.1-linux-x86_64.deb
#sudo dpkg -i bazel_0.26.1-linux-x86_64.deb
- name: Determine YCM and YARP versions required by ICUB
shell: bash
run: |
cd ${GITHUB_WORKSPACE}
if [ "$RUNNER_OS" == "Windows" ]; then
choco install wget
fi
wget -O CMakeLists.txt.icub-main https://raw.githubusercontent.com/robotology/icub-main/devel/CMakeLists.txt
grep -m 1 YCM_REQUIRED_VERSION CMakeLists.txt.icub-main | sed "s/[^0-9.]//g" >> YCM_VERSION.txt
grep -m 1 YARP_REQUIRED_VERSION CMakeLists.txt.icub-main | sed "s/[^0-9.]//g" >> YARP_VERSION.txt
echo "ycm_version=$(cat YCM_VERSION.txt)" >> $GITHUB_ENV
echo "yarp_version=$(cat YARP_VERSION.txt)" >> $GITHUB_ENV
- name: Build 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 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# yarp
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp.git --depth 1 --branch v${{ env.yarp_version }}
cd yarp && 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 \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# icub-main
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-main.git --depth 1 --branch devel
cd icub-main && 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 \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_icubmod_cartesiancontrollerserver=ON -DENABLE_icubmod_cartesiancontrollerclient=ON \
-DENABLE_icubmod_gazecontrollerclient=ON ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# cer
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/cer.git --depth 1 --branch devel
cd cer && 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 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
# icub-contrib-common
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-contrib-common.git --depth 1
cd icub-contrib-common && 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 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
- name: Build Source-based Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
# opencv
cd ${GITHUB_WORKSPACE}
git clone https://github.com/opencv/opencv.git --depth 1 --branch 4.6.0
git clone https://github.com/opencv/opencv_contrib.git --depth 1 --branch 4.6.0
cd opencv && mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DOPENCV_EXTRA_MODULES_PATH=${GITHUB_WORKSPACE}/opencv_contrib/modules \
-DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# vtk
cd ${GITHUB_WORKSPACE}
git clone https://github.com/Kitware/VTK.git --depth 1 --branch v9.2.2
cd VTK && mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# tensorflow_cc
#cd ${GITHUB_WORKSPACE}
#git clone https://github.com/FloopCZ/tensorflow_cc.git --depth 1 --branch master
#cd tensorflow_cc/tensorflow_cc && mkdir -p build && cd build
#cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DTENSORFLOW_STATIC=OFF -DTENSORFLOW_SHARED=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
#cmake --build . --config ${{ matrix.build_type }} --target install
# 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 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# yarp
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp.git --depth 1 --branch v${{ env.yarp_version }}
cd yarp && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# icub-main
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-main.git --depth 1 --branch devel
cd icub-main && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DENABLE_icubmod_cartesiancontrollerserver=ON -DENABLE_icubmod_cartesiancontrollerclient=ON -DENABLE_icubmod_gazecontrollerclient=ON ..
cmake --build . --config ${{ matrix.build_type }} --target install
# cer
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/cer.git --depth 1 --branch devel
cd cer && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# icub-contrib-common
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/icub-contrib-common.git --depth 1
cd icub-contrib-common && mkdir -p build && cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }} --target install
# ===================
# CMAKE-BASED PROJECT
# ===================
- name: Configure [Windows]
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 -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_TESTING=ON ..
- name: Configure [Ubuntu]
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
mkdir -p build
cd build
cmake -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_TESTING=ON ..
- name: Build
shell: bash
run: |
cd build
# Fix for using YARP idl generators (that link ACE) in Windows
# See https://github.com/robotology/idyntree/issues/569 for more details
export PATH=$PATH:${GITHUB_WORKSPACE}/install/bin:${VCPKG_INSTALLATION_ROOT}/installed/x64-windows/bin
cmake --build . --config ${{ matrix.build_type }}
- name: Install
shell: bash
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target install