C++ CI Workflow #1653
This file contains hidden or 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: C++ CI Workflow | |
| # template derived from https://github.com/robotology/human-dynamics-estimation/blob/master/.github/workflows/ci.yml | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # run a cron job for a nightly build | |
| # * 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: | |
| BipedalLocomotionFramework_TAG: v0.16.1 | |
| LieGroupController_TAG: v0.2.0 | |
| action-restore-cache: 'true' | |
| jobs: | |
| build: | |
| name: '[${{matrix.os}}@${{matrix.build_type}}]' | |
| runs-on: ${{matrix.os}} | |
| strategy: | |
| matrix: | |
| build_type: [Release] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Get current day | |
| shell: bash -l {0} | |
| run: | | |
| echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| # Use mamba for dependencies | |
| - uses: mamba-org/setup-micromamba@v1 | |
| with: | |
| environment-file: ci_env.yml | |
| channel-priority: true | |
| - name: Set QT_HOST_PATH_env var [macOS] | |
| if: matrix.os == 'macOS-latest' | |
| shell: bash -l {0} | |
| run: | | |
| echo "QT_HOST_PATH=${CONDA_PREFIX}" >> $GITHUB_ENV | |
| # Print the environment variables to simplify development and debugging | |
| - name: Environment Variables | |
| # Use bash in order to have same basic commands in all OSs | |
| shell: bash | |
| run: env | |
| # Remove apt repos on Ubuntu 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 | |
| # ============ | |
| # Additional dependencies useful only on Linux | |
| - name: Dependencies [Ubuntu] | |
| if: matrix.os == 'ubuntu-latest' | |
| shell: bash -l {0} | |
| run: | | |
| # Additional dependencies only useful on Linux, both at the conda and the system level, | |
| # see https://conda-forge.org/docs/maintainer/maintainer_faq/#how-do-i-fix-the-libglso1-import-error | |
| micromamba install libgl-devel | |
| sudo apt-get update | |
| sudo apt install libgl1-mesa-dri libglx-mesa0 libegl-mesa0 | |
| # =================== | |
| # CMAKE-BASED PROJECT | |
| # =================== | |
| # We will just configure and build the project now. Further modifications and tests can be added | |
| # Configure step | |
| - name: Configure [Ubuntu, macOS] | |
| if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest' | |
| shell: bash -l {0} | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake -G"Ninja" .. \ | |
| -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | |
| -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
| -DFRAMEWORK_COMPILE_YarpImplementation=ON \ | |
| -DFRAMEWORK_COMPILE_YarpDevices=ON \ | |
| -DBUILD_TESTING:BOOL=ON \ | |
| -DBUILD_EXAMPLES:BOOL=ON \ | |
| -DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON \ | |
| -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX | |
| - name: Configure [Windows] | |
| if: matrix.os == 'windows-latest' | |
| shell: bash -l {0} | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake -G"Visual Studio 18 2026" .. \ | |
| -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX/Library \ | |
| -DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install/deps \ | |
| -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
| -DFRAMEWORK_COMPILE_YarpImplementation=ON \ | |
| -DFRAMEWORK_COMPILE_YarpDevices=ON \ | |
| -DBUILD_TESTING:BOOL=ON \ | |
| -DBUILD_EXAMPLES:BOOL=ON \ | |
| -DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON \ | |
| -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX/Library | |
| # Build step | |
| - name: Build | |
| shell: bash -l {0} | |
| run: | | |
| cd build | |
| cmake --build . --config ${{matrix.build_type}} --verbose | |
| # Test step | |
| - name: Test | |
| shell: bash -l {0} | |
| run: | | |
| cd build | |
| export PATH=$PATH:${GITHUB_WORKSPACE}/build/install/bin:${GITHUB_WORKSPACE}/install/deps/bin | |
| ctest --output-on-failure -C ${{ matrix.build_type }} . | |
| - name: Install [Ubuntu, macOS] | |
| if: matrix.os != 'windows-latest' | |
| shell: bash -l {0} | |
| run: | | |
| cd build | |
| cmake --install . --config ${{matrix.build_type}} --verbose | |
| cmake-package-check BiomechanicalAnalysisFramework --targets BiomechanicalAnalysis::IK BiomechanicalAnalysis::ID BiomechanicalAnalysis::CommonConversions BiomechanicalAnalysis::Logging | |
| - name: Install [Windows] | |
| if: matrix.os == 'windows-latest' | |
| shell: cmd /C CALL {0} | |
| run: | | |
| cd build | |
| cmake --install . --config ${{matrix.build_type}} --verbose | |
| :: Re-enable when we understand why cmake-package-check is not found | |
| :: cmake-package-check BiomechanicalAnalysisFramework --targets BiomechanicalAnalysis::IK BiomechanicalAnalysis::ID BiomechanicalAnalysis::CommonConversions BiomechanicalAnalysis::Logging |