Skip to content

Commit 9a834e1

Browse files
authored
Merge pull request #92 from Flamefire/test-cmake-versions
Test Boost configure with different CMake versions
2 parents 342fcb6 + 8c51c7c commit 9a834e1

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ jobs:
386386
strategy:
387387
matrix:
388388
enable_test: [ON, OFF]
389+
cmake_version: [default, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 3.12.0, 3.13.0, 3.14.0, 3.16.0, 3.19.0, 3.31.0, 4.0.0, 4.1.0]
390+
exclude:
391+
# BoostTestJamfile requires CMake 3.9
392+
- cmake_version: 3.8.0
393+
enable_test: ON
389394
fail-fast: false
390395

391396
runs-on: ubuntu-latest
@@ -406,10 +411,11 @@ jobs:
406411
rm -rf tools/cmake/*
407412
cp -r $GITHUB_WORKSPACE/* tools/cmake
408413
- name: Configure each library independently
414+
working-directory: ../boost-root
415+
if: matrix.cmake_version == 'default'
409416
run: |
410417
failed_libs=""
411418
failed_outputs=()
412-
cd ../boost-root
413419
for cml in libs/*/CMakeLists.txt; do
414420
lib=$(dirname "${cml#*libs/}")
415421
echo "====================================================================="
@@ -436,6 +442,58 @@ jobs:
436442
exit 1
437443
fi
438444
445+
- name: Cache CMake
446+
if: matrix.cmake_version != 'default'
447+
id: cache-cmake
448+
uses: actions/cache@v4
449+
with:
450+
path: /tmp/cmake
451+
key: ${{ runner.os }}-cmake-${{matrix.cmake_version}}
452+
453+
- name: Install CMake dependencies
454+
if: matrix.cmake_version != 'default'
455+
run: sudo apt-get -o Acquire::Retries=3 -y -q --no-install-suggests --no-install-recommends install curl libcurl4-openssl-dev libarchive-dev
456+
457+
- name: Build CMake
458+
if: matrix.cmake_version != 'default' && steps.cache-cmake.outputs.cache-hit != 'true'
459+
run: |
460+
version=${{matrix.cmake_version}}
461+
filename="cmake-$version.tar.gz"
462+
cd "$(mktemp -d)"
463+
wget https://cmake.org/files/v${version%.*}/$filename
464+
tar -xf $filename --strip-components=1
465+
flags=(
466+
"-DCMAKE_BUILD_TYPE=Release"
467+
"-DCMAKE_INSTALL_PREFIX=/tmp/cmake"
468+
"-B" "__build"
469+
"-Wno-dev" # Make configuring more silent
470+
"-DCMAKE_USE_SYSTEM_CURL=1" # Avoid failures caused by newer (system) OpenSSL in CMake < 3.10
471+
"-DCMAKE_CXX_FLAGS='-include cstdint -include limits'" # Fix missing includes in CMake < 3.10
472+
)
473+
cmake "${flags[@]}" .
474+
cmake --build __build -- -j 3
475+
cmake --build __build --target install
476+
477+
- name: Configure Boost with CMake ${{matrix.cmake_version}}
478+
working-directory: ../boost-root
479+
if: matrix.cmake_version != 'default'
480+
run: |
481+
version_greater_equal() { printf '%s\n' "$2" "$1" | sort --check=quiet --version-sort; }
482+
excluded=()
483+
for cml in "$PWD"/libs/*/CMakeLists.txt "$PWD"/libs/numeric/*/CMakeLists.txt; do
484+
lib=$(dirname "${cml#*libs/}")
485+
if minimal_cmake_version=$(grep "cmake_minimum_required" "$cml" | grep -Eo '[0-9]\.[0-9]+' | head -1); then
486+
version_greater_equal ${{matrix.cmake_version}} "$minimal_cmake_version" || excluded+=("$lib")
487+
else
488+
echo "Minimum required CMake version not found in $cml for library $lib"
489+
fi
490+
done
491+
# Libraries that don't declare their correct minimal required CMake version or where dependencies require higher version
492+
version_greater_equal ${{matrix.cmake_version}} 3.12.0 || excluded+=("msm")
493+
version_greater_equal ${{matrix.cmake_version}} 3.14.0 || excluded+=("pfr" "mysql") # mysql depends on pfr
494+
/tmp/cmake/bin/cmake --version
495+
/tmp/cmake/bin/cmake -DBUILD_TESTING=${{matrix.enable_test}} -DBOOST_EXCLUDE_LIBRARIES="$(IFS=';'; echo "${excluded[*]}")" -B "__build_cmake-$version" .
496+
439497
BoostTest:
440498
strategy:
441499
fail-fast: false

0 commit comments

Comments
 (0)