1--- 2name: windows 3 4on: 5 pull_request: 6 types: [opened, synchronize] 7 paths-ignore: 8 - '**.md' 9 - '.mailmap' 10 - 'ChangeLog*' 11 - 'whatsnew*' 12 - 'LICENSE' 13 push: 14 paths-ignore: 15 - '**.md' 16 - '.mailmap' 17 - 'ChangeLog*' 18 - 'whatsnew*' 19 - 'LICENSE' 20 21jobs: 22 vs2017: 23 runs-on: ${{ matrix.os }} 24 if: "!contains(github.event.head_commit.message, 'ci skip')" 25 strategy: 26 fail-fast: false 27 matrix: 28 os: [windows-2016] 29 EVENT_MATRIX: [NONE] 30 31 steps: 32 - uses: actions/checkout@v2.0.0 33 34 - name: Cache Depends 35 id: cache-depends 36 uses: actions/cache@v1.0.3 37 with: 38 path: C:\vcpkg\installed 39 key: ${{ matrix.os }}-vcpkg 40 41 - name: Cache Build 42 uses: actions/cache@v1.0.3 43 with: 44 path: build 45 key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-v3 46 47 - name: Install Depends 48 if: steps.cache-depends.outputs.cache-hit != 'true' 49 shell: powershell 50 run: | 51 vcpkg install openssl:x64-windows 52 vcpkg install zlib:x64-windows 53 54 - name: Build And Test 55 shell: powershell 56 run: | 57 $OPENSSL_ROOT_DIR="C:\vcpkg\installed\x64-windows" 58 $EVENT_BUILD_PARALLEL=10 59 $EVENT_TESTS_PARALLEL=1 60 $env:PATH="$OPENSSL_ROOT_DIR/bin;$env:PATH" 61 62 mkdir build -ea 0 63 cd build 64 65 $CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' .." 66 function cmake_configure($retry) 67 { 68 $errcode=0 69 try { 70 if ($retry -eq 0) { 71 echo "[cmake configure retry] $CMAKE_CMD" 72 } else { 73 echo "[cmake configure] $CMAKE_CMD" 74 } 75 Invoke-Expression $CMAKE_CMD 76 $errcode=$LastExitCode 77 } 78 catch { 79 $errcode=1 80 } 81 finally { 82 if ($errcode -ne 0) { 83 if ($retry -eq 0) { 84 $host.SetShouldExit($LastExitCode) 85 } else { 86 echo "Remove all entries in build directory" 87 rm -r -fo * 88 cmake_configure 0 89 } 90 } 91 } 92 } 93 cmake_configure 1 94 95 try { 96 cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal 97 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } 98 99 if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") { 100 python ../test-export/test-export.py static 101 } 102 elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { 103 python ../test-export/test-export.py shared 104 } 105 else { 106 ctest --output-on-failure -j $EVENT_TESTS_PARALLEL 107 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } 108 } 109 } catch { 110 $host.SetShouldExit($LastExitCode) 111 } 112 113 - uses: actions/upload-artifact@v1 114 if: failure() 115 with: 116 name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build 117 path: build 118 119 vs2019: 120 runs-on: ${{ matrix.os }} 121 if: "!contains(github.event.head_commit.message, 'ci skip')" 122 strategy: 123 fail-fast: false 124 matrix: 125 os: [windows-2019] 126 EVENT_MATRIX: 127 - NONE 128 - LIBRARY_TYPE_STATIC 129 - DISABLE_OPENSSL 130 - DISABLE_THREAD_SUPPORT 131 - DISABLE_DEBUG_MODE 132 - DISABLE_MM_REPLACEMENT 133 - DUNICODE 134 - TEST_EXPORT_SHARED 135 - TEST_EXPORT_STATIC 136 137 steps: 138 - uses: actions/checkout@v2.0.0 139 140 - name: Cache Depends 141 id: cache-depends 142 uses: actions/cache@v1.1.0 143 with: 144 path: C:\vcpkg\installed 145 key: ${{ matrix.os }}-vcpkg 146 147 - name: Cache Build 148 uses: actions/cache@v1.1.0 149 with: 150 path: build 151 key: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-v3 152 153 - name: Install Depends 154 if: steps.cache-depends.outputs.cache-hit != 'true' 155 shell: powershell 156 run: | 157 vcpkg install openssl:x64-windows 158 vcpkg install zlib:x64-windows 159 160 - name: Build And Test 161 shell: powershell 162 run: | 163 $OPENSSL_ROOT_DIR="C:\vcpkg\installed\x64-windows" 164 $EVENT_BUILD_PARALLEL=10 165 $EVENT_TESTS_PARALLEL=1 166 $env:PATH="$OPENSSL_ROOT_DIR/bin;$env:PATH" 167 168 if ( "${{ matrix.EVENT_MATRIX }}" -eq "LIBRARY_TYPE_STATIC" ) { 169 $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC" 170 } 171 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_OPENSSL" ) { 172 $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_OPENSSL=ON" 173 } 174 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_THREAD_SUPPORT" ) { 175 $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_THREAD_SUPPORT=ON" 176 } 177 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_DEBUG_MODE" ) { 178 $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_DEBUG_MODE=ON" 179 } 180 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "DISABLE_MM_REPLACEMENT" ) { 181 $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_MM_REPLACEMENT=ON" 182 } 183 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "UNICODE" ) { 184 $EVENT_CMAKE_OPTIONS="-DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'" 185 } 186 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED" ) { 187 $EVENT_CMAKE_OPTIONS="-DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" 188 } 189 elseif ( "${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC" ) { 190 $EVENT_CMAKE_OPTIONS="-DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_SAMPLES=ON" 191 } 192 else { 193 $EVENT_CMAKE_OPTIONS="" 194 } 195 196 mkdir build -ea 0 197 cd build 198 199 if ("${{ matrix.os }}" -eq "windows-2016") { 200 $CMAKE_CMD="cmake -G 'Visual Studio 15 2017 Win64' .." 201 } 202 else { # windows-2019 203 $CMAKE_CMD="cmake -G 'Visual Studio 16 2019' -A x64 .. $EVENT_CMAKE_OPTIONS" 204 } 205 function cmake_configure($retry) 206 { 207 $errcode=0 208 try { 209 if ($retry -eq 0) { 210 echo "[cmake configure retry] $CMAKE_CMD" 211 } else { 212 echo "[cmake configure] $CMAKE_CMD" 213 } 214 Invoke-Expression $CMAKE_CMD 215 $errcode=$LastExitCode 216 } 217 catch { 218 $errcode=1 219 } 220 finally { 221 if ($errcode -ne 0) { 222 if ($retry -eq 0) { 223 $host.SetShouldExit($LastExitCode) 224 } else { 225 echo "Remove all entries in build directory" 226 rm -r -fo * 227 cmake_configure 0 228 } 229 } 230 } 231 } 232 cmake_configure 1 233 234 try { 235 cmake --build . -j $EVENT_BUILD_PARALLEL -- /nologo /verbosity:minimal 236 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } 237 238 if ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_STATIC") { 239 python ../test-export/test-export.py static 240 } 241 elseif ("${{ matrix.EVENT_MATRIX }}" -eq "TEST_EXPORT_SHARED") { 242 python ../test-export/test-export.py shared 243 } 244 else { 245 ctest --output-on-failure -j $EVENT_TESTS_PARALLEL 246 if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } 247 } 248 } catch { 249 $host.SetShouldExit($LastExitCode) 250 } 251 252 - uses: actions/upload-artifact@v1 253 if: failure() 254 with: 255 name: ${{ matrix.os }}-${{ matrix.EVENT_MATRIX }}-build 256 path: build 257