name: CI on: pull_request: types: [opened, synchronize] push: branches: - cpp_master tags: - '*' jobs: macos: name: ${{ format('macOS (pattern {0})', matrix.pattern) }} runs-on: macos-latest strategy: fail-fast: false matrix: pattern: [0, 1, 2, 3, 4] steps: - name: Checkout uses: actions/checkout@v3 - name: Install Dependencies run: | brew update brew install --force llvm - name: Cache boost id: cache-boost uses: actions/cache@v3 with: path: ~/boost-prefix/ key: ${{ runner.os }}-boost-1-85-0-2024-05-27 - name: Build boost if: steps.cache-boost.outputs.cache-hit != 'true' run: ./.github/depends/boost.sh -b 64 -t clang -p $HOME/boost-prefix - name: Cache zlib id: cache-zlib uses: actions/cache@v3 with: path: ~/zlib-prefix/ key: ${{ runner.os }}-zlib-1-2-13-2022-11-02 - name: Build zlib if: steps.cache-zlib.outputs.cache-hit != 'true' run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix - name: Build and test shell: bash run: | # default configuration - overwrite its params later depending on matrix.pattern export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" export ARCH=64 export API_VERSION=3 export CHAR_SIGN="signed" export X3_PARSE="OFF" export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" case ${{ matrix.pattern }} in 0) export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" ;; 1) export API_VERSION=1 ;; 2) export API_VERSION=2 ;; 3) export X3_PARSE="ON" ;; 4) export CHAR_SIGN="unsigned" ;; esac # build and test export CXX="clang++" CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1 cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 linux: name: ${{ format('Linux (pattern {0})', matrix.pattern) }} runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] steps: - uses: actions/checkout@v3 - name: Install build dependencies shell: bash run: | sudo apt-get update sudo apt-get install g++-10 cmake valgrind -y sudo apt-get install g++-10-multilib -y # for 32-bit compile ./ci/set_gcc_10.sh - name: Set Architecture Environment shell: bash run: | if [ "${{ matrix.pattern }}" = "5" ] || [ "${{ matrix.pattern }}" = "11" ]; then echo "ARCH=32" >> $GITHUB_ENV echo "BOOST_BIT=both" >> $GITHUB_ENV else echo "ARCH=64" >> $GITHUB_ENV echo "BOOST_BIT=64" >> $GITHUB_ENV fi - name: Cache boost id: cache-boost uses: actions/cache@v3 with: path: ~/boost-prefix/ key: ${{ runner.os }}-boost-1-85-0-2026-05-30-${{ env.ARCH }} - name: Build boost if: steps.cache-boost.outputs.cache-hit != 'true' run: ./.github/depends/boost.sh -b ${{ env.BOOST_BIT }} -t gcc -p $HOME/boost-prefix - name: Cache zlib id: cache-zlib uses: actions/cache@v3 with: path: ~/zlib-prefix/ key: ${{ runner.os }}-zlib-1-3-2-2026-05-30-${{ env.ARCH }} - name: Build zlib if: steps.cache-zlib.outputs.cache-hit != 'true' run: ./.github/depends/zlib.sh -b ${{ env.BOOST_BIT }} -p $HOME/zlib-prefix - name: Build and test shell: bash run: | # default configuration - overwrite its params later depending on matrix.pattern export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" export API_VERSION=3 export CHAR_SIGN="signed" export X3_PARSE="OFF" export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" export ACTION="ci/build_cmake.sh" case ${{ matrix.pattern }} in 0) export CXX="clang++" export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" ;; 1) export CXX="g++-10" export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" ;; 2) export CXX="clang++" export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON" ;; 3) export CXX="g++-10" export MSGPACK_CXX_VERSION="MSGPACK_CXX17=ON" export MSGPACK_USE_STD_VARIANT_ADAPTOR="MSGPACK_USE_STD_VARIANT_ADAPTOR=ON" ;; 4) export CXX="clang++" export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" export NO_BOOST="-DMSGPACK_NO_BOOST" ;; 5) # ARCH=32 export CXX="g++-10" ;; 6) export CXX="clang++" export API_VERSION=2 ;; 7) export CXX="g++-10" export API_VERSION=1 ;; 8) export CXX="clang++" export CHAR_SIGN="unsigned" ;; 9) export CXX="g++-10" export X3_PARSE="ON" ;; 10) export CXX="clang++" export ACTION="ci/build_regression.sh" ;; 11) # ARCH=32 export CXX="g++-10" export CHAR_SIGN="unsigned" export X3_PARSE="ON" ;; esac # build and test CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE} ${NO_BOOST}" ci/build_cmake.sh || exit 1 cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 windows: name: ${{ format('Windows cxx{0}', matrix.cxx) }} runs-on: windows-2022 strategy: fail-fast: false matrix: # MSVC2022 only supports /std:c++14, /std:c++17 and /std:c++latest cxx: [14, 17, 20] pp_flag: ["/Zc:preprocessor-", "/Zc:preprocessor"] steps: - uses: actions/checkout@v3 - name: Cache vcpkg dependencies id: cache-vcpkg uses: actions/cache@v3 with: path: C:/vcpkg/installed/x64-windows key: ${{ runner.os }}-vcpkg-2021-08-09 - name: Install vcpkg dependencies if: steps.cache-vcpkg.outputs.cache-hit != 'true' shell: powershell run: | vcpkg update vcpkg install zlib:x64-windows vcpkg install boost-assert:x64-windows boost-numeric-conversion:x64-windows boost-variant:x64-windows boost-utility:x64-windows boost-fusion:x64-windows boost-optional:x64-windows boost-predef:x64-windows boost-preprocessor:x64-windows boost-timer:x64-windows boost-test:x64-windows - name: Build and test shell: powershell run: | $CPPVER="MSGPACK_CXX${{ matrix.cxx }}=ON" md build cmake ` -A x64 ` -G "Visual Studio 17 2022" ` -D CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ` -D MSGPACK_BUILD_TESTS=ON ` -D $CPPVER ` -D CMAKE_CXX_FLAGS="${{ matrix.pp_flag }} /D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING /D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING /D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING /W3 /WX" ` -B build ` -S . if ($LastExitCode -ne 0) { exit $LastExitCode } cmake --build build --config Release if ($LastExitCode -ne 0) { exit $LastExitCode } ctest -VV --test-dir build -C Release if ($LastExitCode -ne 0) { exit $LastExitCode }