-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
114 lines (102 loc) · 3.08 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
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update -yq && apt-get install -y curl file git lintian lsb-release
- export DISTRO_CODENAME=`lsb_release -cs` && echo Using distro $DISTRO_CODENAME
- export DEB_ARCH=`dpkg --print-architecture` && echo architecture $DEB_ARCH
- echo "deb http://apt.roboception.de/stable $DISTRO_CODENAME main" > /etc/apt/sources.list.d/roboception-stable.list
- if [ "$TESTING_DEBS" = "true" ]; then echo "deb http://apt.roboception.de/testing $DISTRO_CODENAME main" > /etc/apt/sources.list.d/roboception-testing.list ; fi
- curl -fsSL http://apt.roboception.de/archive.key | apt-key add -
- apt-get update -yq
- rosdep install --from-paths . --ignore-src -r -y
variables:
GET_SOURCES_ATTEMPTS: "3"
GIT_DEPTH: "0"
stages:
- build_msgs
- test
- deploy
#########################
# Templates using anchors
#########################
.amd64_focal_t: &amd64_focal_job
image: ros:noetic-perception
tags:
- amd64
- docker
#############
# Templates
#############
.test:
stage: test
script:
- dpkg -i ./rc_reason_msgs/build/*~${DISTRO_CODENAME}_${DEB_ARCH}.deb || true
- apt-get -f -y install
- cd rc_reason_clients
- apt-get install -y python3-pytest
- python3 -m pytest -s -vvv
# Debian packaging
.package:
script:
- dpkg -i ${CI_PROJECT_DIR}/rc_reason_msgs/build/*~${DISTRO_CODENAME}_${DEB_ARCH}.deb || true
- if [ -n "$PROJECT" ]; then cd $PROJECT; fi
- mkdir build && cd build
- cmake -DCATKIN_BUILD_BINARY_PACKAGE="1" -DCMAKE_INSTALL_PREFIX="/opt/ros/$ROS_DISTRO" -DCMAKE_PREFIX_PATH="/opt/ros/$ROS_DISTRO" -DCMAKE_BUILD_TYPE=Release ..
- make -j 4
- make package
- DEBS=$(find $CI_PROJECT_DIR -maxdepth 3 -name "*~${DISTRO_CODENAME}_${DEB_ARCH}.deb")
- echo "DEBS=$DEBS"
- if [ -n "$APT_REPO" ]; then upload_deb.sh $DISTRO_CODENAME-$APT_REPO $DEBS; fi
.build_msgs:
extends: .package
stage: build_msgs
variables:
PROJECT: "rc_reason_msgs"
artifacts:
paths:
- rc_reason_msgs/build/*.deb
expire_in: 30 days
.package_testing:
extends: .package
stage: deploy
only:
- master
except:
- tags
variables:
PROJECT: "rc_reason_clients"
APT_REPO: "testing"
.package_stable:
extends: .package
stage: deploy
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+/
except:
- branches
variables:
PROJECT: "rc_reason_clients"
APT_REPO: "stable"
##############
#### Jobs ####
##############
build_msgs:focal:amd64:
<<: *amd64_focal_job
extends: .build_msgs
# Test clients with previously build msgs (on every commit)
###########################################################
test:focal:amd64:
<<: *amd64_focal_job
extends: .test
################################
# package and upload for testing
# (only on master)
################################
package_testing:focal:amd64:
<<: *amd64_focal_job
extends: .package_testing
###################################
# package and upload for stable
# (only for releases, version tags)
###################################
package_stable:focal:amd64:
<<: *amd64_focal_job
extends: .package_stable