forked from fzi-forschungszentrum-informatik/Lanelet2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
200 lines (179 loc) · 5.09 KB
/
.gitlab-ci.yml
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
variables:
GIT_STRATEGY: none
LANELET2_PACKAGES: lanelet2_core lanelet2_io lanelet2_projection lanelet2_python lanelet2_routing lanelet2_traffic_rules lanelet2_validation
# Cache build results between building and testing
cache:
paths:
- catkin_ws/
stages:
- build
- test
- deploy
# Prepare workspace and checkout the code. This will be executed before every stage
before_script:
# Environment variablen setzen
- export SHELL="/bin/bash"
# Prepare workspace (in folder catkin_ws)
- sudo apt-get update
- mrt ci prepare $CI_PROJECT_NAME -c $CI_COMMIT_SHA
- cd catkin_ws
# add current branch name to branch management
- mrt ws branches add $CI_COMMIT_REF_NAME
# Tests installing on a plain system without mrt stuff using the provided Docker image
.build_docker: &build_docker
stage: build
image: docker:stable
only:
- master
- merge_requests
before_script: []
cache: {}
services:
- docker:stable-dind
script:
- export IMAGE_NAME=$CI_REGISTRY_IMAGE:$DISTRIBUTION
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME --build-arg=DISTRIBUTION=$DISTRIBUTION --build-arg=ROS_DISTRO=$ROS_DISTRO .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then docker push $IMAGE_NAME; fi
build_docker_xenial:
<<: *build_docker
variables:
DISTRIBUTION: "16.04"
ROS_DISTRO: kinetic
DOCKER_DRIVER: overlay2
GIT_STRATEGY: fetch
build_docker_bionic:
<<: *build_docker
variables:
DISTRIBUTION: "18.04"
ROS_DISTRO: melodic
DOCKER_DRIVER: overlay2
GIT_STRATEGY: fetch
build_mrt:
stage: build
only: [branches, tags, merge_requests] # means "always"
script:
# Build project and resolve deps at the same time in debug mode
- mrt catkin build -s -rd --debug --default_yes --no-status $CI_PROJECT_NAME
# generate documentation
- mrt doc clean && mrt doc build
- cp -r build_debug/workspace_doc_* ../doxygen
# make doxygen documentation available in gitlab
artifacts:
name: doxygen
paths:
- doxygen
expire_in: 6 mos
general_code_quality:
stage: build
image: docker:stable
before_script: []
cache: {}
only: [master, merge_requests]
variables:
DOCKER_DRIVER: overlay2
GIT_STRATEGY: fetch
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
- chmod a+rw gl-code-quality-report.json
artifacts:
paths: [gl-code-quality-report.json]
.test: &test_job
stage: test
coverage: '/lines: \d+.\d+\%/'
only: [branches, tags, merge_requests] # means "always"
cache:
paths:
- catkin_ws/
policy: pull
script:
# Build code again, in case caching didn't work
- mrt catkin build -s -rd --debug --default_yes --no-status $PACKAGE
# Run tests
- source devel_debug/setup.bash
- mrt catkin run_tests --no-status $PACKAGE --no-deps
# Summarize results
- catkin_test_results --verbose build_debug/$PACKAGE
- mkdir ../coverage
- cp -r build_debug/$PACKAGE/coverage ../coverage/$PACKAGE || true
# make coverage information available in gitlab
artifacts:
name: coverage
paths:
- coverage
expire_in: 6 mos
reports:
junit: catkin_ws/build_debug/$PACKAGE/test_results/$PACKAGE/*.xml
test_lanelet2_core:
<<: *test_job
variables:
PACKAGE: lanelet2_core
test_lanelet2_io:
<<: *test_job
variables:
PACKAGE: lanelet2_io
test_lanelet2_projection:
<<: *test_job
variables:
PACKAGE: lanelet2_projection
test_lanelet2_python:
<<: *test_job
variables:
PACKAGE: lanelet2_python
test_lanelet2_routing:
<<: *test_job
variables:
PACKAGE: lanelet2_routing
test_lanelet2_traffic_rules:
<<: *test_job
variables:
PACKAGE: lanelet2_traffic_rules
test_lanelet2_validation:
<<: *test_job
variables:
PACKAGE: lanelet2_validation
test_lanelet2_examples:
<<: *test_job
variables:
PACKAGE: lanelet2_examples
code_quality:
allow_failure: true
only: [master, merge_requests]
cache:
paths:
- catkin_ws/
policy: pull
artifacts:
paths: [gl-code-quality-report.json]
script:
# Build code again, in case caching didn't work
- mrt catkin build -s -rd --debug --default_yes --no-status $CI_PROJECT_NAME
- source devel_debug/setup.bash
- cd src/$CI_PROJECT_NAME
- rm codeclimate.json || true
- cp ../../../gl-code-quality-report.json codeclimate.json || true
- mrt ci codequality $LANELET2_PACKAGES
- cp codeclimate.json ../../../gl-code-quality-report.json
pages:
before_script: []
stage: deploy
script:
# everything in the public folder will be available as website
- mkdir public
- cp -r coverage public/ || true
- cp -r doxygen public/
artifacts:
paths:
- public
only:
# only execute for master branch
- master