Merge branch 'develop' #1189
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2019 - 2025 Alexander Grund | |
| # Distributed under the Boost Software License, Version 1.0. | |
| # https://www.boost.org/LICENSE_1_0.txt | |
| name: CI Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| - bugfix/** | |
| - feature/** | |
| - fix/** | |
| - github/** | |
| - pr/** | |
| paths-ignore: | |
| - LICENSE | |
| - meta/** | |
| - README.md | |
| concurrency: | |
| group: ${{format('ci_tests{0}:{1}', github.repository, github.ref)}} | |
| cancel-in-progress: true | |
| env: | |
| GIT_FETCH_JOBS: 8 | |
| NET_RETRY_COUNT: 5 | |
| B2_CI_VERSION: 1 | |
| jobs: | |
| NativeCMakeBuild: | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| os: [ubuntu-22.04, windows-2022] | |
| standalone: [Boost, Standalone] | |
| buildType: [Debug, Release] | |
| shared_lib: [ON, OFF] | |
| generator: ['Visual Studio 17 2022', 'MinGW Makefiles', 'Unix Makefiles'] | |
| exclude: | |
| - os: ubuntu-22.04 | |
| generator: MinGW Makefiles | |
| - os: ubuntu-22.04 | |
| generator: Visual Studio 17 2022 | |
| - os: ubuntu-22.04 | |
| buildType: Debug | |
| runs-on: ${{matrix.os}} | |
| env: | |
| DEP_DIR: ${{github.workspace}}/dependencies | |
| # VS 2022 only supported by Boost.Build 1.78+ with changes to build files (e.g. in Boost.Thread) required that are introduced in Boost 1.66 | |
| # Boost.Iostreams doesn't support VS 2022 until 1.69 | |
| BOOST_VERSION: ${{ startsWith(matrix.generator, 'Visual Studio') && '1.69.0' || '1.66.0' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Sanity check version | |
| run: grep -E 'set\(_version [0-9]' CMakeLists.txt | |
| - uses: actions/cache@v4 | |
| id: cache-boost | |
| with: | |
| path: ${{env.DEP_DIR}} | |
| key: ${{matrix.os}}-${{matrix.generator}}-${{env.BOOST_VERSION}} | |
| # Install newer CMake to be able to find Boost | |
| - name: Install CMake | |
| if: runner.os == 'Linux' && matrix.standalone == 'Boost' | |
| run: wget -qO- https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz | sudo tar --strip-components=1 -xzC /usr/local | |
| - name: Set BOOST_ROOT | |
| if: matrix.standalone == 'Boost' | |
| run: echo "BOOST_ROOT=${DEP_DIR//\\/\/}/boost_${BOOST_VERSION//./_}" >> $GITHUB_ENV | |
| # Install Boost | |
| - uses: actions/checkout@v4 | |
| if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' | |
| with: | |
| repository: boostorg/boost | |
| ref: boost-${{env.BOOST_VERSION}} | |
| path: __buildBoost | |
| fetch-depth: 1 | |
| - name: Bootstrap Boost | |
| if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' | |
| working-directory: __buildBoost | |
| run: | | |
| git submodule update --init --jobs 3 tools/boostdep libs/filesystem | |
| if [[ $BOOST_VERSION < '1.73.0' ]]; then | |
| (cd tools/boostdep && git fetch origin && git checkout boost-1.73.0 && git checkout boost-1.63.0 -- depinst/exceptions.txt) | |
| fi | |
| python tools/boostdep/depinst/depinst.py --include tools --exclude test --git_args '--jobs 3 --depth 1' filesystem | |
| if [[ "${{matrix.generator}}" =~ "Visual Studio" ]]; then | |
| toolset=msvc-14.3 | |
| # Boost.Build doesn't support MSVC 2022 (14.3) until 1.78 | |
| if [[ $BOOST_VERSION < '1.78.0' ]]; then | |
| (cd tools/build && git fetch --depth 1 origin boost-1.78.0 && git checkout FETCH_HEAD) | |
| git fetch --depth 1 origin boost-1.78.0 && git checkout FETCH_HEAD -- bootstrap.bat | |
| fi | |
| else | |
| toolset=gcc | |
| ./bootstrap.sh --with-toolset=$toolset --with-libraries=system,filesystem threading=multi || (cat bootstrap.log && false) | |
| ./b2 headers | |
| fi | |
| echo "B2_TOOLSET=$toolset" >> $GITHUB_ENV | |
| # The updated Boost requires a C++11 compiler which MinGW isn't and using VS implies using the CMD shell | |
| - name: Bootstrap Boost (MSVC) | |
| if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows') && startsWith(matrix.generator, 'Visual Studio') | |
| shell: cmd | |
| working-directory: __buildBoost | |
| run: | | |
| CALL .\bootstrap.bat --with-toolset=%B2_TOOLSET% --with-libraries=system,filesystem threading=multi | |
| IF %ERRORLEVEL% NEQ 0 ( | |
| ECHO Build failed, printing log | |
| TYPE bootstrap.log | |
| EXIT /B 1 | |
| ) | |
| .\b2 headers | |
| - name: Build Boost (Linux) | |
| if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu') | |
| working-directory: __buildBoost | |
| run: | | |
| ./b2 link=static toolset=$B2_TOOLSET address-model=64 -j$(nproc) --prefix="$BOOST_ROOT" install | |
| cd .. | |
| rm -r __buildBoost || true | |
| # Requires cmd shell as on windows-2022 with msvc-14.3 'cl' won't be found with bash | |
| - name: Build Boost (Windows) | |
| if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows') | |
| shell: cmd | |
| working-directory: __buildBoost | |
| run: | | |
| .\b2 link=static toolset=%B2_TOOLSET% address-model=64 -j 3 --prefix="%BOOST_ROOT%" install | |
| if %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL% | |
| cd .. | |
| rmdir /s /q __buildBoost | |
| - name: Create standalone | |
| if: matrix.standalone == 'Standalone' | |
| run: | | |
| bash tools/create_standalone.sh "$PWD/../nowide_standalone" | |
| rm -rf * | |
| cp -r ../nowide_standalone/* . | |
| mkdir build | |
| - name: Configure | |
| working-directory: build | |
| run: | | |
| extraFlags="-DBoost_DEBUG=ON -DBoost_NO_BOOST_CMAKE=ON -DCMAKE_INSTALL_PREFIX=$HOME/local" | |
| if ! [[ "${{matrix.generator}}" =~ "Visual Studio" ]]; then | |
| # Enable warning to find missing defines, especially important for the standalone version | |
| extraFlags+=" -DCMAKE_CXX_FLAGS=-Wundef" | |
| extraFlags+=" -DBoost_ARCHITECTURE=-x64" # ABI tag for MinGW | |
| fi | |
| cmake -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -DBUILD_SHARED_LIBS=${{matrix.shared_lib}} -G "${{matrix.generator}}" $extraFlags .. | |
| - name: Build | |
| run: cmake --build build --config ${{matrix.buildType}} --target tests | |
| # Run test with both bash and powershell and watch for "Using std::cin" on bash but not on powershell | |
| - name: Test | |
| working-directory: build | |
| run: | | |
| # The bash shell adds an incompatible PATH for MinGW: https://github.com/actions/runner-images/issues/11102 | |
| [[ "${{runner.os}}" != 'Windows' ]] || export PATH="/c/mingw64/bin:$PATH" | |
| ctest --output-on-failure -C ${{matrix.buildType}} --verbose | |
| - name: Test on PowerShell | |
| working-directory: build | |
| shell: powershell | |
| if: runner.os == 'Windows' | |
| run: ctest --output-on-failure -C ${{matrix.buildType}} --verbose | |
| - name: Install | |
| run: cmake --build build --config ${{matrix.buildType}} --target install | |
| - name: Test consumption | |
| working-directory: build | |
| run: | | |
| rm -r * | |
| cmake -DBOOST_NOWIDE_INSTALL_TEST=ON -DBoost_ARCHITECTURE=-x64 -DCMAKE_PREFIX_PATH=$HOME/local -G "${{matrix.generator}}" ../test/cmake_test | |
| cmake --build . --config ${{matrix.buildType}} | |
| ctest --output-on-failure -C ${{matrix.buildType}} | |
| CreateDocuTest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create documentation | |
| run: | | |
| sudo apt-get install -y doxygen | |
| bash doc/gendoc.sh | |
| CreateBoostDocuTest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch Boost.CI | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: boostorg/boost-ci | |
| ref: master | |
| path: boost-ci-cloned | |
| - name: Get CI scripts folder | |
| run: cp -r boost-ci-cloned/ci . && rm -rf boost-ci-cloned | |
| - name: Setup Boost | |
| run: source ci/github/install.sh | |
| - name: Create documentation | |
| run: | | |
| sudo apt-get install -y doxygen | |
| B2_TARGETS=libs/$SELF/doc ci/build.sh | |
| CheckFormatting: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DoozyX/clang-format-lint-action@v0.18 | |
| with: | |
| exclude: './doc' | |
| clangFormatVersion: 10 | |
| - name: Check line endings | |
| run: | | |
| if grep -r -l $'\r' --exclude-dir="\.git" --exclude-dir="html"; then | |
| echo "Found files windows style line endings (CRLF). Please fix!" | |
| exit 1 | |
| fi | |
| - name: Check for tabs | |
| run: | | |
| if grep -r -l $'\t' --exclude-dir="\.git" --exclude-dir="html"; then | |
| echo "Found files with TABs. Please fix!" | |
| exit 1 | |
| fi |