|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize] |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - cpp_master |
| 9 | + tags: |
| 10 | + - '*' |
| 11 | + |
| 12 | +jobs: |
| 13 | + macos: |
| 14 | + name: ${{ format('macOS (pattern {0})', matrix.pattern) }} |
| 15 | + runs-on: macos-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + pattern: [0, 1, 2, 3, 4] |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v3 |
| 23 | + - name: Install Dependencies |
| 24 | + run: | |
| 25 | + brew update |
| 26 | + brew install --force llvm |
| 27 | +
|
| 28 | + - name: Cache boost |
| 29 | + id: cache-boost |
| 30 | + uses: actions/cache@v3 |
| 31 | + with: |
| 32 | + path: ~/boost-prefix/ |
| 33 | + key: ${{ runner.os }}-boost-1-85-0-2024-05-27 |
| 34 | + |
| 35 | + - name: Build boost |
| 36 | + if: steps.cache-boost.outputs.cache-hit != 'true' |
| 37 | + run: ./.github/depends/boost.sh -b 64 -t clang -p $HOME/boost-prefix |
| 38 | + |
| 39 | + - name: Cache zlib |
| 40 | + id: cache-zlib |
| 41 | + uses: actions/cache@v3 |
| 42 | + with: |
| 43 | + path: ~/zlib-prefix/ |
| 44 | + key: ${{ runner.os }}-zlib-1-2-13-2022-11-02 |
| 45 | + |
| 46 | + - name: Build zlib |
| 47 | + if: steps.cache-zlib.outputs.cache-hit != 'true' |
| 48 | + run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix |
| 49 | + |
| 50 | + - name: Build and test |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + # default configuration - overwrite its params later depending on matrix.pattern |
| 54 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" |
| 55 | + export ARCH=64 |
| 56 | + export API_VERSION=3 |
| 57 | + export CHAR_SIGN="signed" |
| 58 | + export X3_PARSE="OFF" |
| 59 | + export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" |
| 60 | +
|
| 61 | + case ${{ matrix.pattern }} in |
| 62 | + 0) |
| 63 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" |
| 64 | + ;; |
| 65 | + 1) |
| 66 | + export API_VERSION=1 |
| 67 | + ;; |
| 68 | + 2) |
| 69 | + export API_VERSION=2 |
| 70 | + ;; |
| 71 | + 3) |
| 72 | + export X3_PARSE="ON" |
| 73 | + ;; |
| 74 | + 4) |
| 75 | + export CHAR_SIGN="unsigned" |
| 76 | + ;; |
| 77 | + esac |
| 78 | +
|
| 79 | + # build and test |
| 80 | + export CXX="clang++" |
| 81 | + CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1 |
| 82 | +
|
| 83 | + cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 |
| 84 | +
|
| 85 | + linux: |
| 86 | + name: ${{ format('Linux (pattern {0})', matrix.pattern) }} |
| 87 | + runs-on: ubuntu-24.04 |
| 88 | + strategy: |
| 89 | + fail-fast: false |
| 90 | + matrix: |
| 91 | + pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v3 |
| 94 | + |
| 95 | + - name: Install build dependencies |
| 96 | + shell: bash |
| 97 | + run: | |
| 98 | + sudo apt-get update |
| 99 | + sudo apt-get install g++-10 cmake valgrind -y |
| 100 | + sudo apt-get install g++-10-multilib -y # for 32-bit compile |
| 101 | + ./ci/set_gcc_10.sh |
| 102 | +
|
| 103 | + - name: Cache boost |
| 104 | + id: cache-boost |
| 105 | + uses: actions/cache@v3 |
| 106 | + with: |
| 107 | + path: ~/boost-prefix/ |
| 108 | + key: ${{ runner.os }}-boost-1-85-0-2024-05-27 |
| 109 | + |
| 110 | + - name: Build boost |
| 111 | + if: steps.cache-boost.outputs.cache-hit != 'true' |
| 112 | + run: ./.github/depends/boost.sh -b both -t gcc -p $HOME/boost-prefix |
| 113 | + |
| 114 | + - name: Cache zlib |
| 115 | + id: cache-zlib |
| 116 | + uses: actions/cache@v3 |
| 117 | + with: |
| 118 | + path: ~/zlib-prefix/ |
| 119 | + key: ${{ runner.os }}-zlib-1-2-13-2022-11-02 |
| 120 | + |
| 121 | + - name: Build zlib |
| 122 | + if: steps.cache-zlib.outputs.cache-hit != 'true' |
| 123 | + run: ./.github/depends/zlib.sh -b both -p $HOME/zlib-prefix |
| 124 | + |
| 125 | + - name: Build and test |
| 126 | + shell: bash |
| 127 | + run: | |
| 128 | + # default configuration - overwrite its params later depending on matrix.pattern |
| 129 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" |
| 130 | + export ARCH=64 |
| 131 | + export API_VERSION=3 |
| 132 | + export CHAR_SIGN="signed" |
| 133 | + export X3_PARSE="OFF" |
| 134 | + export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all" |
| 135 | + export ACTION="ci/build_cmake.sh" |
| 136 | +
|
| 137 | + case ${{ matrix.pattern }} in |
| 138 | + 0) |
| 139 | + export CXX="clang++" |
| 140 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" |
| 141 | + ;; |
| 142 | + 1) |
| 143 | + export CXX="g++-10" |
| 144 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON" |
| 145 | + ;; |
| 146 | + 2) |
| 147 | + export CXX="clang++" |
| 148 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON" |
| 149 | + ;; |
| 150 | + 3) |
| 151 | + export CXX="g++-10" |
| 152 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX17=ON" |
| 153 | + export MSGPACK_USE_STD_VARIANT_ADAPTOR="MSGPACK_USE_STD_VARIANT_ADAPTOR=ON" |
| 154 | + ;; |
| 155 | + 4) |
| 156 | + export CXX="clang++" |
| 157 | + export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON" |
| 158 | + export NO_BOOST="-DMSGPACK_NO_BOOST" |
| 159 | + ;; |
| 160 | + 5) |
| 161 | + export CXX="g++-10" |
| 162 | + export ARCH=32 |
| 163 | + ;; |
| 164 | + 6) |
| 165 | + export CXX="clang++" |
| 166 | + export API_VERSION=2 |
| 167 | + ;; |
| 168 | + 7) |
| 169 | + export CXX="g++-10" |
| 170 | + export API_VERSION=1 |
| 171 | + ;; |
| 172 | + 8) |
| 173 | + export CXX="clang++" |
| 174 | + export CHAR_SIGN="unsigned" |
| 175 | + ;; |
| 176 | + 9) |
| 177 | + export CXX="g++-10" |
| 178 | + export X3_PARSE="ON" |
| 179 | + ;; |
| 180 | + 10) |
| 181 | + export CXX="clang++" |
| 182 | + export ACTION="ci/build_regression.sh" |
| 183 | + ;; |
| 184 | + 11) |
| 185 | + export CXX="g++-10" |
| 186 | + export ARCH=32 |
| 187 | + export CHAR_SIGN="unsigned" |
| 188 | + export X3_PARSE="ON" |
| 189 | + ;; |
| 190 | + esac |
| 191 | +
|
| 192 | + # build and test |
| 193 | + CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE} ${NO_BOOST}" ci/build_cmake.sh || exit 1 |
| 194 | + cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 |
| 195 | +
|
| 196 | + windows: |
| 197 | + name: ${{ format('Windows cxx{0}', matrix.cxx) }} |
| 198 | + runs-on: windows-2022 |
| 199 | + strategy: |
| 200 | + fail-fast: false |
| 201 | + matrix: |
| 202 | + # MSVC2022 only supports /std:c++14, /std:c++17 and /std:c++latest |
| 203 | + cxx: [14, 17, 20] |
| 204 | + pp_flag: ["/Zc:preprocessor-", "/Zc:preprocessor"] |
| 205 | + steps: |
| 206 | + - uses: actions/checkout@v3 |
| 207 | + |
| 208 | + - name: Cache vcpkg dependencies |
| 209 | + id: cache-vcpkg |
| 210 | + uses: actions/cache@v3 |
| 211 | + with: |
| 212 | + path: C:/vcpkg/installed/x64-windows |
| 213 | + key: ${{ runner.os }}-vcpkg-2021-08-09 |
| 214 | + |
| 215 | + - name: Install vcpkg dependencies |
| 216 | + if: steps.cache-vcpkg.outputs.cache-hit != 'true' |
| 217 | + shell: powershell |
| 218 | + run: | |
| 219 | + vcpkg update |
| 220 | + vcpkg install zlib:x64-windows |
| 221 | + 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 |
| 222 | +
|
| 223 | + - name: Build and test |
| 224 | + shell: powershell |
| 225 | + run: | |
| 226 | + $CPPVER="MSGPACK_CXX${{ matrix.cxx }}=ON" |
| 227 | +
|
| 228 | + md build |
| 229 | + cmake ` |
| 230 | + -A x64 ` |
| 231 | + -G "Visual Studio 17 2022" ` |
| 232 | + -D CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" ` |
| 233 | + -D MSGPACK_BUILD_TESTS=ON ` |
| 234 | + -D $CPPVER ` |
| 235 | + -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" ` |
| 236 | + -B build ` |
| 237 | + -S . |
| 238 | + if ($LastExitCode -ne 0) { exit $LastExitCode } |
| 239 | +
|
| 240 | + cmake --build build --config Release |
| 241 | + if ($LastExitCode -ne 0) { exit $LastExitCode } |
| 242 | +
|
| 243 | + ctest -VV --test-dir build -C Release |
| 244 | + if ($LastExitCode -ne 0) { exit $LastExitCode } |
0 commit comments