Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit d2fd66b

Browse files
authored
Migrate regular CircleCI builds to CTest (#687)
Migrate regular CircleCI builds to CTest
2 parents 23a7e5d + 4a1caf6 commit d2fd66b

File tree

12 files changed

+205
-170
lines changed

12 files changed

+205
-170
lines changed

.circleci/config.yml

Lines changed: 131 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
version: 2
22

33
aliases:
4-
- &test-base
4+
- &test-base-legacy
55
working_directory: /tmp/drafter
66
environment:
77
CXXFLAGS: '-Werror -Wno-error=unused-function'
8-
98
steps:
109
- checkout
1110
- run: git submodule update --init --recursive
@@ -18,43 +17,74 @@ aliases:
1817
name: Test
1918
command: make test -j4
2019

21-
- &test-clang-base
22-
<<: *test-base
23-
environment:
24-
CXXFLAGS: '-Werror -Wno-error=unused-function -Wno-error=missing-braces'
20+
- &test-base
21+
working_directory: /tmp/drafter
2522

2623
- &tag-filter
2724
filters:
2825
tags:
2926
only: /^v.*/
3027

28+
- &clang-debug
29+
run:
30+
name: Build drafter/debug with clang
31+
command: |
32+
ctest -VV -j4 -S cmake/unix.cmake -DCTEST_BUILD_TYPE=Debug -DCTEST_BUILD_NAME="clang $(c++ -dumpversion)"
33+
34+
- &clang-release
35+
run:
36+
name: Build drafter/release with clang
37+
command: |
38+
ctest -VV -j4 -S cmake/unix.cmake -DCTEST_BUILD_TYPE=Release -DCTEST_BUILD_NAME="clang $(c++ -dumpversion)"
39+
40+
- &gcc-debug
41+
run:
42+
name: Build drafter/debug with gcc
43+
command: |
44+
ctest -VV -j4 -S cmake/unix.cmake -DCTEST_BUILD_TYPE=Debug -DCTEST_BUILD_NAME="gcc $(c++ -dumpversion)"
45+
46+
- &gcc-release
47+
run:
48+
name: Build drafter/release with gcc
49+
command: |
50+
ctest -VV -j4 -S cmake/unix.cmake -DCTEST_BUILD_TYPE=Release -DCTEST_BUILD_NAME="gcc $(c++ -dumpversion)"
51+
52+
- &update-submodules
53+
run:
54+
name: Update submodules
55+
command: 'git submodule update --init --recursive'
56+
3157
workflows:
3258
version: 2
3359

3460
drafter:
3561
jobs:
3662
- lint
37-
- test-gcc5.4: *tag-filter
38-
- test-gcc6: *tag-filter
39-
- test-gcc7: *tag-filter
40-
#- test-gcc8: *tag-filter
41-
- test-clang4: *tag-filter
42-
- test-clang5: *tag-filter
43-
- test-clang6: *tag-filter
44-
- test-xcode9: *tag-filter
45-
- test-integration: *tag-filter
63+
- test-gcc-49-debug: *tag-filter
64+
- test-gcc-49-release: *tag-filter
65+
- test-gcc-latest-debug: *tag-filter
66+
- test-gcc-latest-release: *tag-filter
67+
- test-clang-4-debug: *tag-filter
68+
- test-clang-4-release: *tag-filter
69+
- test-clang-latest-debug: *tag-filter
70+
- test-clang-latest-release: *tag-filter
71+
- test-osx-release: *tag-filter
72+
- test-osx-debug: *tag-filter
73+
- test-gyp: *tag-filter
4674
- test-valgrind: *tag-filter
4775
- release:
4876
requires:
49-
- test-gcc5.4
50-
- test-gcc6
51-
- test-gcc7
52-
#- test-gcc8
53-
- test-clang4
54-
- test-clang5
55-
- test-clang6
56-
- test-xcode9
57-
- test-integration
77+
- test-gcc-49-debug
78+
- test-gcc-49-release
79+
- test-gcc-latest-debug
80+
- test-gcc-latest-release
81+
- test-clang-4-debug
82+
- test-clang-4-release
83+
- test-clang-latest-debug
84+
- test-clang-latest-release
85+
- test-osx-release
86+
- test-osx-debug
87+
- test-gyp
5888
- test-valgrind
5989
filters:
6090
tags:
@@ -72,65 +102,107 @@ jobs:
72102
- run: git submodule update --init --recursive
73103
- run: ./tools/clang-format-check.sh
74104

75-
test-gcc5.4:
76-
<<: *test-base
105+
test-gyp:
106+
<<: *test-base-legacy
77107
docker:
78108
- image: gcc:5.4
79109

80-
test-gcc6:
110+
test-gcc-49-debug:
81111
<<: *test-base
112+
steps:
113+
- checkout
114+
- <<: *update-submodules
115+
- <<: *gcc-debug
82116
docker:
83-
- image: gcc:6
117+
- image: apiaryio/drafter-ci:gcc-4.9
84118

85-
test-gcc7:
119+
test-gcc-49-release:
86120
<<: *test-base
121+
steps:
122+
- checkout
123+
- <<: *update-submodules
124+
- <<: *gcc-release
87125
docker:
88-
- image: gcc:7
126+
- image: apiaryio/drafter-ci:gcc-4.9
89127

90-
test-gcc8:
128+
test-gcc-latest-debug:
91129
<<: *test-base
130+
steps:
131+
- checkout
132+
- <<: *update-submodules
133+
- <<: *gcc-debug
92134
docker:
93-
- image: gcc:8
135+
- image: apiaryio/drafter-ci:gcc-latest
94136

95-
test-clang4:
96-
<<: *test-clang-base
137+
test-gcc-latest-release:
138+
<<: *test-base
139+
steps:
140+
- checkout
141+
- <<: *update-submodules
142+
- <<: *gcc-release
97143
docker:
98-
- image: apiaryio/clang:4
144+
- image: apiaryio/drafter-ci:gcc-latest
99145

100-
test-clang5:
101-
<<: *test-clang-base
146+
test-clang-4-debug:
147+
<<: *test-base
148+
steps:
149+
- checkout
150+
- <<: *update-submodules
151+
- <<: *clang-debug
102152
docker:
103-
- image: apiaryio/clang:5
153+
- image: apiaryio/drafter-ci:clang-4.0
104154

105-
test-clang6:
106-
<<: *test-clang-base
155+
test-clang-4-release:
156+
<<: *test-base
157+
steps:
158+
- checkout
159+
- <<: *update-submodules
160+
- <<: *clang-release
107161
docker:
108-
- image: apiaryio/clang:6
109-
110-
test-xcode9:
111-
<<: *test-clang-base
112-
macos:
113-
xcode: "9.4.0"
162+
- image: apiaryio/drafter-ci:clang-4.0
114163

115-
test-integration:
164+
test-clang-latest-debug:
165+
<<: *test-base
166+
steps:
167+
- checkout
168+
- <<: *update-submodules
169+
- <<: *clang-debug
116170
docker:
117-
- image: circleci/ruby:2.5.1
118-
working_directory: /tmp/drafter
171+
- image: apiaryio/drafter-ci:clang-latest
119172

173+
test-clang-latest-release:
174+
<<: *test-base
120175
steps:
121176
- checkout
122-
- run: git submodule update --init --recursive
177+
- <<: *update-submodules
178+
- <<: *clang-release
179+
docker:
180+
- image: apiaryio/drafter-ci:clang-latest
123181

124-
- run:
125-
name: Build
126-
command: ./configure && make -j4
182+
test-osx-debug:
183+
<<: *test-base
184+
steps:
185+
- checkout
186+
- <<: *update-submodules
187+
- run: sudo bundle install
188+
- run: brew install cmake
189+
- <<: *clang-debug
190+
macos:
191+
xcode: "9.4.0"
127192

128-
- run:
129-
name: Integration Test
130-
command: bundle install && bundle exec cucumber
193+
test-osx-release:
194+
<<: *test-base
195+
steps:
196+
- checkout
197+
- <<: *update-submodules
198+
- run: sudo bundle install
199+
- run: brew install cmake
200+
- <<: *clang-release
201+
macos:
202+
xcode: "9.4.0"
131203

132204
test-valgrind:
133-
<<: *test-base
205+
<<: *test-base-legacy
134206
docker:
135207
- image: gcc:7
136208

@@ -163,5 +235,6 @@ jobs:
163235

164236
steps:
165237
- checkout
166-
- run: git submodule update --init --recursive
238+
- <<: *update-submodules
167239
- run: ./tools/release.sh
240+

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
22

33
message(STATUS "Testing dependencies ${BUILD_TESTING_DEPENDENCIES}.")
44

@@ -28,12 +28,12 @@ add_subdirectory(ext/boost_1_66_0 EXCLUDE_FROM_ALL)
2828
add_subdirectory(ext/variant EXCLUDE_FROM_ALL)
2929

3030
message(STATUS "Setting up tests for production...")
31-
set(BUILD_TESTING ON)
3231
add_subdirectory(test/vendor/Catch EXCLUDE_FROM_ALL)
3332
add_subdirectory(test/vendor/dtl EXCLUDE_FROM_ALL)
33+
34+
enable_testing()
3435
include(CTest)
3536
include(test/vendor/Catch/contrib/Catch.cmake)
36-
enable_testing()
3737

3838
# targets developed in this super project
3939
add_subdirectory(ext/snowcrash/ext/markdown-parser EXCLUDE_FROM_ALL)

CTestConfig.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## This file should be placed in the root directory of your project.
2+
## Then modify the CMakeLists.txt file in the root directory of your
3+
## project to incorporate the testing dashboard.
4+
##
5+
6+
set(CTEST_PROJECT_NAME "Drafter")
7+
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
8+
9+
set(CTEST_DROP_METHOD "http")
10+
set(CTEST_DROP_SITE "my.cdash.org")
11+
set(CTEST_DROP_LOCATION "/submit.php?project=Drafter")
12+
set(CTEST_DROP_SITE_CDASH TRUE)

cmake/unix.cmake

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cmake_minimum_required(VERSION 3.6)
2+
3+
if("${CTEST_BUILD_NAME}" STREQUAL "")
4+
set(CTEST_BUILD_NAME "${CTEST_BUILD_TYPE}")
5+
else()
6+
set(CTEST_BUILD_NAME "${CTEST_BUILD_TYPE}/${CTEST_BUILD_NAME}")
7+
endif()
8+
9+
set(CTEST_SOURCE_DIRECTORY ".")
10+
set(CTEST_BINARY_DIRECTORY "build")
11+
12+
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
13+
14+
set(CTEST_USE_LAUNCHERS 1)
15+
set(CTEST_MODEL "Continuous")
16+
17+
ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})
18+
19+
ctest_start(${CTEST_MODEL} TRACK ${CTEST_MODEL})
20+
ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY} OPTIONS -DINTEGRATION_TESTS=ON RETURN_VALUE ret_con)
21+
ctest_build(BUILD ${CTEST_BINARY_DIRECTORY} RETURN_VALUE ret_bld)
22+
23+
if(ret_bld EQUAL 0)
24+
ctest_test(BUILD ${CTEST_BINARY_DIRECTORY} RETURN_VALUE ret_tst)
25+
endif()
26+
27+
ctest_submit(RETURN_VALUE ret_sub)
28+
29+
if(NOT ret_con EQUAL 0)
30+
message(FATAL_ERROR "CI failing on config")
31+
endif()
32+
33+
if(NOT ret_bld EQUAL 0)
34+
message(FATAL_ERROR "CI failing on build")
35+
endif()
36+
37+
if(NOT ret_tst EQUAL 0)
38+
message(FATAL_ERROR "CI failing on tests")
39+
endif()
40+
41+
if(NOT ret_sub EQUAL 0)
42+
message(WARNING "Unable to submit results to CDash")
43+
endif()

ext/snowcrash/CMakeLists.txt

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,18 @@ else()
2525
endif()
2626

2727
add_library(snowcrash SHARED ${snowcrash_SOURCES})
28-
add_library(snowcrash-static STATIC ${snowcrash_SOURCES})
29-
add_library(snowcrash-pic STATIC ${snowcrash_SOURCES})
30-
set_property(TARGET snowcrash-pic PROPERTY POSITION_INDEPENDENT_CODE 1)
31-
32-
if(UNIX)
33-
set_target_properties(snowcrash-static PROPERTIES OUTPUT_NAME snowcrash)
34-
endif()
3528

3629
find_package(markdown-parser 1.0 REQUIRED)
3730

38-
target_link_libraries(snowcrash PUBLIC markdown-parser::markdown-parser-pic)
39-
target_link_libraries(snowcrash-static PUBLIC markdown-parser::markdown-parser-static)
40-
target_link_libraries(snowcrash-pic PUBLIC markdown-parser::markdown-parser-pic)
31+
target_link_libraries(snowcrash PUBLIC markdown-parser::markdown-parser)
4132

4233
target_include_directories(snowcrash PUBLIC
4334
$<BUILD_INTERFACE:${snowcrash_BINARY_DIR}/src>
4435
$<BUILD_INTERFACE:${snowcrash_SOURCE_DIR}/src>
4536
$<INSTALL_INTERFACE:src>
4637
)
4738

48-
target_include_directories(snowcrash-static PUBLIC
49-
$<BUILD_INTERFACE:${snowcrash_BINARY_DIR}/src>
50-
$<BUILD_INTERFACE:${snowcrash_SOURCE_DIR}/src>
51-
$<INSTALL_INTERFACE:src>
52-
)
53-
54-
target_include_directories(snowcrash-pic PUBLIC
55-
$<BUILD_INTERFACE:${snowcrash_BINARY_DIR}/src>
56-
$<BUILD_INTERFACE:${snowcrash_SOURCE_DIR}/src>
57-
$<INSTALL_INTERFACE:src>
58-
)
59-
60-
install(TARGETS snowcrash snowcrash-static snowcrash-pic EXPORT snowcrash-targets
39+
install(TARGETS snowcrash EXPORT snowcrash-targets
6140
LIBRARY DESTINATION lib
6241
ARCHIVE DESTINATION lib
6342
RUNTIME DESTINATION bin
@@ -84,9 +63,6 @@ install(
8463
)
8564

8665
add_library(snowcrash::snowcrash ALIAS snowcrash)
87-
add_library(snowcrash::snowcrash-static ALIAS snowcrash-static)
88-
add_library(snowcrash::snowcrash-pic ALIAS snowcrash-pic)
89-
9066

9167
if(BUILD_TESTING)
9268
include(snowcrash-tests.cmake)

0 commit comments

Comments
 (0)