Skip to content

Commit f1e51a0

Browse files
committed
Add CMake subdir and install tests to ci.yml
1 parent fdc6199 commit f1e51a0

File tree

5 files changed

+319
-0
lines changed

5 files changed

+319
-0
lines changed

.github/workflows/ci.yml

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,227 @@ jobs:
176176
- name: Test
177177
run: ..\..\..\b2 --hash address-model=64 cxxstd=14,17,20 toolset=msvc-14.3
178178
working-directory: ../boost-root/libs/graph/test
179+
180+
posix-cmake-subdir:
181+
strategy:
182+
fail-fast: false
183+
matrix:
184+
include:
185+
- os: ubuntu-20.04
186+
- os: ubuntu-22.04
187+
- os: ubuntu-24.04
188+
- os: macos-13
189+
- os: macos-14
190+
- os: macos-15
191+
192+
runs-on: ${{matrix.os}}
193+
194+
steps:
195+
- uses: actions/checkout@v4
196+
197+
- name: Install packages
198+
if: matrix.install
199+
run: sudo apt-get -y install ${{matrix.install}}
200+
201+
- name: Setup Boost
202+
run: |
203+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
204+
LIBRARY=${GITHUB_REPOSITORY#*/}
205+
echo LIBRARY: $LIBRARY
206+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
207+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
208+
echo GITHUB_REF: $GITHUB_REF
209+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
210+
REF=${REF#refs/heads/}
211+
echo REF: $REF
212+
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
213+
echo BOOST_BRANCH: $BOOST_BRANCH
214+
cd ..
215+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
216+
cd boost-root
217+
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
218+
git submodule update --init tools/boostdep
219+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
220+
221+
- name: Use library with add_subdirectory
222+
run: |
223+
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
224+
mkdir __build__ && cd __build__
225+
cmake ..
226+
cmake --build .
227+
ctest --output-on-failure --no-tests=error
228+
229+
posix-cmake-install:
230+
strategy:
231+
fail-fast: false
232+
matrix:
233+
include:
234+
- os: ubuntu-20.04
235+
- os: ubuntu-22.04
236+
- os: ubuntu-24.04
237+
- os: macos-13
238+
- os: macos-14
239+
- os: macos-15
240+
241+
runs-on: ${{matrix.os}}
242+
243+
steps:
244+
- uses: actions/checkout@v4
245+
246+
- name: Install packages
247+
if: matrix.install
248+
run: sudo apt-get -y install ${{matrix.install}}
249+
250+
- name: Setup Boost
251+
run: |
252+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
253+
LIBRARY=${GITHUB_REPOSITORY#*/}
254+
echo LIBRARY: $LIBRARY
255+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
256+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
257+
echo GITHUB_REF: $GITHUB_REF
258+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
259+
REF=${REF#refs/heads/}
260+
echo REF: $REF
261+
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
262+
echo BOOST_BRANCH: $BOOST_BRANCH
263+
cd ..
264+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
265+
cd boost-root
266+
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
267+
git submodule update --init tools/boostdep
268+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
269+
270+
- name: Configure
271+
run: |
272+
cd ../boost-root
273+
mkdir __build__ && cd __build__
274+
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
275+
276+
- name: Install
277+
run: |
278+
cd ../boost-root/__build__
279+
cmake --build . --target install
280+
281+
- name: Use the installed library
282+
run: |
283+
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
284+
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
285+
cmake --build .
286+
ctest --output-on-failure --no-tests=error
287+
288+
windows-cmake-subdir:
289+
strategy:
290+
fail-fast: false
291+
matrix:
292+
include:
293+
- os: windows-2019
294+
- os: windows-2022
295+
296+
runs-on: ${{matrix.os}}
297+
298+
steps:
299+
- uses: actions/checkout@v4
300+
301+
- name: Setup Boost
302+
shell: cmd
303+
run: |
304+
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
305+
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
306+
echo LIBRARY: %LIBRARY%
307+
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
308+
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
309+
echo GITHUB_REF: %GITHUB_REF%
310+
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
311+
set BOOST_BRANCH=develop
312+
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
313+
echo BOOST_BRANCH: %BOOST_BRANCH%
314+
cd ..
315+
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
316+
cd boost-root
317+
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
318+
git submodule update --init tools/boostdep
319+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
320+
321+
- name: Use library with add_subdirectory (Debug)
322+
shell: cmd
323+
run: |
324+
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
325+
mkdir __build__ && cd __build__
326+
cmake ..
327+
cmake --build . --config Debug
328+
ctest --output-on-failure --no-tests=error -C Debug
329+
330+
- name: Use library with add_subdirectory (Release)
331+
shell: cmd
332+
run: |
333+
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
334+
cmake --build . --config Release
335+
ctest --output-on-failure --no-tests=error -C Release
336+
337+
windows-cmake-install:
338+
strategy:
339+
fail-fast: false
340+
matrix:
341+
include:
342+
- os: windows-2019
343+
- os: windows-2022
344+
345+
runs-on: ${{matrix.os}}
346+
347+
steps:
348+
- uses: actions/checkout@v4
349+
350+
- name: Setup Boost
351+
shell: cmd
352+
run: |
353+
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
354+
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
355+
echo LIBRARY: %LIBRARY%
356+
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
357+
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
358+
echo GITHUB_REF: %GITHUB_REF%
359+
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
360+
set BOOST_BRANCH=develop
361+
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
362+
echo BOOST_BRANCH: %BOOST_BRANCH%
363+
cd ..
364+
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
365+
cd boost-root
366+
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
367+
git submodule update --init tools/boostdep
368+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
369+
370+
- name: Configure
371+
shell: cmd
372+
run: |
373+
cd ../boost-root
374+
mkdir __build__ && cd __build__
375+
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
376+
377+
- name: Install (Debug)
378+
shell: cmd
379+
run: |
380+
cd ../boost-root/__build__
381+
cmake --build . --target install --config Debug
382+
383+
- name: Install (Release)
384+
shell: cmd
385+
run: |
386+
cd ../boost-root/__build__
387+
cmake --build . --target install --config Release
388+
389+
- name: Use the installed library (Debug)
390+
shell: cmd
391+
run: |
392+
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
393+
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
394+
cmake --build . --config Debug
395+
ctest --output-on-failure --no-tests=error -C Debug
396+
397+
- name: Use the installed library (Release)
398+
shell: cmd
399+
run: |
400+
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
401+
cmake --build . --config Release
402+
ctest --output-on-failure --no-tests=error -C Release
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2018, 2019, 2021 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.16)
6+
7+
project(boost_graph_install_test LANGUAGES CXX)
8+
9+
if(BOOST_RUNTIME_LINK STREQUAL "static")
10+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
11+
endif()
12+
13+
find_package(boost_graph REQUIRED)
14+
15+
add_executable(main main.cpp)
16+
target_link_libraries(main Boost::graph)
17+
18+
enable_testing()
19+
add_test(NAME main COMMAND main)
20+
21+
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>)

test/cmake_install_test/main.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2006 The Trustees of Indiana University.
2+
3+
// Use, modification and distribution is subject to the Boost Software
4+
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
// Authors: Douglas Gregor
8+
// Andrew Lumsdaine
9+
10+
// Make sure adjacency_list works with EdgeListS=setS
11+
#include <boost/graph/adjacency_list.hpp>
12+
13+
using namespace boost;
14+
15+
typedef adjacency_list< vecS, vecS, undirectedS, no_property, no_property,
16+
no_property, setS >
17+
GraphType;
18+
19+
int main()
20+
{
21+
GraphType g(10);
22+
add_vertex(g);
23+
add_edge(0, 5, g);
24+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2018, 2019, 2021 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.16)
6+
7+
project(boost_graph_subdir_test LANGUAGES CXX)
8+
9+
if(BOOST_RUNTIME_LINK STREQUAL "static")
10+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
11+
endif()
12+
13+
# Put .dll in the same directory as .exe
14+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
15+
16+
set(BOOST_INCLUDE_LIBRARIES graph)
17+
18+
add_subdirectory(../../../../ deps/boost EXCLUDE_FROM_ALL)
19+
20+
add_executable(main main.cpp)
21+
target_link_libraries(main Boost::graph)
22+
23+
enable_testing()
24+
add_test(NAME main COMMAND main)
25+
26+
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>)

test/cmake_subdir_test/main.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2006 The Trustees of Indiana University.
2+
3+
// Use, modification and distribution is subject to the Boost Software
4+
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5+
// http://www.boost.org/LICENSE_1_0.txt)
6+
7+
// Authors: Douglas Gregor
8+
// Andrew Lumsdaine
9+
10+
// Make sure adjacency_list works with EdgeListS=setS
11+
#include <boost/graph/adjacency_list.hpp>
12+
13+
using namespace boost;
14+
15+
typedef adjacency_list< vecS, vecS, undirectedS, no_property, no_property,
16+
no_property, setS >
17+
GraphType;
18+
19+
int main()
20+
{
21+
GraphType g(10);
22+
add_vertex(g);
23+
add_edge(0, 5, g);
24+
}

0 commit comments

Comments
 (0)