Copy over CI from ros2_control repo #1
Workflow file for this run
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: CI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| cmake: | |
| name: cmake (${{ matrix.ros_distro }}, ${{ matrix.preset }}, ${{ matrix.compiler.name }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ros_distro: [humble, jazzy, kilted, rolling] | |
| preset: [debug, release, asan, codecov] | |
| compiler: | |
| - { name: GCC } | |
| - { name: Clang, flags: -DCMAKE_CXX_COMPILER=clang++ } | |
| exclude: | |
| - preset: codecov | |
| compiler: { name: Clang } | |
| - preset: codecov | |
| ros_distro: humble | |
| - preset: codecov | |
| ros_distro: jazzy | |
| - preset: codecov | |
| ros_distro: kilted | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/ros-controls/ros:${{ matrix.ros_distro }}-ubuntu | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }}-${{ github.sha }}-${{ github.run_id }} | |
| restore-keys: | | |
| ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }}-${{ github.sha }} | |
| ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y lld ccache | |
| - name: Source ROS | |
| run: | | |
| . /opt/ros/${{ matrix.ros_distro }}/setup.sh | |
| echo "$(env)" >> $GITHUB_ENV | |
| - name: Install ROS dependencies | |
| run: | | |
| sudo apt update | |
| rosdep update | |
| rosdep install --from-paths . --ignore-src -r -y | |
| - name: Install Clang | |
| if: matrix.compiler.name == 'Clang' | |
| run: sudo apt update && sudo apt install clang | |
| - name: Configure | |
| run: cmake --preset ${{ matrix.preset }} ${{ matrix.compiler.flags }} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_VERBOSE_MAKEFILE=ON | |
| - name: Build | |
| run: cmake --build build/${{ matrix.preset }} --target install | |
| - name: Test | |
| run: ctest --test-dir build/${{ matrix.preset }} --rerun-failed --output-on-failure | |
| - name: Build Doxygen Site | |
| run: cmake --build build/${{ matrix.preset }} --target docs | |
| - name: Analyze | |
| run: cmake --build build/${{ matrix.preset }} --target tidy | |
| - name: Generate LCOV report | |
| if: ${{ matrix.preset == 'codecov' }} | |
| run: lcov -c -d . -o coverage.info --no-external --exclude "*/build/**" --ignore-errors mismatch | |
| - uses: codecov/codecov-action@v3 | |
| if: ${{ matrix.preset == 'codecov' }} | |
| with: | |
| files: ./coverage.info | |
| name: codecov-umbrella | |
| flags: ${{ matrix.ros_distro }} | |
| ros: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ros_distro: [humble, jazzy, kilted, rolling] | |
| runs-on: ubuntu-latest | |
| container: ghcr.io/ros-controls/ros:${{ matrix.ros_distro }}-ubuntu | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ccache-ros-${{ matrix.ros_distro }}-${{ github.sha }}-${{ github.run_id }} | |
| restore-keys: | | |
| ccache-ros-${{ matrix.ros_distro }}-${{ github.sha }} | |
| ccache-ros-${{ matrix.ros_distro }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y lld ccache | |
| - uses: ros-tooling/[email protected] | |
| with: | |
| package-name: rsl | |
| target-ros2-distro: ${{ matrix.ros_distro }} | |
| colcon-defaults: | | |
| { | |
| "build": { | |
| "mixin": ["ccache", "lld"] | |
| } | |
| } |