forked from autowarefoundation/autoware_ai_simulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
141 lines (131 loc) · 6 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
stages:
- build
- deploy
variables:
VCS_FILE: build_depends.repos
AUTOWARE_CROSS_TARGET_PLATFORM: generic-aarch64
.build: &build_common
before_script:
- mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- sudo apt-get update
- sudo apt-get install -y libarmadillo-dev libglew-dev libssh2-1-dev python-flask python-requests wget lcov
- sudo apt-get install -y python3-pip python3-setuptools python3-colcon-common-extensions python3-vcstool
# Update setuptools from PyPI because the version Ubuntu ships with is too old
- pip3 install -U setuptools
- vcs validate < $VCS_FILE
- vcs import src/ < $VCS_FILE
- rosdep update
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
script:
# We first build the entire workspace normally
- source /opt/ros/${ROS_DISTRO}/setup.bash
- colcon build --cmake-args -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_BUILD_TYPE=Debug
# And then build the tests target. catkin (ROS1) packages add their tests to the tests target
# which is not the standard target for CMake projects. We need to trigger the tests target so that
# tests are built and any fixtures are set up.
- colcon build --cmake-target tests --cmake-args -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" -DCMAKE_BUILD_TYPE=Debug
- lcov --initial --directory build --capture --output-file lcov.base
- colcon test
- colcon test-result --verbose
- lcov --directory build --capture --output-file lcov.test
- lcov -a lcov.base -a lcov.test -o lcov.total
- lcov -r lcov.total '*/tests/*' '*/test/*' '*/build/*' '*/devel/*' '*/install/*' '*/log/*' '/usr/*' '/opt/*' '/tmp/*' '*/CMakeCCompilerId.c' '*/CMakeCXXCompilerId.cpp' -o lcov.total.filtered
# BRANCH_NAME: gets branch name from CI_COMMIT_REF_NAME variable substituting / with _ (feature/test_this_lib becomes feature_test_this_lib)
# CI_COMMIT_REF_NAME: (from https://docs.gitlab.com/ee/ci/variables/) The branch or tag name for which project is built
- BRANCH_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- COVERAGE_FOLDER_NAME="coverage_$BRANCH_NAME"
- genhtml -p "$PWD" --legend --demangle-cpp lcov.total.filtered -o $COVERAGE_FOLDER_NAME
- tar -czvf coverage.tar.gz $COVERAGE_FOLDER_NAME
artifacts:
paths:
- $CI_PROJECT_DIR/coverage.tar.gz
expire_in: 48 hrs
coverage: /\s*lines.*:\s(\d+\.\d+\%\s\(\d+\sof\s\d+.*\))/
.build_cuda: &build_cuda
before_script:
- mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- sudo apt-get update
- sudo apt-get install -y libarmadillo-dev libglew-dev libssh2-1-dev python-flask python-requests wget
- sudo apt-get install -y python3-pip python3-setuptools python3-colcon-common-extensions python3-vcstool
# Update setuptools from PyPI because the version Ubuntu ships with is too old
- pip3 install -U setuptools
- vcs validate < $VCS_FILE
- vcs import src/ < $VCS_FILE
- rosdep update
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
script:
# We first build the entire workspace normally
- source /opt/ros/${ROS_DISTRO}/setup.bash
- colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug
# And then build the tests target. catkin (ROS1) packages add their tests to the tests target
# which is not the standard target for CMake projects. We need to trigger the tests target so that
# tests are built and any fixtures are set up.
- colcon build --cmake-target tests --cmake-args -DCMAKE_BUILD_TYPE=Debug
- colcon test
- colcon test-result --verbose
.build_cross_vars: &build_cross_vars
AUTOWARE_TARGET_ARCH: aarch64
AUTOWARE_TOOLCHAIN_FILE_PATH: $CI_PROJECT_DIR/cross_toolchain.cmake
AUTOWARE_SYSROOT: /sysroot/${AUTOWARE_CROSS_TARGET_PLATFORM}
.build_cross: &build_cross_common
script:
- mkdir -p src_tmp/$CI_PROJECT_NAME && mv `find -maxdepth 1 -not -name . -not -name src_tmp -not -name $VCS_FILE` src_tmp/$CI_PROJECT_NAME && mv src_tmp/ src/
- apt update -qq && apt install -y python3-vcstool git wget
- wget https://gitlab.com/autowarefoundation/autoware.ai/docker/raw/master/crossbuild/cross_toolchain.cmake
- source ${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}/setup.bash
- vcs validate < $VCS_FILE
- vcs import src/ < $VCS_FILE
- colcon build
--merge-install
--cmake-args
-DCMAKE_TOOLCHAIN_FILE=${AUTOWARE_TOOLCHAIN_FILE_PATH}
-DCMAKE_SYSTEM_PROCESSOR=${AUTOWARE_TARGET_ARCH}
-DCMAKE_PREFIX_PATH="${CI_PROJECT_DIR}/install;${AUTOWARE_SYSROOT}/opt/ros/${ROS_DISTRO}"
-DCMAKE_FIND_ROOT_PATH=${CI_PROJECT_DIR}/install
build_melodic:
stage: build
image: autoware/autoware:bleedingedge-melodic-base
<<: *build_common
only:
- merge_requests
- master
build_melodic_arm:
tags:
- arm64
stage: build
image: autoware/arm64v8:bleedingedge-melodic-base
<<: *build_common
only:
- branches@autowarefoundation/autoware.ai/simulation
build_melodic_cuda:
stage: build
image: autoware/autoware:bleedingedge-melodic-base-cuda
<<: *build_cuda
only:
- merge_requests
- master
build_melodic_cross:
stage: build
image: autoware/build:${AUTOWARE_CROSS_TARGET_PLATFORM}-melodic-bleedingedge
variables:
ROS_DISTRO: melodic
<<: *build_cross_vars
<<: *build_cross_common
only:
- merge_requests
- master
pages:
stage: deploy
image: alpine
dependencies:
- build_melodic
script:
- BRANCH_NAME="$(echo $CI_COMMIT_REF_NAME | sed 's/\//_/g')"
- COVERAGE_FOLDER_NAME="coverage_$BRANCH_NAME"
- tar -xzvf coverage.tar.gz
- mv $COVERAGE_FOLDER_NAME public
artifacts:
paths:
- public
only:
- master