forked from DFKI-NI/mir_robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
62 lines (51 loc) · 2.35 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
image: ros:kinetic
before_script:
# Install ssh-agent if not already installed
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
build:
stage: build
tags:
- docker
script:
- export LANG="en_US.UTF-8"
- export LC_ALL=$LANG
- export CI_ROS_DISTRO="kinetic"
- export CATKIN_WS=~/catkin_ws
- export CATKIN_WS_SRC=${CATKIN_WS}/src
- export CATKIN_PROJECT_DIR=$CATKIN_WS_SRC/mir_robot
# create a catkin workspace
- mkdir -p $CATKIN_WS_SRC
- cd $CATKIN_WS_SRC/
- ln -s $CI_PROJECT_DIR $CATKIN_PROJECT_DIR # outside CI, run this instead: git clone -b kinetic https://github.com/dfki-ric/mir_robot.git
# use rosdep to install all dependencies (including ROS itself)
- apt-get update -qq
- apt-get install -qq -y python-rosdep
# - sudo rosdep init # not needed in CI, because the Docker image already has rosdep initialized
- rosdep update
- rosdep install --from-paths ./ -i -y --rosdistro $CI_ROS_DISTRO
# build all packages in the catkin workspace
- source /opt/ros/${CI_ROS_DISTRO}/setup.bash
- catkin_init_workspace
- cd $CATKIN_WS
- catkin_make -DCMAKE_BUILD_TYPE=Release install
- source install/setup.bash # not strictly necessary, but checks if everything was properly installed
# NOTE on testing: `catkin_make run_tests` will show the output of the tests
# (gtest, nosetest, etc..) but always returns 0 (success) even if a test
# fails. Running `catkin_test_results` aggregates all the results and returns
# non-zero when a test fails (which notifies Gitlab CI that the build failed).
- catkin_make -DCMAKE_BUILD_TYPE=Release run_tests
- catkin_test_results
# catkin_lint
- apt-get install -y python-catkin-lint
- cd $CATKIN_PROJECT_DIR
- catkin_lint .