-
Notifications
You must be signed in to change notification settings - Fork 287
/
.gitlab-ci.yml
229 lines (207 loc) · 6.49 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
######################
# Documentation:
# - Gitlab CI results are pushed on https://gitlab.com/visp-ci
# - https://gitlab.com/visp-ci/visp-mirror mirrors https://github.com/lagadic/visp
######################
######################
# Stages
######################
stages:
- test-build
- test-install
- test-pkgconfig
######################
# Unix templates
######################
.build_template: &unix_build_definition
stage: test-build
script:
- echo $CI_BUILDS_DIR
- echo $CI_PROJECT_DIR
- echo $HOME
- ls -als $HOME
- ls /
- pwd
#- source ${HOME}/.bashrc # Doesn't work !
- export VISP_INPUT_IMAGE_PATH="${HOME}/visp-ci/visp-images"
- echo $VISP_INPUT_IMAGE_PATH
#- ls $VISP_INPUT_IMAGE_PATH
- cmake --version
- mkdir -p build
- mkdir -p install
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/install
- make -j $nproc install
- ctest -j $nproc
artifacts:
paths:
- install
when: on_success
expire_in: 1 week
except:
- tags
.install_template: &unix_install_definition
stage: test-install
script:
- cd example
- mkdir build
- cd build
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CI_PROJECT_DIR/install/lib
- cmake .. -DVISP_DIR=$CI_PROJECT_DIR/install/lib/cmake/visp
- make -j $nproc
.pkgconfig_template: &unix_pkgconfig_definition
stage: test-pkgconfig
script:
- mkdir pkgconfig
- cd pkgconfig
- git clone https://github.com/lagadic/visp_test_pkg_config
- cd visp_test_pkg_config
- mkdir build
- cd build
- PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$CI_PROJECT_DIR/install/lib/pkgconfig
- echo $PKG_CONFIG_PATH
- ls $CI_PROJECT_DIR/install/lib/pkgconfig
- cmake ..
- make -j $nproc
######################
# Windows templates
######################
.build_template: &windows_build_definition
tags:
- windows
stage: test-build
script:
- $ErrorActionPreference = "Stop"
- if($Env:project_platform -eq "x64") {
$CMAKE_PLATFORM = "x64";
}
else {
$CMAKE_PLATFORM = "Win32";
}
- $VS_BUILD_TOOLS = "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
- $CMAKE_BIN = "${VS_BUILD_TOOLS}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin"
- $VISP_INSTALL_PREFIX = "${CI_PROJECT_DIR}\$Env:cmake_install_prefix"
- $VISP_DLL_PATH = "${VISP_INSTALL_PREFIX}\x64\vc16\bin"
- $Env:Path = "$Env:Path;${CMAKE_BIN};${VISP_DLL_PATH}"
- $Env:Path
- pwd
- dir
- dir ${CI_PROJECT_DIR}
- cmake --version
# Get visp-images
- cd ${CI_PROJECT_DIR}
- mkdir visp-images
- cd visp-images
- git clone https://github.com/lagadic/visp-images.git
- $VISP_INPUT_IMAGE_PATH = "${CI_PROJECT_DIR}\visp-images\visp-images"
- dir $VISP_INPUT_IMAGE_PATH
# Build, install and test
- cd ${CI_PROJECT_DIR}
- mkdir build
- mkdir $Env:cmake_install_prefix
- cd build
- cmake -G $Env:generator -A $Env:cmake_platform -D CMAKE_INSTALL_PREFIX=${VISP_INSTALL_PREFIX} ..
- cmake --build . --config $Env:cmake_configuration --target INSTALL
- cmake --build . --config $Env:cmake_configuration --target RUN_TESTS
artifacts:
paths:
#- $Env:cmake_install_prefix # does not work. Use rather next line
- install
when: on_success
expire_in: 1 week
.install_template: &windows_install_definition
stage: test-install
script:
- $ErrorActionPreference = "Stop"
- if($Env:project_platform -eq "x64") {
$CMAKE_PLATFORM = "x64";
}
else {
$CMAKE_PLATFORM = "Win32";
}
- $VS_BUILD_TOOLS = "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
- $CMAKE_BIN = "${VS_BUILD_TOOLS}\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin"
- $VISP_INSTALL_PREFIX = "${CI_PROJECT_DIR}\$Env:cmake_install_prefix"
- $VISP_DLL_PATH = "${VISP_INSTALL_PREFIX}\x64\vc16\bin"
- $Env:Path = "$Env:Path;${CMAKE_BIN};${VISP_DLL_PATH}"
- pwd
- dir
- dir $CI_PROJECT_DIR
- dir $VISP_DLL_PATH
- dir $VISP_INSTALL_PREFIX
- cd example
- dir
- mkdir build
- cd build
- cmake --verbose -G $Env:generator -A $Env:cmake_platform -D VISP_DIR=${VISP_INSTALL_PREFIX} ..
- cmake --build . --config $Env:cmake_configuration --target ALL_BUILD
######################
# Test Ubuntu 20.04
######################
ubuntu20-04-build:
<<: *unix_build_definition
tags:
- linux
image: "vispci/vispci:ubuntu-20.04"
ubuntu20-04-install:
<<: *unix_install_definition
needs:
- job: "ubuntu20-04-build"
artifacts: true
tags:
- linux
image: "vispci/vispci:ubuntu-20.04"
ubuntu20-04-pkgconfig:
<<: *unix_pkgconfig_definition
needs:
- job: "ubuntu20-04-build"
artifacts: true
tags:
- linux
image: "vispci/vispci:ubuntu-20.04"
######################
# Test Ubuntu 18.04
######################
ubuntu18-04-build:
<<: *unix_build_definition
tags:
- linux
image: "vispci/vispci:ubuntu-18.04"
ubuntu18-04-install:
<<: *unix_install_definition
needs:
- job: "ubuntu18-04-build"
artifacts: true
tags:
- linux
image: "vispci/vispci:ubuntu-18.04"
ubuntu18-04-pkgconfig:
<<: *unix_pkgconfig_definition
needs:
- job: "ubuntu18-04-build"
artifacts: true
tags:
- linux
image: "vispci/vispci:ubuntu-18.04"
######################
# Test Windows 10
######################
windows-cmake-x64-release-build:
<<: *windows_build_definition
before_script:
- $Env:generator = "Visual Studio 16 2019"
- $Env:cmake_platform = "x64"
- $Env:cmake_configuration = "Release"
- $Env:cmake_install_prefix = "install"
windows-cmake-x64-release-install:
<<: *windows_install_definition
needs:
- job: "windows-cmake-x64-release-build"
artifacts: true
before_script:
- $Env:generator = "Visual Studio 16 2019"
- $Env:cmake_platform = "x64"
- $Env:cmake_configuration = "Release"
- $Env:cmake_install_prefix = "install"
tags:
- windows