Skip to content

Commit 1557385

Browse files
committed
Merge branch 'gitlab-ci' into 'master'
Set up GitLab CI See merge request nublar/pdal-c!1
2 parents 4ac443d + b457183 commit 1557385

File tree

6 files changed

+255
-11
lines changed

6 files changed

+255
-11
lines changed

.gitlab-ci.yml

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
#---------------
2+
# Windows Builds
3+
#---------------
4+
.job_template: &build-windows
5+
stage: build
6+
script:
7+
- set TARGET_PLATFORM=%CI_JOB_NAME%
8+
- set TOOLCHAIN=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake
9+
- rd /s /q "%CI_PROJECT_DIR%/build/%TARGET_PLATFORM%"
10+
- mkdir "%CI_PROJECT_DIR%/build/%TARGET_PLATFORM%"
11+
- cd "%CI_PROJECT_DIR%/build/%TARGET_PLATFORM%"
12+
- cmake "%CI_PROJECT_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_TOOLCHAIN_FILE=%TOOLCHAIN% -DVCPKG_TARGET_TRIPLET=%TRIPLET% -DCMAKE_GENERATOR_PLATFORM=%ARCH%
13+
- cmake --build . --target INSTALL --config %BUILD_TYPE%
14+
cache:
15+
untracked: true
16+
policy: push
17+
artifacts:
18+
untracked: true
19+
expire_in: 1 week
20+
21+
build-x64-windows-release:
22+
<<: *build-windows
23+
tags:
24+
- windows
25+
- release
26+
before_script:
27+
- set ARCH=x64
28+
- set BUILD_TYPE=Release
29+
- set TRIPLET=x64-windows
30+
cache:
31+
key: build-x64-windows-release
32+
paths:
33+
- build/build-x64-windows-release/bin/
34+
- build/build-x64-windows-release/data/
35+
artifacts:
36+
paths:
37+
- build/build-x64-windows-release/bin/*.dll
38+
- build/build-x64-windows-release/include/*.h
39+
40+
build-x64-windows-debug:
41+
<<: *build-windows
42+
tags:
43+
- windows
44+
- debug
45+
before_script:
46+
- set ARCH=x64
47+
- set BUILD_TYPE=Debug
48+
- set TRIPLET=x64-windows
49+
cache:
50+
key: build-x64-windows-debug
51+
paths:
52+
- build/build-x64-windows-debug/bin/
53+
- build/build-x64-windows-debug/data/
54+
artifacts:
55+
paths:
56+
- build/build-x64-windows-debug/bin/*.dll
57+
- build/build-x64-windows-debug/include/*.h
58+
59+
#---------------
60+
# Windows Tests
61+
#---------------
62+
.job_template: &test-windows
63+
tags:
64+
- windows
65+
stage: test
66+
cache:
67+
policy: pull
68+
69+
test-x64-windows-release:
70+
<<: *test-windows
71+
dependencies:
72+
- build-x64-windows-release
73+
before_script:
74+
- cd %VCPKG_ROOT%/installed/x64-windows/bin
75+
script:
76+
- "%CI_PROJECT_DIR%/build/build-x64-windows-release/bin/test_pdal_c"
77+
cache:
78+
key: build-x64-windows-release
79+
paths:
80+
- build/build-x64-windows-release/bin/
81+
82+
test-x64-windows-debug:
83+
<<: *test-windows
84+
dependencies:
85+
- build-x64-windows-debug
86+
before_script:
87+
- cd %VCPKG_ROOT%/installed/x64-windows/debug/bin
88+
script:
89+
- "%CI_PROJECT_DIR%/build/build-x64-windows-debug/bin/test_pdal_cd"
90+
cache:
91+
key: build-x64-windows-debug
92+
paths:
93+
- build/build-x64-windows-debug/bin/
94+
95+
#--------------
96+
# Linux Builds
97+
#--------------
98+
#
99+
.job_template: &build-linux
100+
stage: build
101+
script:
102+
- export TARGET_PLATFORM=$CI_JOB_NAME
103+
- echo "Building $CI_PROJECT_NAME ($CI_COMMIT_REF_NAME branch) for $TARGET_PLATFORM"
104+
- rm -rf "$CI_PROJECT_DIR/build/$TARGET_PLATFORM"
105+
- mkdir -p "$CI_PROJECT_DIR/build/$TARGET_PLATFORM"
106+
- cd "$CI_PROJECT_DIR/build/$TARGET_PLATFORM"
107+
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPDALC_GCC_PARAM_GGC_MIN_HEAPSIZE=8192 "$CI_PROJECT_DIR"
108+
- make
109+
- make install
110+
variables:
111+
GIT_STRATEGY: clone
112+
cache:
113+
untracked: true
114+
key: "$CI_JOB_NAME"
115+
policy: push
116+
paths:
117+
- build/$CI_JOB_NAME/bin/
118+
- build/$CI_JOB_NAME/lib/
119+
- build/$CI_JOB_NAME/data/
120+
artifacts:
121+
untracked: true
122+
expire_in: 1 week
123+
paths:
124+
- build/$CI_JOB_NAME/lib/
125+
- build/$CI_JOB_NAME/include/*.h
126+
127+
build-x64-linux-release-ubuntu:
128+
<<: *build-linux
129+
tags:
130+
- linux
131+
- pdal
132+
- docker
133+
- release
134+
- ubuntu
135+
before_script:
136+
- export BUILD_TYPE=Release
137+
138+
build-x64-linux-debug-ubuntu:
139+
<<: *build-linux
140+
tags:
141+
- linux
142+
- pdal
143+
- docker
144+
- debug
145+
- ubuntu
146+
before_script:
147+
- export BUILD_TYPE=Debug
148+
149+
build-x64-linux-release-alpine:
150+
<<: *build-linux
151+
tags:
152+
- linux
153+
- pdal
154+
- docker
155+
- release
156+
- alpine
157+
before_script:
158+
- export BUILD_TYPE=Release
159+
160+
build-x64-linux-debug-alpine:
161+
<<: *build-linux
162+
tags:
163+
- linux
164+
- pdal
165+
- docker
166+
- debug
167+
- alpine
168+
before_script:
169+
- export BUILD_TYPE=Debug
170+
171+
#---------------
172+
# Linux Tests
173+
#---------------
174+
.job_template: &test-linux
175+
stage: test
176+
script:
177+
- make coverage_pdal_c
178+
- ls -l
179+
cache:
180+
key: "$CI_JOB_NAME"
181+
policy: pull
182+
183+
test-x64-linux-release-alpine:
184+
<<: *test-linux
185+
tags:
186+
- linux
187+
- pdal
188+
- release
189+
- alpine
190+
dependencies:
191+
- build-x64-linux-release-alpine
192+
before_script:
193+
- cd build/build-x64-linux-release-alpine
194+
artifacts:
195+
paths:
196+
- build/build-x64-linux-release-alpine/coverage_pdal_c
197+
198+
test-x64-linux-debug-alpine:
199+
<<: *test-linux
200+
tags:
201+
- linux
202+
- pdal
203+
- debug
204+
- alpine
205+
dependencies:
206+
- build-x64-linux-debug-alpine
207+
before_script:
208+
- cd build/build-x64-linux-debug-alpine
209+
artifacts:
210+
paths:
211+
- build/build-x64-linux-debug-alpine/coverage_pdal_c
212+

CMakeLists.txt

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,29 @@ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING "CMake install prefi
2121
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "CMake debug suffix")
2222
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "CMake RelWithDebInfo suffix")
2323

24+
set(PDALC_ENABLE_CODE_COVERAGE ON CACHE BOOL "Enable code coverage calculation")
25+
set(PDALC_GCC_PARAM_GGC_MIN_HEAPSIZE "131072" CACHE STRING "GCC garbage collection minimum heap size")
26+
2427
include_directories("${CMAKE_SOURCE_DIR}/source")
25-
add_subdirectory("source/pdal/capi")
2628

27-
# Measure code coverage on gcc
2829
if(CMAKE_COMPILER_IS_GNUCXX)
29-
include(CodeCoverage)
30-
APPEND_COVERAGE_COMPILER_FLAGS()
31-
set(COVERAGE_EXCLUDES
32-
'build/*'
33-
'cmake/*'
34-
'tests/*'
35-
'/usr/include/*'
36-
)
30+
add_compile_options(--param ggc-min-heapsize=${PDALC_GCC_PARAM_GGC_MIN_HEAPSIZE})
31+
32+
if(PDALC_ENABLE_CODE_COVERAGE)
33+
message(STATUS "Enabled code coverage analysis")
34+
include(CodeCoverage)
35+
APPEND_COVERAGE_COMPILER_FLAGS()
36+
set(COVERAGE_EXCLUDES
37+
'build/*'
38+
'cmake/*'
39+
'tests/*'
40+
'/usr/include/*'
41+
)
42+
endif()
3743
endif()
3844

45+
add_subdirectory("source/pdal/capi")
46+
3947
include(CTest)
4048
add_subdirectory("tests/data")
4149
add_subdirectory("tests/pdal/capi")

source/pdal/capi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ set_target_properties(${TARGET} PROPERTIES
4242
)
4343

4444
# Measure code coverage on gcc
45-
if(CMAKE_COMPILER_IS_GNUCXX)
45+
if(CMAKE_COMPILER_IS_GNUCXX AND PDALC_ENABLE_CODE_COVERAGE)
4646
SETUP_TARGET_FOR_COVERAGE(
4747
NAME coverage_${TARGET}
4848
EXECUTABLE test_${TARGET}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM pdal/pdal:1.7
2+
MAINTAINER Jaime Soto <[email protected]>
3+
4+
RUN \
5+
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories; \
6+
echo "@edgecommunity http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
7+
apk update; \
8+
apk add --no-cache \
9+
libc6-compat \
10+
gcc \
11+
g++ \
12+
lcov \
13+
make \
14+
cmake
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM pdal/ubuntu
2+
MAINTAINER Jaime Soto <[email protected]>
3+
4+
RUN \
5+
apt-get update && apt-get install -y --no-install-recommends \
6+
build-essential \
7+
cmake \
8+
lcov \
9+
&& apt-get clean \
10+
&& rm -rf /var/lib/apt/lists/*

tests/temp_pdal-stats.las

35.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)