2
0
mirror of https://github.com/boostorg/cmake.git synced 2026-01-19 04:02:15 +00:00
Files
cmake/.github/workflows/ci.yml
Alexander Grund 7b0a0b374d Test Boost configure with different CMake versions
Add a configure-only test with different CMake versions.
Use especially those that are tested for in CMake files.
2025-09-29 14:05:58 +02:00

777 lines
25 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
shared: OFF
layout: tagged
python: ON
mpi: OFF
- os: ubuntu-latest
shared: ON
layout: versioned
python: ON
mpi: OFF
- os: ubuntu-latest
shared: ON
layout: system
python: ON
mpi: ON
install: libopenmpi-dev
- os: macos-latest
shared: OFF
layout: versioned
python: ON
mpi: OFF
- os: macos-latest
shared: ON
layout: tagged
python: ON
mpi: OFF
- os: ubuntu-latest
shared: ON
testing: ON
layout: system
python: OFF
mpi: OFF
exclude: "process;geometry"
- os: ubuntu-latest
include: assert
testing: ON
test_install: ON
- os: macos-latest
include: assert
testing: ON
test_install: ON
- os: ubuntu-latest
include: mp11
testing: ON
test_install: ON
- os: macos-latest
include: mp11
testing: ON
test_install: ON
- os: ubuntu-latest
include: preprocessor
testing: ON
test_install: ON
- os: macos-latest
include: preprocessor
testing: ON
test_install: ON
- os: ubuntu-latest
include: timer
testing: ON
layout: versioned
shared: OFF
test_install: ON
- os: ubuntu-latest
include: timer
testing: ON
layout: versioned
shared: ON
test_install: ON
- os: macos-latest
include: timer
testing: ON
layout: versioned
shared: OFF
test_install: ON
- os: macos-latest
include: timer
testing: ON
layout: versioned
shared: ON
test_install: ON
- os: ubuntu-latest
include: iostreams
layout: versioned
shared: OFF
test_install: ON
- os: ubuntu-latest
include: iostreams
layout: versioned
shared: ON
test_install: ON
- os: macos-latest
include: iostreams
layout: versioned
shared: OFF
test_install: ON
- os: macos-latest
include: iostreams
layout: versioned
shared: ON
test_install: ON
- os: ubuntu-latest
include: locale
layout: versioned
shared: OFF
test_install: ON
- os: ubuntu-latest
include: locale
layout: versioned
shared: ON
test_install: ON
- os: macos-latest
include: locale
layout: versioned
shared: OFF
test_install: ON
- os: macos-latest
include: locale
layout: versioned
shared: ON
test_install: ON
- os: ubuntu-latest
include: mysql
testing: ON
install: libssl-dev
- os: ubuntu-latest
include: mysql
test_install: ON
install: libssl-dev
- os: ubuntu-latest
include: bind
testing: ON
- os: ubuntu-latest
include: bind
test_install: ON
- os: ubuntu-latest
include: endian
testing: ON
- os: ubuntu-latest
include: endian
test_install: ON
- os: ubuntu-latest
include: system
testing: ON
- os: ubuntu-latest
include: system
test_install: ON
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Configure Boost
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=${{matrix.verbose}} -DBUILD_TESTING=${{matrix.testing}} -DBOOST_INCLUDE_LIBRARIES="${{matrix.include}}" -DBOOST_EXCLUDE_LIBRARIES="${{matrix.exclude}}" -DBUILD_SHARED_LIBS=${{matrix.shared}} -DBOOST_INSTALL_LAYOUT=${{matrix.layout}} -DBOOST_ENABLE_MPI=${{matrix.mpi}} -DBOOST_ENABLE_PYTHON=${{matrix.python}} ..
- name: Build Boost
run: |
cd ../boost-root/__build__
cmake --build .
- name: Install Boost
run: |
cd ../boost-root/__build__
cmake --build . --target install
- name: Test Boost
if: matrix.testing
run: |
cd ../boost-root/__build__
cmake --build . --target tests -- -j 3
ctest --output-on-failure --no-tests=error -j 3
- name: Test installed Boost library
if: matrix.test_install
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include}}
mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
cmake --build . --target check
windows:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
shared: OFF
python: ON
mpi: OFF
- os: windows-2022
shared: ON
python: ON
mpi: OFF
- os: windows-2022
include: assert
testing: ON
test_install: ON
- os: windows-2022
include: mp11
testing: ON
test_install: ON
- os: windows-2022
include: timer
shared: OFF
testing: ON
test_install: ON
- os: windows-2022
include: timer
shared: ON
testing: ON
test_install: ON
- os: windows-2022
include: iostreams
shared: OFF
test_install: ON
- os: windows-2022
include: iostreams
shared: ON
test_install: ON
- os: windows-2022
include: bind
testing: ON
- os: windows-2022
include: bind
test_install: ON
- os: windows-2022
include: endian
testing: ON
- os: windows-2022
include: endian
test_install: ON
- os: windows-2022
include: system
testing: ON
- os: windows-2022
include: system
test_install: ON
# mingw
- os: windows-latest
include: timer
shared: OFF
testing: ON
test_install: ON
opts: "-G \"MinGW Makefiles\""
- os: windows-latest
include: timer
shared: ON
testing: ON
test_install: ON
opts: "-G \"MinGW Makefiles\""
# clang-cl
- os: windows-latest
include: timer
shared: OFF
testing: ON
test_install: ON
opts: "-T clangcl"
- os: windows-latest
include: timer
shared: ON
testing: ON
test_install: ON
opts: "-T clangcl"
runs-on: ${{matrix.os}}
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rd /s/q tools\cmake
xcopy /s /e /q %GITHUB_WORKSPACE% tools\cmake\
- name: Configure Boost
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=${{matrix.verbose}} -DBUILD_TESTING=${{matrix.testing}} -DBOOST_INCLUDE_LIBRARIES=${{matrix.include}} -DBOOST_EXCLUDE_LIBRARIES=${{matrix.exclude}} -DBUILD_SHARED_LIBS=${{matrix.shared}} -DBOOST_ENABLE_MPI=${{matrix.mpi}} -DBOOST_ENABLE_PYTHON=${{matrix.python}} -DCMAKE_IGNORE_PREFIX_PATH="C:/Strawberry/c" ${{matrix.opts}} ..
- name: Build Boost (Debug)
run: cmake --build ../boost-root/__build__ --config Debug
- name: Build Boost (Release)
run: cmake --build ../boost-root/__build__ --config Release
- name: Install Boost (Debug)
run: cmake --build ../boost-root/__build__ --target install --config Debug
- name: Install Boost (Release)
run: cmake --build ../boost-root/__build__ --target install --config Release
- name: Test Boost (Debug)
if: matrix.testing
run: cd ../boost-root/__build__ && cmake --build . --target tests --config Debug && ctest --output-on-failure --no-tests=error -j 3 -C Debug
- name: Test Boost (Release)
if: matrix.testing
run: cd ../boost-root/__build__ && cmake --build . --target tests --config Release && ctest --output-on-failure --no-tests=error -j 3 -C Release
- name: Configure test project
if: matrix.test_install
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include}}
mkdir __build__ && cd __build__
cmake -DCMAKE_PREFIX_PATH=C:/Boost ${{matrix.opts}} ..
- name: Test installed Boost library (Debug)
if: matrix.test_install
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include}}/__build__
PATH C:\Boost\bin;%PATH%
cmake --build . --config Debug && ctest --output-on-failure --no-tests=error -j 3 -C Debug
- name: Test installed Boost library (Release)
if: matrix.test_install
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include}}/__build__
PATH C:\Boost\bin;%PATH%
cmake --build . --config Release && ctest --output-on-failure --no-tests=error -j 3 -C Release
BoostRoot:
strategy:
matrix:
enable_test: [ON, OFF]
cmake_version: [default, 3.5.0, 3.6.0, 3.8.0, 3.10.0, 3.13.0, 3.14.0, 3.16.0, 3.19.0, 3.31.0, 4.0.0, 4.1.0]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Boost
run: |
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Configure each library independently
working-directory: ../boost-root
if: matrix.cmake_version == 'default'
run: |
failed_libs=""
failed_outputs=()
for cml in libs/*/CMakeLists.txt; do
lib=$(dirname "${cml#*libs/}")
echo "====================================================================="
echo "Building $lib"
echo "====================================================================="
error=0
out=$(cmake -DBUILD_TESTING=${{matrix.enable_test}} -DBOOST_INCLUDE_LIBRARIES=$lib -DBoost_DEBUG=ON -B "__build_$lib" . 2>&1) || error=1
echo "$out"
echo; echo; echo
[[ "$out" != *"BOOST_INCLUDE_LIBRARIES has not been found"* ]] || error=1
[[ "$out" != *"CMake Error"* ]] || error=1
if ((error==1)); then
failed_libs+=" $lib"
failed_outputs+=(
"====================================================================="
"Output of $lib"
"$out"
)
fi
done
if [[ -n $failed_libs ]]; then
echo "Failed libraries: $failed_libs"
printf '%s\n' "${failed_outputs[@]}"
exit 1
fi
- name: Cache CMake
if: matrix.cmake_version != 'default'
id: cache-cmake
uses: actions/cache@v4
with:
path: /tmp/cmake
key: ${{ runner.os }}-cmake-${{matrix.cmake_version}}
- name: Build CMake
if: matrix.cmake_version != 'default' && steps.cache-cmake.outputs.cache-hit != 'true'
run: |
version=${{matrix.cmake_version}}
filename="cmake-$version.tar.gz"
cd "$(mktemp -d)"
wget https://cmake.org/files/v${version%.*}/$filename
tar -xf $filename --strip-components=1
cmake -B __build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/cmake .
cmake --build __build -- -j 3
cmake --build __build --target install
- name: Configure Boost with CMake ${{matrix.cmake_version}}
working-directory: ../boost-root
if: matrix.cmake_version != 'default'
run: |
/tmp/cmake/bin/cmake --version
/tmp/cmake/bin/cmake -DBUILD_TESTING=${{matrix.enable_test}} -B "__build_cmake-$version" .
BoostTest:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3 libs/core libs/assert libs/config libs/static_assert libs/throw_exception
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Test BoostTest
run: |
cd ../boost-root/tools/cmake/test/boost_test
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON ..
cmake --build . --target tests -j 3
ctest --output-on-failure --no-tests=error -j 3
BoostFetch:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test BoostFetch
run: |
cd test/boost_fetch
mkdir __build__ && cd __build__
cmake ..
cmake --build .
cmake --build . --target check
posix-subdir:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15 ]
shared: [ ON, OFF ]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Test Boost with add_subdirectory
run: |
cd ../boost-root/tools/cmake/test/add_subdir
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
- name: Test Boost with add_subdirectory(EXCLUDE_FROM_ALL)
run: |
cd ../boost-root/tools/cmake/test/add_subdir_exc
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
- name: Test installation with add_subdirectory
run: |
cd ../boost-root/tools/cmake/test/add_subdir
mkdir __build2__ && cd __build2__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build . --target install
cmake --install .
- name: Test installation with add_subdirectory(EXCLUDE_FROM_ALL)
run: |
cd ../boost-root/tools/cmake/test/add_subdir_exc
mkdir __build2__ && cd __build2__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build . --target install
cmake --install .
- name: Test add_subdirectory compatibility targets
run: |
cd ../boost-root/tools/cmake/test/add_subdir_compat
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
- name: Test add_subdirectory(EXCLUDE_FROM_ALL) compatibility targets
run: |
cd ../boost-root/tools/cmake/test/add_subdir_exc_compat
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-target-check:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
include: timer
shared: ON
- os: ubuntu-24.04
include: timer
shared: ON
- os: macos-13
include: timer
shared: ON
- os: macos-14
include: timer
shared: ON
- os: macos-15
include: timer
shared: ON
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Configure Boost
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=${{matrix.verbose}} -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=${{matrix.include}} -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
- name: Test Boost
run: |
cd ../boost-root/__build__
cmake --build . --target check
posix-check-quick:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, macos-15 ]
shared: [ ON, OFF ]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Configure Boost
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=${{matrix.verbose}} -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
- name: Test Boost
run: |
cd ../boost-root/__build__
cmake --build . --target check-quick
posix-install:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
include_libraries: [ timer ]
layout: [ system, versioned ]
verbose: [ ON ]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
run: |
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --jobs 3
rm -rf tools/cmake/*
cp -r $GITHUB_WORKSPACE/* tools/cmake
- name: Configure (Static)
run: |
cd ../boost-root
mkdir __build_static__ && cd __build_static__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=${{matrix.verbose}} -DBOOST_INCLUDE_LIBRARIES="${{matrix.include_libraries}}" -DBOOST_EXCLUDE_LIBRARIES="${{matrix.exclude_libraries}}" -DBUILD_SHARED_LIBS=OFF -DBOOST_INSTALL_LAYOUT=${{matrix.layout}} ..
- name: Build (Static)
run: |
cd ../boost-root/__build_static__
cmake --build .
- name: Install (Static)
run: |
cd ../boost-root/__build_static__
cmake --build . --target install
- name: Configure (Shared)
run: |
cd ../boost-root
mkdir __build_shared__ && cd __build_shared__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=${{matrix.verbose}} -DBOOST_INCLUDE_LIBRARIES="${{matrix.include_libraries}}" -DBOOST_EXCLUDE_LIBRARIES="${{matrix.exclude_libraries}}" -DBUILD_SHARED_LIBS=ON -DBOOST_INSTALL_LAYOUT=${{matrix.layout}} ..
- name: Build (Shared)
run: |
cd ../boost-root/__build_shared__
cmake --build .
- name: Install (Shared)
run: |
cd ../boost-root/__build_shared__
cmake --build . --target install
- name: Test (Static)
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include_libraries}}
mkdir __build_static__ && cd __build_static__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=${{matrix.verbose}} -DBoost_USE_STATIC_LIBS=ON ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
cmake --build . --target check
- name: Test (Shared)
run: |
cd ../boost-root/tools/cmake/test/${{matrix.include_libraries}}
mkdir __build_shared__ && cd __build_shared__
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=${{matrix.verbose}} -DBoost_USE_STATIC_LIBS=OFF ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
cmake --build . --target check