mirror of
https://github.com/boostorg/cmake.git
synced 2026-01-19 04:02:15 +00:00
124 lines
4.1 KiB
YAML
124 lines
4.1 KiB
YAML
name: CMake Versions CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
- develop
|
|
- feature/**
|
|
tags: ['**']
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: 'Boost branch to run for'
|
|
required: false
|
|
default: 'auto'
|
|
options:
|
|
- auto
|
|
- master
|
|
- develop
|
|
|
|
jobs:
|
|
posix:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
enable_test: [ON, OFF]
|
|
cmake_version:
|
|
- 3.8.2
|
|
- 3.9.6
|
|
- 3.10.3
|
|
- 3.11.4
|
|
- 3.12.4
|
|
- 3.13.5
|
|
- 3.14.7
|
|
- 3.15.7
|
|
- 3.16.9
|
|
- 3.17.5
|
|
- 3.18.6
|
|
- 3.19.8
|
|
- 3.20.6
|
|
- 3.21.7
|
|
- 3.22.6
|
|
- 3.23.5
|
|
- 3.24.4
|
|
- 3.25.3
|
|
- 3.26.6
|
|
- 3.27.9
|
|
- 3.28.6
|
|
- 3.29.9
|
|
- 3.30.9
|
|
- 3.31.9
|
|
- 4.0.4
|
|
- 4.1.2
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Boost
|
|
run: |
|
|
BOOST_BRANCH="${{inputs.branch}}"
|
|
if [[ -z $BOOST_BRANCH || $BOOST_BRANCH == "auto" ]]; then
|
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
|
REF=${REF#refs/heads/}
|
|
echo REF: $REF
|
|
[[ "$REF" == "master" ]] && BOOST_BRANCH=master || BOOST_BRANCH=develop
|
|
fi
|
|
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: Cache CMake
|
|
id: cache-cmake
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/cmake
|
|
key: ${{ runner.os }}-cmake-${{matrix.cmake_version}}
|
|
|
|
- name: Install CMake dependencies
|
|
run: sudo apt-get -o Acquire::Retries=3 -y -q --no-install-suggests --no-install-recommends install curl libcurl4-openssl-dev libarchive-dev
|
|
|
|
- name: Build CMake
|
|
if: 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
|
|
flags=(
|
|
"-DCMAKE_BUILD_TYPE=Release"
|
|
"-DCMAKE_INSTALL_PREFIX=/tmp/cmake"
|
|
"-B" "__build"
|
|
"-Wno-dev" # Make configuring more silent
|
|
"-DCMAKE_USE_SYSTEM_CURL=1" # Avoid failures caused by newer (system) OpenSSL in CMake < 3.10
|
|
"-DCMAKE_CXX_FLAGS='-include cstdint -include limits'" # Fix missing includes in CMake < 3.10
|
|
)
|
|
cmake "${flags[@]}" .
|
|
cmake --build __build -- -j 3
|
|
cmake --build __build --target install
|
|
|
|
- name: Configure Boost with CMake ${{matrix.cmake_version}}
|
|
working-directory: ../boost-root
|
|
run: |
|
|
version_greater_equal() { printf '%s\n' "$2" "$1" | sort --check=quiet --version-sort; }
|
|
excluded=()
|
|
for cml in "$PWD"/libs/*/CMakeLists.txt "$PWD"/libs/numeric/*/CMakeLists.txt; do
|
|
lib=$(dirname "${cml#*libs/}")
|
|
if minimal_cmake_version=$(grep "cmake_minimum_required" "$cml" | grep -Eo '[0-9]\.[0-9]+' | head -1); then
|
|
version_greater_equal ${{matrix.cmake_version}} "$minimal_cmake_version" || excluded+=("$lib")
|
|
else
|
|
echo "Minimum required CMake version not found in $cml for library $lib"
|
|
fi
|
|
done
|
|
# Libraries that don't declare their correct minimal required CMake version or where dependencies require higher version
|
|
# Example: version_greater_equal ${{matrix.cmake_version}} 3.12.0 || excluded+=("name")
|
|
/tmp/cmake/bin/cmake --version
|
|
/tmp/cmake/bin/cmake -DBUILD_TESTING=${{matrix.enable_test}} -DBOOST_EXCLUDE_LIBRARIES="$(IFS=';'; echo "${excluded[*]}")" -B "__build_cmake-$version" .
|