-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
173 lines (163 loc) · 4.76 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
169
170
171
172
173
---
# Copyright (c) 2020 Jakob Meng, <jakobmeng@web.de>
# vim:set fileformat=unix tabstop=2 shiftwidth=2 expandtab:
# kate: end-of-line unix; space-indent on; indent-width 2; remove-trailing-spaces modified;
variables:
# The cache and install prefix paths must be relative to and reside inside the project directory ($CI_PROJECT_DIR),
# because cache:paths and artifacts:paths do not support absolute paths or linking outside the project directory.
# Ref.: https://docs.gitlab.com/ce/ci/yaml/README.html
BUILD_DIR: '$CI_PROJECT_DIR/build/${CC}-${CXX}-${BUILD_TYPE}'
CCACHE_DIR: '$CI_PROJECT_DIR/.cache/ccache/${CC}-${CXX}-${BUILD_TYPE}'
INSTALL_PREFIX: '$CI_PROJECT_DIR/.local/${CC}-${CXX}-${BUILD_TYPE}'
# PATH variable cannot be set here
# Ref.: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27226
default:
cache:
paths:
- .cache
.build-linux: &build-linux
artifacts:
paths:
- .local
- build
before_script:
- export PATH=/usr/lib/ccache:$PATH
- whoami
- nproc
- echo `which $CC`
- echo `which $CXX`
- cmake --version
- ctest --version
- ccache -s
# Symbol visibility is set to default because Boost.Test 1.67
# from Debian 10 (Buster) has issues with hidden symbols
# Ref.: https://github.com/boostorg/test/issues/199
- >
export BOOST_VERSION="$(grep -F '#define BOOST_VERSION ' /usr/include/boost/version.hpp | awk '{ print $3; }')";
echo "BOOST_VERSION: $BOOST_VERSION";
if [ "$BOOST_VERSION" = "106700" ]; then
CMAKE_VISIBILITY_OPTIONS=\
' -DCMAKE_CXX_VISIBILITY_PRESET=default'\
' -DCMAKE_C_VISIBILITY_PRESET=default '\
' -DCMAKE_VISIBILITY_INLINES_HIDDEN=OFF' ;
else
CMAKE_VISIBILITY_OPTIONS= ;
fi
# Build hbrs-cmake
- mkdir -p "$INSTALL_PREFIX/src" && cd "$INSTALL_PREFIX/src"
- >
if [ ! -e hbrs-cmake ]; then
git clone --depth 1 https://github.com/JM1/hbrs-cmake.git &&
cd hbrs-cmake/;
else
cd hbrs-cmake/ &&
git reset --hard origin &&
git pull;
fi
- if [ ! -e build ]; then mkdir build; fi
- cd build/
- >
cmake \
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \
"-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" \
..
- make "-j$(nproc)"
- make install
- cd ../../
script:
- export PATH=/usr/lib/ccache:$PATH
- ccache -s
- cd "$CI_PROJECT_DIR"
- if [ ! -e "$BUILD_DIR" ]; then mkdir -p "$BUILD_DIR"; fi
- cd "$BUILD_DIR"
- >
cmake \
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \
"-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" \
-DHBRS_MPL_ENABLE_TESTS=ON \
-DHBRS_MPL_ENABLE_BENCHMARKS=ON \
-DHBRS_MPL_ENABLE_ELEMENTAL=ON \
-DHBRS_MPL_ENABLE_MATLAB=OFF \
$CMAKE_VISIBILITY_OPTIONS \
"$CI_PROJECT_DIR" || { cat CMakeFiles/CMakeError.log; exit 255; };
- make "-j$(nproc)"
- ccache -s
- make install
.test-linux: &test-linux
script:
- cd "$BUILD_DIR"
- for i in $(seq 5); do ctest --output-on-failure || exit 255; done
.matrix-gcc7-clang7: &matrix-gcc7-clang7
parallel:
matrix:
- CC: gcc-7
CXX: g++-7
BUILD_TYPE: Debug
- CC: gcc-7
CXX: g++-7
BUILD_TYPE: MinSizeRel
- CC: gcc-7
CXX: g++-7
BUILD_TYPE: RelWithDebInfo
- CC: gcc-7
CXX: g++-7
BUILD_TYPE: Release
- CC: clang-7
CXX: clang++-7
BUILD_TYPE: Debug
- CC: clang-7
CXX: clang++-7
BUILD_TYPE: Release
build-linux-debian-buster:
extends: .build-linux
stage: build
image: jm1337/debian-dev-hbrs:buster
cache:
key: "linux-debian-buster"
<<: *matrix-gcc7-clang7
test-linux-debian-buster:
extends: .test-linux
stage: test
image: jm1337/debian-dev-hbrs:buster
cache: {}
<<: *matrix-gcc7-clang7
needs:
- job: build-linux-debian-buster
artifacts: true
.matrix-gcc10-clang10: &matrix-gcc10-clang10
parallel:
matrix:
- CC: gcc-10
CXX: g++-10
BUILD_TYPE: Debug
- CC: gcc-10
CXX: g++-10
BUILD_TYPE: MinSizeRel
- CC: gcc-10
CXX: g++-10
BUILD_TYPE: RelWithDebInfo
- CC: gcc-10
CXX: g++-10
BUILD_TYPE: Release
- CC: clang-10
CXX: clang++-10
BUILD_TYPE: Debug
- CC: clang-10
CXX: clang++-10
BUILD_TYPE: Release
build-linux-debian-bullseye:
extends: .build-linux
stage: build
image: jm1337/debian-dev-hbrs:bullseye
cache:
key: "linux-debian-bullseye"
<<: *matrix-gcc10-clang10
test-linux-debian-bullseye:
extends: .test-linux
stage: test
image: jm1337/debian-dev-hbrs:bullseye
cache: {}
<<: *matrix-gcc10-clang10
needs:
- job: build-linux-debian-bullseye
artifacts: true