Skip to content

Commit 4b07637

Browse files
Copy over CI from RSL repo
1 parent 8335a04 commit 4b07637

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
cmake:
12+
name: cmake (${{ matrix.ros_distro }}, ${{ matrix.preset }}, ${{ matrix.compiler.name }})
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ros_distro: [humble, jazzy, kilted, rolling]
17+
preset: [debug, release, asan, codecov]
18+
compiler:
19+
- { name: GCC }
20+
- { name: Clang, flags: -DCMAKE_CXX_COMPILER=clang++ }
21+
exclude:
22+
- preset: codecov
23+
compiler: { name: Clang }
24+
- preset: codecov
25+
ros_distro: humble
26+
- preset: codecov
27+
ros_distro: jazzy
28+
- preset: codecov
29+
ros_distro: kilted
30+
runs-on: ubuntu-latest
31+
container: ghcr.io/ros-controls/ros:${{ matrix.ros_distro }}-ubuntu
32+
env:
33+
CCACHE_DIR: ${{ github.workspace }}/.ccache
34+
steps:
35+
- name: Check out the repo
36+
uses: actions/checkout@v4
37+
- name: Cache ccache
38+
uses: actions/cache@v4
39+
with:
40+
path: ${{ env.CCACHE_DIR }}
41+
key: ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }}-${{ github.sha }}-${{ github.run_id }}
42+
restore-keys: |
43+
ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }}-${{ github.sha }}
44+
ccache-cmake-${{ matrix.ros_distro }}-${{ matrix.preset }}
45+
- name: Install system dependencies
46+
run: |
47+
sudo apt update
48+
sudo apt install -y lld ccache
49+
- name: Source ROS
50+
run: |
51+
. /opt/ros/${{ matrix.ros_distro }}/setup.sh
52+
echo "$(env)" >> $GITHUB_ENV
53+
- name: Install ROS dependencies
54+
run: |
55+
sudo apt update
56+
rosdep update
57+
rosdep install --from-paths . --ignore-src -r -y
58+
- name: Install Clang
59+
if: matrix.compiler.name == 'Clang'
60+
run: sudo apt update && sudo apt install clang
61+
- name: Configure
62+
run: cmake --preset ${{ matrix.preset }} ${{ matrix.compiler.flags }} -DCMAKE_INSTALL_PREFIX=install -DCMAKE_VERBOSE_MAKEFILE=ON
63+
- name: Build
64+
run: cmake --build build/${{ matrix.preset }} --target install
65+
- name: Test
66+
run: ctest --test-dir build/${{ matrix.preset }} --rerun-failed --output-on-failure
67+
- name: Build Doxygen Site
68+
run: cmake --build build/${{ matrix.preset }} --target docs
69+
- name: Analyze
70+
run: cmake --build build/${{ matrix.preset }} --target tidy
71+
- name: Generate LCOV report
72+
if: ${{ matrix.preset == 'codecov' }}
73+
run: lcov -c -d . -o coverage.info --no-external --exclude "*/build/**" --ignore-errors mismatch
74+
- uses: codecov/codecov-action@v3
75+
if: ${{ matrix.preset == 'codecov' }}
76+
with:
77+
files: ./coverage.info
78+
name: codecov-umbrella
79+
flags: ${{ matrix.ros_distro }}
80+
81+
ros:
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
ros_distro: [humble, jazzy, kilted, rolling]
86+
runs-on: ubuntu-latest
87+
container: ghcr.io/ros-controls/ros:${{ matrix.ros_distro }}-ubuntu
88+
env:
89+
CCACHE_DIR: ${{ github.workspace }}/.ccache
90+
steps:
91+
- name: Check out the repo
92+
uses: actions/checkout@v4
93+
- name: Cache ccache
94+
uses: actions/cache@v4
95+
with:
96+
path: ${{ env.CCACHE_DIR }}
97+
key: ccache-ros-${{ matrix.ros_distro }}-${{ github.sha }}-${{ github.run_id }}
98+
restore-keys: |
99+
ccache-ros-${{ matrix.ros_distro }}-${{ github.sha }}
100+
ccache-ros-${{ matrix.ros_distro }}
101+
- name: Install dependencies
102+
run: |
103+
sudo apt update
104+
sudo apt install -y lld ccache
105+
- uses: ros-tooling/[email protected]
106+
with:
107+
package-name: rsl
108+
target-ros2-distro: ${{ matrix.ros_distro }}
109+
colcon-defaults: |
110+
{
111+
"build": {
112+
"mixin": ["ccache", "lld"]
113+
}
114+
}

0 commit comments

Comments
 (0)