-
Notifications
You must be signed in to change notification settings - Fork 330
221 lines (202 loc) · 7.29 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: Lanelet2 CI
on:
push:
branches:
- "**"
tags:
- "**"
# Run tests for any PRs.
pull_request:
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-humble
- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_src
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=22.04
ROS_DISTRO=humble
ROS=ros2
target: lanelet2_src
- name: Run clang formatting check
run: |
set -ex
docker run -i --rm lanelet2_src find . -name "*.cpp" -o -name "*.h" -execdir clang-format-11 -n -Werror --style=file {} +
lint:
needs: formatting
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-humble
- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_src
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=22.04
ROS_DISTRO=humble
ROS=ros2
target: lanelet2_src
- name: Run clang-tidy
run: docker run -i --rm lanelet2_src /home/developer/workspace/src/lanelet2/.github/lint.bash
test:
needs: formatting
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
rosdistro: [noetic, galactic, humble]
include:
- rosdistro: noetic
os: 20.04
ros: ros
- rosdistro: galactic
os: 20.04
ros: ros2
- rosdistro: humble
os: 22.04
ros: ros2
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Setup docker cache
uses: actions/cache@v3
with:
path: /tmp/.docker-cache
key: ${{runner.os}}-docker-${{ matrix.rosdistro }}
- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2_base:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
cache-to: type=local,dest=/tmp/.docker-cache
build-args: |
DEV=1
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2_deps
- name: Build Lanelet2
uses: docker/build-push-action@v3
if: ${{ matrix.rosdistro == 'noetic' }}
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
load: true
build-args: |
DEV=1
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2
- name: Build Lanelet2 (skip lcov)
uses: docker/build-push-action@v3
if: ${{ matrix.rosdistro == 'humble' || matrix.rosdistro == 'galactic' }}
with:
builder: ${{ steps.buildx.outputs.name }}
tags: lanelet2:${{ matrix.rosdistro }}
cache-from: type=local,src=/tmp/.docker-cache
load: true
build-args: |
DEV=0
DISTRIBUTION=${{ matrix.os }}
ROS_DISTRO=${{ matrix.rosdistro }}
ROS=${{ matrix.ros }}
target: lanelet2
- name: Run Lanelet2 Tests
run: |
set -ex;
if [ "${{matrix.ros}}" = "ros" ]; then
export TEST_CMD="catkin build --no-status --catkin-make-args run_tests && source /opt/ros/${{matrix.rosdistro}}/setup.bash && catkin_test_results --verbose";
else
export TEST_CMD="colcon test --return-code-on-test-failure";
fi;
docker run -i --name lanelet2_test_${{ matrix.rosdistro }} lanelet2:${{ matrix.rosdistro }} /bin/bash -c "$TEST_CMD";
- name: Extract and Merge lcov Files
if: ${{ matrix.rosdistro == 'noetic' }}
run: |
docker commit lanelet2_test_${{ matrix.rosdistro }} lanelet2_${{ matrix.rosdistro }}_post_run;
docker run -i --name lanelet2_test_${{ matrix.rosdistro }}_lcov lanelet2_${{ matrix.rosdistro }}_post_run /home/developer/workspace/src/lanelet2/.github/lcov_merge.bash;
mkdir -p ./lcov;
docker cp lanelet2_test_${{ matrix.rosdistro }}_lcov:$(docker inspect --format='{{.Config.WorkingDir}}' lanelet2_test_${{ matrix.rosdistro }}_lcov)/lcov/full_coverage.lcov ./lcov/full_coverage.lcov;
- name: Cleanup Docker Container
run: |
docker rm -f lanelet2_test_${{ matrix.rosdistro }};
docker rm -f lanelet2_test_${{ matrix.rosdistro }}_lcov;
- name: Report code coverage
uses: immel-f/[email protected]
if: ${{ matrix.rosdistro == 'noetic' }}
with:
coverage-files: ./lcov/full_coverage.lcov
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
full_conan_installation:
needs: lint
strategy:
matrix:
# to reach 2_27, we need a gcc7.
# to build python>3.10, we need boost>1.75.
# to build boost>1.81 we need a gcc>10.
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.9"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.10"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
- python-version: "3.11"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
- python-version: "3.12"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
file: .github/conan_dockerfile/Dockerfile
tags: lanelet2_conan_with_pip_wheel
load: true
target: lanelet2_conan_with_pip_wheel
build-args: |
FROM=${{ matrix.image-version }}
PY_VERSION=${{ matrix.python-version }}
PLATFORM=${{ matrix.platform-version }}