1
+ # CI script to verify that CMake and B2 builds work.
2
+ # B2 builds include only tests that don't require a DB server, to avoid race conditions.
3
+ # CMake tests include the actual project tests and all the CMake integration workflows
4
+ # recommended by Boost.CI.
5
+ # Windows CMake jobs build the code but don't run the tests,
6
+ # since we don't have a way to set up a Redis server on Windows (yet).
7
+ # Subcommands are implemented by the tools/ci.py script in a platform-independent manner.
8
+
1
9
name : CI
2
10
3
11
on : [push, pull_request]
4
12
5
13
jobs :
6
- windows :
7
- name : " ${{matrix.generator}} ${{matrix.toolset}} Boost ${{matrix.boost_version }} ${{matrix.build_type}} ${{matrix.name_args }}"
14
+ windows-cmake :
15
+ name : " CMake ${{matrix.toolset}} ${{matrix.build-type }} C++ ${{matrix.cxxstd }}"
8
16
runs-on : ${{matrix.os}}
9
17
defaults :
10
18
run :
11
19
shell : bash
12
20
strategy :
13
21
fail-fast : false
14
22
matrix :
15
- boost_version : ["1.81.0"]
16
- os : [windows-2019, windows-2022]
17
- toolset : [v142, v143]
18
- build_type : [Release]
19
- generator : ["Visual Studio 16 2019", "Visual Studio 17 2022"]
20
- config_args : [""]
21
- build_args : [""]
22
- name_args : [""]
23
- exclude :
24
- - { os: windows-2019, toolset: v143 }
25
- - { os: windows-2019, generator: "Visual Studio 17 2022" }
26
- - { os: windows-2022, generator: "Visual Studio 16 2019" }
27
- # The following combinations are not available through install-boost
28
- - { boost_version: "1.81.0", toolset: v143 }
29
-
23
+ include :
24
+ - { toolset: msvc-14.2, os: windows-2019, generator: "Visual Studio 16 2019", cxxstd: '17', build-type: 'Debug', build-shared-libs: 1 }
25
+ - { toolset: msvc-14.2, os: windows-2019, generator: "Visual Studio 16 2019", cxxstd: '17', build-type: 'Release', build-shared-libs: 0 }
26
+ - { toolset: msvc-14.3, os: windows-2022, generator: "Visual Studio 17 2022", cxxstd: '20', build-type: 'Debug', build-shared-libs: 0 }
27
+ - { toolset: msvc-14.3, os: windows-2022, generator: "Visual Studio 17 2022", cxxstd: '20', build-type: 'Release', build-shared-libs: 1 }
28
+ env :
29
+ CMAKE_BUILD_PARALLEL_LEVEL : 4
30
30
steps :
31
31
- name : Checkout
32
32
uses : actions/checkout@v3
33
- with :
34
- fetch-depth : 0
35
33
36
- - name : Add boost toolset to environment
37
- if : contains(fromJson('["1.81.0"]'), matrix.boost_version)
38
- run : echo BOOST_TOOLSET=$(echo "msvc") >> $GITHUB_ENV
34
+ - name : Setup Boost
35
+ run : python3 tools/ci.py setup-boost --source-dir=$(pwd)
39
36
40
- # The platform_version passed to boost-install determines the msvc toolset version for which static libs are installed.
41
- - name : Add boost platform version to environment
37
+ - name : Build a Boost distribution using B2
42
38
run : |
43
- declare -A toolset_to_platform_version=( [v142]="2019" [v143]="2022" )
44
- key=$(echo "${{matrix.toolset}}")
45
- echo BOOST_PLATFORM_VERSION="${toolset_to_platform_version[$key]}" >> $GITHUB_ENV
46
-
47
- - name : Add boost install path to environment
48
- run : echo BOOST_INSTALL_PATH="${GITHUB_WORKSPACE}/boost-${{matrix.boost_version}}${BOOST_TOOLSET}${BOOST_PLATFORM_VERSION}" >> $GITHUB_ENV
49
-
50
- - name : Add build type configuration to environment
51
- run : echo BUILD_CONFIG_ARG="--config ${{matrix.build_type}}" >> $GITHUB_ENV
52
-
53
- - name : Cache Boost installation
54
- id : cache-boost
55
- uses : actions/cache@v3
56
- with :
57
- path : ${{env.BOOST_INSTALL_PATH}}
58
- key : ${{matrix.boost_version}}${{env.BOOST_TOOLSET}}${{env.BOOST_PLATFORM_VERSION}}
59
-
60
- - name : Install Boost
61
- if : steps.cache-boost.outputs.cache-hit != 'true'
62
-
63
- with :
64
- boost_version : ${{matrix.boost_version}}
65
- toolset : ${{env.BOOST_TOOLSET}}
66
- boost_install_dir : ${{env.BOOST_INSTALL_PATH}}
67
- platform_version : ${{env.BOOST_PLATFORM_VERSION}}
68
- arch : null
69
-
70
- - name : Install openssl
71
- run : choco install openssl
72
-
73
- - name : Create build directory
74
- run : mkdir build
75
-
76
- - name : Configure
77
- working-directory : build
39
+ python3 tools/ci.py build-b2-distro \
40
+ --toolset ${{ matrix.toolset }}
41
+
42
+ - name : Build a Boost distribution using CMake
43
+ run : |
44
+ python3 tools/ci.py build-cmake-distro \
45
+ --build-type ${{ matrix.build-type }} \
46
+ --cxxstd ${{ matrix.cxxstd }} \
47
+ --toolset ${{ matrix.toolset }} \
48
+ --generator "${{ matrix.generator }}" \
49
+ --build-shared-libs ${{ matrix.build-shared-libs }}
50
+
51
+ - name : Build the project tests
78
52
run : |
79
- cmake -T "${{matrix.toolset}}" \
80
- -G "${{matrix.generator}}" \
81
- ${{matrix.config_args}} \
82
- ${BOOST_COMPILER_ARG}\
83
- "${GITHUB_WORKSPACE}"
84
- env :
85
- BOOST_ROOT : ${{env.BOOST_INSTALL_PATH}}/boost
86
-
87
- - name : Build
88
- working-directory : build
53
+ python3 tools/ci.py build-cmake-standalone-tests \
54
+ --build-type ${{ matrix.build-type }} \
55
+ --cxxstd ${{ matrix.cxxstd }} \
56
+ --toolset ${{ matrix.toolset }} \
57
+ --generator "${{ matrix.generator }}" \
58
+ --build-shared-libs ${{ matrix.build-shared-libs }}
59
+
60
+ # # TODO: re-enable this when a Redis server is available for this job
61
+ # - name: Run the project tests
62
+ # run: |
63
+ # python3 tools/ci.py run-cmake-standalone-tests \
64
+ # --build-type ${{ matrix.build-type }}
65
+
66
+ - name : Run add_subdirectory tests
89
67
run : |
90
- cmake --build . ${BUILD_CONFIG_ARG} ${{matrix.build_args}}
68
+ python3 tools/ci.py run-cmake-add-subdirectory-tests \
69
+ --build-type ${{ matrix.build-type }} \
70
+ --cxxstd ${{ matrix.cxxstd }} \
71
+ --toolset ${{ matrix.toolset }} \
72
+ --generator "${{ matrix.generator }}" \
73
+ --build-shared-libs ${{ matrix.build-shared-libs }}
91
74
92
- posix :
75
+ - name : Run find_package tests with the built cmake distribution
76
+ run : |
77
+ python3 tools/ci.py run-cmake-find-package-tests \
78
+ --build-type ${{ matrix.build-type }} \
79
+ --cxxstd ${{ matrix.cxxstd }} \
80
+ --toolset ${{ matrix.toolset }} \
81
+ --generator "${{ matrix.generator }}" \
82
+ --build-shared-libs ${{ matrix.build-shared-libs }}
83
+
84
+ - name : Run find_package tests with the built b2 distribution
85
+ run : |
86
+ python3 tools/ci.py run-cmake-b2-find-package-tests \
87
+ --build-type ${{ matrix.build-type }} \
88
+ --cxxstd ${{ matrix.cxxstd }} \
89
+ --toolset ${{ matrix.toolset }} \
90
+ --generator "${{ matrix.generator }}" \
91
+ --build-shared-libs ${{ matrix.build-shared-libs }}
92
+
93
+ windows-b2 :
94
+ name : " B2 ${{matrix.toolset}}"
95
+ runs-on : ${{matrix.os}}
96
+ defaults :
97
+ run :
98
+ shell : bash
99
+ strategy :
100
+ fail-fast : false
101
+ matrix :
102
+ include :
103
+ - { toolset: msvc-14.2, os: windows-2019 }
104
+ - { toolset: msvc-14.3, os: windows-2022 }
105
+ env :
106
+ OPENSSL_ROOT : " C:\\ Program Files\\ OpenSSL"
107
+ steps :
108
+ - name : Checkout
109
+ uses : actions/checkout@v3
110
+
111
+ - name : Setup user-config.jam
112
+ run : cp tools/user-config.jam "${HOMEDRIVE}${HOMEPATH}/"
113
+
114
+ - name : Setup Boost
115
+ run : python3 tools/ci.py setup-boost --source-dir=$(pwd)
116
+
117
+ - name : Build and run project tests using B2
118
+ run : |
119
+ python3 tools/ci.py run-b2-tests \
120
+ --toolset ${{ matrix.toolset }} \
121
+ --cxxstd 17,20 \
122
+ --variant debug,release
123
+
124
+ posix-cmake :
125
+ name : " CMake ${{ matrix.toolset }} ${{ matrix.cxxstd }} ${{ matrix.build-type }} ${{ matrix.cxxflags }}"
93
126
defaults :
94
127
run :
95
128
shell : bash
@@ -98,39 +131,100 @@ jobs:
98
131
fail-fast : false
99
132
matrix :
100
133
include :
101
- - { toolset: gcc, compiler: g++ -11, install: g++-11, os: ubuntu-22.04, cxxflags : '-std=c++17 ', ldflags: '' }
102
- - { toolset: gcc, compiler: g++ -11, install: g++-11, os: ubuntu-22.04, cxxflags : '-std=c++20 ', ldflags: '' }
103
- - { toolset: clang, compiler: clang++ -11, install: clang-11, os: ubuntu-22.04, cxxflags : '-std=c++17 ', ldflags: '' }
104
- - { toolset: clang, compiler: clang++ -11, install: clang-11, os: ubuntu-22.04, cxxflags : '-std=c++20 ', ldflags: '' }
105
- - { toolset: clang, compiler: clang++ -13, install: clang-13, os: ubuntu-22.04, cxxflags : '-std=c++17 ', ldflags: '' }
106
- - { toolset: clang, compiler: clang++ -13, install: clang-13, os: ubuntu-22.04, cxxflags : '-std=c++20 ', ldflags: '' }
107
- - { toolset: clang, compiler: clang++ -14, install: 'clang-14 libc++-14-dev libc++abi-14-dev', os: ubuntu-22.04, cxxflags : '-std=c++17 -stdlib=libc++', ldflags: '-lc++' }
108
- - { toolset: clang, compiler: clang++ -14, install: 'clang-14 libc++-14-dev libc++abi-14-dev', os: ubuntu-22.04, cxxflags : '-std=c++20 -stdlib=libc++', ldflags: '-lc++' }
134
+ - { toolset: gcc-11, install: g++-11, os: ubuntu-22.04, cxxstd : '17', build-type: 'Debug ', ldflags: '' }
135
+ - { toolset: gcc-11, install: g++-11, os: ubuntu-22.04, cxxstd : '20', build-type: 'Release ', ldflags: '' }
136
+ - { toolset: clang-11, install: clang-11, os: ubuntu-22.04, cxxstd : '17', build-type: 'Debug ', ldflags: '' }
137
+ - { toolset: clang-11, install: clang-11, os: ubuntu-22.04, cxxstd : '20', build-type: 'Debug ', ldflags: '' }
138
+ - { toolset: clang-13, install: clang-13, os: ubuntu-22.04, cxxstd : '17', build-type: 'Release ', ldflags: '' }
139
+ - { toolset: clang-13, install: clang-13, os: ubuntu-22.04, cxxstd : '20', build-type: 'Release ', ldflags: '' }
140
+ - { toolset: clang-14, install: 'clang-14 libc++-14-dev libc++abi-14-dev', os: ubuntu-22.04, cxxstd : '17', build-type: 'Debug', cxxflags: ' -stdlib=libc++', ldflags: '-lc++' }
141
+ - { toolset: clang-14, install: 'clang-14 libc++-14-dev libc++abi-14-dev', os: ubuntu-22.04, cxxstd : '20', build-type: 'Release', cxxflags: ' -stdlib=libc++', ldflags: '-lc++' }
109
142
runs-on : ${{ matrix.os }}
110
143
env :
111
- CXXFLAGS : -g -O0 ${{matrix.cxxflags}} -Wall -Wextra
144
+ CXXFLAGS : ${{matrix.cxxflags}} -Wall -Wextra
112
145
LDFLAGS : ${{matrix.ldflags}}
146
+ CMAKE_BUILD_PARALLEL_LEVEL : 4
113
147
steps :
114
148
- name : Checkout
115
149
uses : actions/checkout@v3
116
- - name : Install CMake
117
- run : sudo apt-get -y install cmake
118
- - name : Install protobuf
119
- run : sudo apt-get -y install protobuf-compiler
120
- - name : Install compiler
121
- run : sudo apt-get install -y ${{ matrix.install }}
122
- - name : Install Redis
123
- run : sudo apt-get install -y redis-server
124
- - name : Install boost
125
-
126
- id : install-boost
127
- with :
128
- boost_version : 1.81.0
129
- platform_version : 22.04
130
- - name : Run CMake
150
+
151
+ - name : Install dependencies
152
+ run : sudo apt-get -y install cmake protobuf-compiler redis-server python3 ${{ matrix.install }}
153
+
154
+ - name : Setup Boost
155
+ run : ./tools/ci.py setup-boost --source-dir=$(pwd)
156
+
157
+ - name : Build a Boost distribution using B2
158
+ run : |
159
+ ./tools/ci.py build-b2-distro \
160
+ --toolset ${{ matrix.toolset }}
161
+
162
+ - name : Build a Boost distribution using CMake
163
+ run : |
164
+ ./tools/ci.py build-cmake-distro \
165
+ --build-type ${{ matrix.build-type }} \
166
+ --cxxstd ${{ matrix.cxxstd }} \
167
+ --toolset ${{ matrix.toolset }}
168
+
169
+ - name : Build the project tests
170
+ run : |
171
+ ./tools/ci.py build-cmake-standalone-tests \
172
+ --build-type ${{ matrix.build-type }} \
173
+ --cxxstd ${{ matrix.cxxstd }} \
174
+ --toolset ${{ matrix.toolset }}
175
+
176
+ - name : Run the project tests
177
+ run : |
178
+ ./tools/ci.py run-cmake-standalone-tests \
179
+ --build-type ${{ matrix.build-type }}
180
+
181
+ - name : Run add_subdirectory tests
182
+ run : |
183
+ ./tools/ci.py run-cmake-add-subdirectory-tests \
184
+ --build-type ${{ matrix.build-type }} \
185
+ --cxxstd ${{ matrix.cxxstd }} \
186
+ --toolset ${{ matrix.toolset }}
187
+
188
+ - name : Run find_package tests with the built cmake distribution
189
+ run : |
190
+ ./tools/ci.py run-cmake-find-package-tests \
191
+ --build-type ${{ matrix.build-type }} \
192
+ --cxxstd ${{ matrix.cxxstd }} \
193
+ --toolset ${{ matrix.toolset }}
194
+
195
+ - name : Run find_package tests with the built b2 distribution
196
+ run : |
197
+ ./tools/ci.py run-cmake-b2-find-package-tests \
198
+ --build-type ${{ matrix.build-type }} \
199
+ --cxxstd ${{ matrix.cxxstd }} \
200
+ --toolset ${{ matrix.toolset }}
201
+
202
+ posix-b2 :
203
+ name : " B2 ${{ matrix.toolset }}"
204
+ defaults :
205
+ run :
206
+ shell : bash
207
+
208
+ strategy :
209
+ fail-fast : false
210
+ matrix :
211
+ include :
212
+ - { toolset: gcc-11, install: g++-11, cxxstd: "11,17,20" } # Having C++11 shouldn't break the build
213
+ - { toolset: clang-14, install: clang-14, cxxstd: "17,20" }
214
+ runs-on : ubuntu-22.04
215
+ steps :
216
+ - name : Checkout
217
+ uses : actions/checkout@v3
218
+
219
+ - name : Install dependencies
220
+ run : sudo apt-get -y install python3 ${{ matrix.install }}
221
+
222
+ - name : Setup Boost
223
+ run : ./tools/ci.py setup-boost --source-dir=$(pwd)
224
+
225
+ - name : Build and run project tests using B2
131
226
run : |
132
- BOOST_ROOT=${{steps.install-boost.outputs.BOOST_ROOT}} cmake -DCMAKE_CXX_COMPILER="${{matrix.compiler}}" -DCMAKE_CXX_FLAGS="${{env.CXXFLAGS}}" -DCMAKE_EXE_LINKER_FLAGS="${{env.LDFLAGS}}"
133
- - name : Build
134
- run : make
135
- - name : Check
136
- run : ctest --output-on-failure
227
+ python3 tools/ci.py run-b2-tests \
228
+ --toolset ${{ matrix.toolset }} \
229
+ --cxxstd ${{ matrix.cxxstd }} \
230
+ --variant debug,release
0 commit comments