From 96da5ccea83d860c95f5ff51462cab20fce7268b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Genesio=20=28=E4=BA=8C=E3=82=B3=E3=82=B2?= =?UTF-8?q?=E3=83=8D=29?= Date: Mon, 26 Feb 2024 15:30:50 +0100 Subject: [PATCH] Use conda in CI It fixes #66 --- .github/workflows/ci.yml | 169 +++++++-------------------------------- 1 file changed, 31 insertions(+), 138 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb275f1..6187f11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,10 @@ -name: Continuous Integration +name: Continuous Integration with conda dependencies on: push: branches: - 'master' + - 'devel' - 'feat/**' - 'fix/**' pull_request: @@ -20,163 +21,55 @@ jobs: strategy: matrix: build_type: [Release] - os: [windows-latest, ubuntu-latest] + os: [ubuntu-latest, windows-2019, macos-latest] steps: - uses: actions/checkout@main - - - name: Set up environment variables [Windows] - if: matrix.os == 'windows-latest' - shell: bash - run: | - # the following fix the problem described in https://github.community/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=C:/robotology/vcpkg" >> ${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 + - uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + channels: conda-forge,robotology + channel-priority: true - # ============ - # DEPENDENCIES - # ============ - - name: Dependencies [Windows] - if: matrix.os == 'windows-latest' - shell: bash - run: | - choco install -y curl wget unzip - latest_tag=$(curl --silent https://api.github.com/repos/robotology/robotology-superbuild-dependencies-vcpkg/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/') - echo "Installing robotology-superbuild-dependencies-vcpkg@${latest_tag}" - cd C:/ - wget https://github.com/robotology/robotology-superbuild-dependencies-vcpkg/releases/download/${latest_tag}/vcpkg-robotology.zip - unzip vcpkg-robotology.zip -d C:/ - rm vcpkg-robotology.zip - - name: Dependencies [Ubuntu] - if: matrix.os == 'ubuntu-latest' + - name: Dependencies + shell: bash -l {0} run: | - sudo apt update - sudo apt install git build-essential pkg-config zip unzip zlib1g-dev cmake libace-dev coinor-libipopt-dev libeigen3-dev \ - qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libtinyxml-dev libgsl-dev wget curl autoconf \ - autogen automake libtool mlocate libopencv-dev + # 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 ycm-cmake-modules yarp opencv idyntree robot-testing-framework icub-main - - 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 - # robot-testing-framework - cd ${GITHUB_WORKSPACE} - git clone https://github.com/robotology/robot-testing-framework.git --depth 1 --branch devel - cd robot-testing-framework && 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 }} \ - -DENABLE_LUA_PLUGIN:BOOL=OFF -DENABLE_WEB_LISTENER:BOOL=ON .. - cmake --build . --config ${{ matrix.build_type }} --target INSTALL - # yarp - cd ${GITHUB_WORKSPACE} - git clone https://github.com/robotology/yarp.git --depth 1 --branch master - cd yarp && 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 }} -DCREATE_LIB_MATH:BOOL=ON -DCREATE_SHARED_LIBRARY:BOOL=ON \ - -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} -DYARP_COMPILE_RobotTestingFramework_ADDONS:BOOL=ON .. - 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_ROBOTOLOGY_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 - - - name: Source-based Dependencies [Ubuntu] - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-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 - # robot-testing-framework - cd ${GITHUB_WORKSPACE} - git clone https://github.com/robotology/robot-testing-framework.git --depth 1 --branch devel - cd robot-testing-framework && mkdir -p build && cd build - cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DENABLE_LUA_PLUGIN:BOOL=OFF ENABLE_WEB_LISTENER:BOOL=ON .. - cmake --build . --config ${{ matrix.build_type }} --target install - # yarp - cd ${GITHUB_WORKSPACE} - git clone https://github.com/robotology/yarp.git --depth 1 --branch master - cd yarp && mkdir -p build && cd build - # Workaround for https://github.com/robotology/robotology-superbuild/issues/1091 - cmake -DYARP_DISABLE_MACOS_BUNDLES:BOOL=ON -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install \ - -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DYARP_COMPILE_RobotTestingFramework_ADDONS:BOOL=ON .. - 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 - env: - # This is necessary only on macOS/homebrew, but on Linux it should be ignored - Qt5_DIR: /usr/local/opt/qt5/lib/cmake/Qt5 - # =================== - # CMAKE-BASED PROJECT - # =================== - - name: Configure [Windows] - if: matrix.os == 'windows-latest' - shell: bash + - name: Configure [Linux&macOS] + if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') + shell: bash -l {0} 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 }} .. + cmake -GNinja -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. - - name: Configure [Ubuntu] - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest' - shell: bash + - name: Configure [Windows] + if: contains(matrix.os, 'windows') + shell: bash -l {0} 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 }} .. - env: - # This is necessary only on macOS/homebrew, but on Linux it should be ignored - Qt5_DIR: /usr/local/opt/qt5/lib/cmake/Qt5 + cd build + cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. - name: Build - shell: bash + shell: bash -l {0} 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 + shell: bash -l {0} run: | cd build cmake --build . --config ${{ matrix.build_type }} --target install