-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
197 lines (172 loc) · 5 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
before_script:
- export DISTRO_CODENAME=`lsb_release -cs` && echo Using distro $DISTRO_CODENAME
- export ARCH_NAME=`uname -m` && echo Running on architecture $ARCH_NAME
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -yq && apt-get install -y --no-install-recommends lintian git wget libfltk1.3-dev
variables:
GET_SOURCES_ATTEMPTS: 3
#########################
# Templates using anchors
#########################
.amd64_focal_t: &amd64_focal_job
image: registry.roboception.de/tools/docker_images:focal-buildimage
tags:
- amd64
- docker
.armhf_focal_t: &armhf_focal_job
image: registry.roboception.de/tools/docker_images:armhf-focal-buildimage
tags:
- armhf
- docker
.amd64_jammy_t: &amd64_jammy_job
image: registry.roboception.de/tools/docker_images:jammy-buildimage
tags:
- amd64
- docker
.arm64_jammy_t: &arm64_jammy_job
image: registry.roboception.de/tools/docker_images:jammy-buildimage
tags:
- arm64
- docker
#############
# Templates
#############
.test:
stage: test
script:
- mkdir build && cd build
- cmake -DBUILD_RCDISCOVER_GUI=ON ..
- make -j 4
- CTEST_OUTPUT_ON_FAILURE=1 make test
# Debian packaging
.package:
stage: deploy
script:
- mkdir build && cd build
- if [ -n "$ROS_DISTRO" ]; then
cmake -DBUILD_RCDISCOVER_GUI=ON -DCMAKE_INSTALL_PREFIX="/opt/ros/$ROS_DISTRO" -DCMAKE_PREFIX_PATH="/opt/ros/$ROS_DISTRO" -DCMAKE_BUILD_TYPE=Release .. ;
else
cmake -DBUILD_RCDISCOVER_GUI=ON -DCMAKE_INSTALL_PREFIX="/usr" .. ;
fi
- make -j4 package
- if [ -z "$APT_REPO" ]; then export APT_REPO=testing; fi
- upload_deb.sh $DISTRO_CODENAME-$APT_REPO *.deb
.package_testing:
extends: .package
only:
- master
except:
- tags
variables:
TESTING_DEBS: "true"
APT_REPO: "testing"
.package_stable:
extends: .package
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+/
except:
- branches
variables:
APT_REPO: "stable"
.docker_build:
image: docker:latest
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- if [ -z "$IMAGE" ]; then export IMAGE=$CI_REGISTRY_IMAGE ; fi
- if [ -n "$CI_COMMIT_TAG" ]; then export IMAGE_TAG=$CI_COMMIT_TAG ; else export IMAGE_TAG=$CI_COMMIT_REF_SLUG ; fi
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then export IMAGE_TAG=testing ; fi
- if [ -z "$DOCKER_BUILD_FLAGS" ]; then export DOCKER_BUILD_FLAGS="--pull --no-cache"; fi
script:
- docker build $DOCKER_BUILD_FLAGS -t $IMAGE:$IMAGE_TAG .
- docker push $IMAGE:$IMAGE_TAG
- if [ -n "$CI_COMMIT_TAG" ]; then docker tag $IMAGE:$IMAGE_TAG $IMAGE:latest; docker push $IMAGE:latest; docker rmi $IMAGE:latest; fi
- docker rmi $IMAGE:$IMAGE_TAG || true
tags:
- docker-build
##############
#### Jobs ####
##############
gen_dox:
<<: *amd64_focal_job
image: ros:noetic-ros-core
variables:
TESTING_DEBS: "true"
stage: deploy
script:
- apt-get install -y doxygen ncftp ros-${ROS_DISTRO}-rosdoc-lite
- rosdoc_lite .
- make doc
- upload_dox.sh doc/html
only:
- master
- tags
tags:
- docs
build_appimage:
<<: *amd64_focal_job
script:
- mkdir build && cd build
- wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
- chmod 750 linuxdeploy-x86_64.AppImage
- cmake -DBUILD_RCDISCOVER_GUI=ON -DBUILD_RCDISCOVER_CLI=OFF -DBUILD_RCDISCOVER_SHARED_LIB=OFF -DCMAKE_INSTALL_PREFIX="/usr" ..
- make -j 4 install DESTDIR=AppDir
- export VERSION=`git describe --match "*[0-9].[0-9]*" HEAD`
- export APPIMAGE_EXTRACT_AND_RUN=1
- ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
- cd ..
- mv build/rcdiscover*.AppImage .
artifacts:
paths:
- rcdiscover*.AppImage
expire_in: 1 week
when: manual
# Test (on every commit)
########################
test:focal:amd64:
<<: *amd64_focal_job
extends: .test
test:focal:armhf:
<<: *armhf_focal_job
extends: .test
test:jammy:amd64:
<<: *amd64_jammy_job
extends: .test
test:jammy:arm64:
<<: *arm64_jammy_job
extends: .test
# Deploy testing (only on master)
#################################
package_testing:focal:amd64:
<<: *amd64_focal_job
extends: .package_testing
package_testing:focal:armhf:
<<: *armhf_focal_job
extends: .package_testing
package_testing:jammy:amd64:
<<: *amd64_jammy_job
extends: .package_testing
package_testing:jammy:arm64:
<<: *arm64_jammy_job
extends: .package_testing
# Deploy stable (only for releases, version tags)
#################################################
package_stable:focal:amd64:
<<: *amd64_focal_job
extends: .package_stable
package_stable:focal:armhf:
<<: *armhf_focal_job
extends: .package_stable
package_stable:jammy:amd64:
<<: *amd64_jammy_job
extends: .package_stable
test_release:jammy:arm64:
<<: *arm64_jammy_job
extends: .package_stable
# Build and push as docker image
################################
build:image:
stage: deploy
extends: .docker_build
except:
- schedules