-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
89 lines (83 loc) · 2.77 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
image: ubuntu:xenial
stages:
- build
- deploy
variables:
ROS_CI_DESKTOP: "`lsb_release -cs`"
CI_SOURCE_PATH: $CI_PROJECT_DIR
ROSINSTALL_FILE: $CI_SOURCE_PATH/dependencies.rosinstall
CATKIN_OPTIONS: $CI_SOURCE_PATH/catkin.options
PYTHONPATH: ${PYTHONPATH}:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages
ROS_DISTRO: kinetic
build:
stage: build
before_script:
- echo $HOME
- apt-get update
- apt-get install -y lsb-release lcov
- apt-get install -y gcc g++
- sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
- apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
- apt-get update
- apt-get install -y dpkg
- apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-${ROS_DISTRO}-catkin
- source /opt/ros/${ROS_DISTRO}/setup.bash
- rosdep init
- rosdep update
- cd src
- wstool init
- test -f "${ROSINSTALL_FILE}" && wstool merge "${ROSINSTALL_FILE}"
- wstool up
- cd ..
- rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
- echo $CI_PROJECT_DIR
- echo $ROS_HOME
script:
- catkin_make --cmake-args -DCOVERAGE=ON -DCMAKE_BUILD_TYPE=Debug
- echo $ROS_HOME
- lcov --initial --directory build --capture --output-file lcov.base
- catkin_make run_tests
- lcov --directory build --capture --output-file lcov.test
- lcov -a lcov.base -a lcov.test -o lcov.total
- lcov -r lcov.total 'tests/*' '/usr/*' '/opt/*' '*/CMakeCCompilerId.c' '*/CMakeCXXCompilerId.cpp' -o lcov.total.filtered
- COMMIT_REF_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- COVERAGE_REF_NAME="coverage_$COMMIT_REF_NAME"
- echo $COMMIT_REF_NAME
- genhtml -p "$PWD" --legend --demangle-cpp lcov.total.filtered -o $COVERAGE_REF_NAME
- mkdir public
- tar -czvf coverage.tar.gz $COVERAGE_REF_NAME
- ls
artifacts:
paths:
- coverage.tar.gz
docker-image:
stage: deploy
image: docker
services:
- docker:dind
script:
- echo $DOCKERHUB_USER
- echo $DOCKERHUB_PASS
- echo $DOCKERHUB_URL
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS $DOCKERHUB_URL
- docker build -t "$DOCKERHUB_USER/test_image" -f ./Dockerfile/Dockerfile.test .
- docker image ls
- docker push "$DOCKERHUB_USER/test_image"
only:
- release*
pages:
stage: deploy
image: alpine
dependencies:
- build
script:
- COMMIT_REF_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- COVERAGE_REF_NAME="coverage_$COMMIT_REF_NAME"
- tar -xzvf coverage.tar.gz
- mv $COVERAGE_REF_NAME public
artifacts:
name: $CI_JOB_NAME
paths:
- public
only:
- master