-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
168 lines (158 loc) · 4.95 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
.common:
stage: build
image: registry.gitlab.com/slavanap/ros-build/master:$CI_JOB_NAME
variables:
GIT_SUBMODULE_STRATEGY: recursive
ROBOT: "false"
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- build.tar
script:
- |
"$CI_PROJECT_DIR/.gitlab-ci/recover-ts.sh" '' HEAD
git submodule foreach --recursive "$CI_PROJECT_DIR/.gitlab-ci/recover-ts.sh" '' HEAD
if [[ "$CI_COMMIT_REF_NAME" != "master" ]] && [[ -f build.tar ]]; then
tar xf build.tar
rm build.tar
else
mkdir -p .build/main
ln -s "$(pwd)" .build/main/src
fi
if [[ "$ROBOT" == "true" ]]; then
touch \
hmi/CATKIN_IGNORE \
behavior/sweetie_bot_voice/CATKIN_IGNORE \
behavior/sweetie_bot_gait_generator/CATKIN_IGNORE \
inc/ifopt/CATKIN_IGNORE \
inc/ifopt/ifopt_core/CATKIN_IGNORE \
inc/ifopt/ifopt_ipopt/CATKIN_IGNORE \
inc/ifopt/ifopt_snopt/CATKIN_IGNORE \
inc/towr/towr/CATKIN_IGNORE \
inc/towr/towr_ros/CATKIN_IGNORE
else
touch \
hardware/sweetie_bot_self_test/CATKIN_IGNORE \
hardware/sweetie_bot_touch/CATKIN_IGNORE
fi
- |
source "/opt/ros/$ROS_DISTRO/setup.bash"
pushd .build/main
rosdep check --from-paths src --ignore-src --rosdistro "$ROS_DISTRO" 2>roscheck.tmp \
cat roscheck.tmp >&2 && ! grep ERROR roscheck.tmp >/dev/null && rm roscheck.tmp
catkin_make_isolated \
$CMAKE_TOOLCHAIN_ARG --install --install-space "/opt/ros/sweetie_bot" \
-DCMAKE_BUILD_TYPE=Release -DLOGGER_DEFAULT=LoggerRosout -DCMAKE_CXX_STANDARD=11
popd
- |
source /src/base/buildpkg.bash
BASE_VERSION="$DEB_VERSION"
DEB_VERSION="${BASE_VERSION%~*}-${CI_JOB_ID}~${BASE_VERSION#*~}"
DEB_NAME="ros-${ROS_DISTRO}-sweetie-bot$PKG_SUFFIX"
DEB_DESCRIPTION="Package $DEB_NAME for $ROS_DISTRO"
DEB_HOMEPAGE="http://sweetiebot.net/"
buildpkg "/opt/ros/sweetie_bot" "sweetie-bot.deb" "ros-${ROS_DISTRO}-sweetie-bot-base$PKG_SUFFIX (=${BASE_VERSION})" \
libspeechd-dev \
portaudio19-dev \
ros-noetic-joint-state-publisher-gui \
ros-noetic-rqt ros-noetic-rqt-service-caller \
ros-noetic-joy \
autotalent \
python3-speechd \
python3-requests \
python3-pyaudio \
opus-tools \
lame \
|| echo "ret code $?"
mv sweetie-bot.deb "$CI_PROJECT_DIR/sweetie-bot-${CI_JOB_NAME}-${CI_JOB_ID}.deb"
cp -a /src/base/sweetie-bot-base.deb "$CI_PROJECT_DIR/sweetie-bot-base-${CI_JOB_NAME}-${CI_JOB_ID}.deb"
- |
cd "$CI_PROJECT_DIR"
if [[ "$CI_COMMIT_REF_NAME" != "master" ]]; then
tar cf build.tar .build
fi
artifacts:
name: sweetie-bot-${CI_JOB_NAME}
expire_in: 3 weeks
paths:
- "sweetie-bot-*.deb"
.common-robot:
extends: .common
variables:
ROBOT: "true"
.common-test:
stage: test
image: docker:20.10.17
services:
- docker:20.10.17-dind
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
script:
- docker build -t test --build-arg image="$IMAGE_SOURCE" -f .gitlab-ci/test.dockerfile .
- docker create --name temp test
- docker cp temp:/home/dev/.ros/log ./__log || true
- docker cp temp:/home/dev/screenshot.png . || true
- docker cp temp:/home/dev/diff.png . || true
- docker cp temp:/home/dev/screenshot-towr.png . || true
- docker cp temp:/home/dev/diff-towr.png . || true
- docker cp temp:/home/dev/retcode . && cat ./retcode
- exit $(cat ./retcode)
artifacts:
expire_in: 3 weeks
paths:
- screenshot*.png
- diff*.png
- __log/
when: always
focal-amd64:
extends: .common
focal-tinker:
extends: .common-robot
focal-arm64v8:
extends: .common-robot
focal-amd64-test:
extends: .common-test
dependencies:
- focal-amd64
variables:
IMAGE_SOURCE: ubuntu:focal
pages:
stage: deploy
image: ubuntu:bionic
dependencies:
- focal-amd64
- focal-tinker
- focal-arm64v8
only:
- master
artifacts:
expire_in: 1 day
paths:
- public
script:
- apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends reprepro
- gpg --batch --passphrase "$SINGING_PASSPHRASE" -o priv.asc -d .gitlab-ci/priv.asc.gpg && gpg --import priv.asc; rm priv.asc
- |
mkdir -p public/conf || true
cd public
cp ../repository.key ../install.bash .
touch conf/options
- |
cat > conf/distributions <<EOF
Origin: $CI_PROJECT_NAMESPACE.gitlab.io
Codename: focal
Architectures: armhf arm64 amd64
Components: main
Description: no description
SignWith: yes
EOF
- |
shopt -s nullglob
for dist in focal; do
for f in $CI_PROJECT_DIR/*${dist}*.deb; do
reprepro -S utils includedeb "$dist" "$f"
done
done
- rm -rf ~/.gnupg