Continuous Integration #1398
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: Continuous Integration | |
on: | |
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 * * *' | |
workflow_dispatch: | |
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@master | |
- name: Set up environment variables [Windows] | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
# the following fix the problem described in https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/Windows-tests-worked-yesterday-broken-today/m-p/43839#M5530 | |
echo "C:\Program Files\Git\bin" >> ${GITHUB_PATH} | |
echo "VCPKG_ROBOTOLOGY_ROOT=D:/vcpkg-robotology" >> ${GITHUB_ENV} | |
echo "VCPKG_ROBOTOLOGY_BIN_PORTS_ROOT=D:/vcpkg-robotology-binary-ports" >> ${GITHUB_ENV} | |
- name: Display 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-latest' | |
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: bash | |
run: | | |
# To avoid spending a huge time compiling vcpkg dependencies, we download a root that comes precompiled with all the ports that we need | |
choco install -y wget unzip | |
# To avoid problems with non-relocatable packages, we unzip the archive exactly in the same C:/vcpkg-robotology | |
# that has been used to create the pre-compiled archive | |
cd D:/ | |
wget https://github.com/robotology-playground/robotology-superbuild-dependencies/releases/download/v0.0.2/vcpkg-robotology.zip | |
unzip vcpkg-robotology.zip | |
- name: Dependencies [Ubuntu] | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt update | |
sudo apt install git build-essential pkg-config zip unzip cmake | |
- 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 master | |
cd ycm && mkdir -p build && cd build | |
cmake -A x64 -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROBOTOLOGY_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 | |
- name: Source-based Dependencies [Ubuntu] | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
# ycm | |
cd ${GITHUB_WORKSPACE} | |
git clone https://github.com/robotology/ycm.git --depth 1 --branch master | |
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 | |
# =================== | |
# 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_ROBOTOLOGY_ROOT}/scripts/buildsystems/vcpkg.cmake \ | |
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. | |
- 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 }} .. | |
- 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_ROBOTOLOGY_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 |