windows.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. # Copyright (C) Viktor Szakats
  2. #
  3. # SPDX-License-Identifier: curl
  4. name: windows
  5. on:
  6. push:
  7. branches:
  8. - master
  9. - '*/ci'
  10. paths-ignore:
  11. - '**/*.md'
  12. - '.azure-pipelines.yml'
  13. - '.circleci/**'
  14. - '.cirrus.yml'
  15. - 'appveyor.*'
  16. - 'packages/**'
  17. - 'plan9/**'
  18. - 'projects/**'
  19. - 'winbuild/**'
  20. pull_request:
  21. branches:
  22. - master
  23. paths-ignore:
  24. - '**/*.md'
  25. - '.azure-pipelines.yml'
  26. - '.circleci/**'
  27. - '.cirrus.yml'
  28. - 'appveyor.*'
  29. - 'packages/**'
  30. - 'plan9/**'
  31. - 'projects/**'
  32. - 'winbuild/**'
  33. concurrency:
  34. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  35. cancel-in-progress: true
  36. permissions: {}
  37. jobs:
  38. cygwin:
  39. name: "cygwin (${{ matrix.build }}, ${{ matrix.platform }}, ${{ matrix.config }})"
  40. runs-on: windows-latest
  41. timeout-minutes: 45
  42. env:
  43. SHELLOPTS: 'igncr'
  44. strategy:
  45. matrix:
  46. include:
  47. - { build: 'automake', platform: 'x86_64', tflags: '', config: '--enable-debug --disable-threaded-resolver' }
  48. - { build: 'cmake' , platform: 'x86_64', tflags: '', config: '-DCURL_USE_OPENSSL=ON' }
  49. fail-fast: false
  50. steps:
  51. - run: git config --global core.autocrlf input
  52. - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
  53. - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
  54. with:
  55. platform: ${{ matrix.platform }}
  56. # https://cygwin.com/cgi-bin2/package-grep.cgi
  57. packages: autoconf libtool ${{ matrix.build }} gcc-core gcc-g++ binutils make libssl-devel zlib-devel libbrotli-devel libnghttp2-devel libpsl-devel libssh2-devel
  58. site: https://mirrors.kernel.org/sourceware/cygwin/
  59. - name: 'autotools configure'
  60. if: ${{ matrix.build == 'automake' }}
  61. timeout-minutes: 5
  62. shell: C:\cygwin\bin\bash.exe '{0}'
  63. run: |
  64. export PATH="/usr/bin:$(cygpath ${SYSTEMROOT})/system32"
  65. autoreconf -fi
  66. mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
  67. --prefix="${HOME}"/install \
  68. --enable-websockets \
  69. --with-openssl \
  70. --with-libssh2 \
  71. ${{ matrix.config }} || { tail -n 1200 config.log; false; }
  72. - name: 'autotools build'
  73. if: ${{ matrix.build == 'automake' }}
  74. timeout-minutes: 10
  75. shell: C:\cygwin\bin\bash.exe '{0}'
  76. run: |
  77. make -C bld -j3 V=1 install
  78. find . -name '*.exe' -o -name '*.dll'
  79. bld/src/curl.exe --disable --version
  80. - name: 'autotools build examples'
  81. if: ${{ matrix.build == 'automake' }}
  82. timeout-minutes: 5
  83. shell: C:\cygwin\bin\bash.exe '{0}'
  84. run: |
  85. make -C bld -j3 V=1 examples
  86. - name: 'autotools build tests'
  87. if: ${{ matrix.build == 'automake' }}
  88. timeout-minutes: 15
  89. shell: C:\cygwin\bin\bash.exe '{0}'
  90. run: |
  91. make -C bld -j3 -C tests V=1
  92. - name: 'autotools run tests'
  93. if: ${{ matrix.build == 'automake' && matrix.tflags != 'skip' }}
  94. timeout-minutes: 40
  95. shell: C:\cygwin\bin\bash.exe '{0}'
  96. run: |
  97. export TFLAGS='-j8 ${{ matrix.tflags }}'
  98. if [ -x "$(cygpath -u "${SYSTEMROOT}/System32/curl.exe")" ]; then
  99. TFLAGS+=" -ac $(cygpath -u "${SYSTEMROOT}/System32/curl.exe")"
  100. fi
  101. make -C bld -j3 V=1 test-ci
  102. - name: 'cmake configure'
  103. if: ${{ matrix.build == 'cmake' }}
  104. timeout-minutes: 5
  105. shell: C:\cygwin\bin\bash.exe '{0}'
  106. run: |
  107. export PATH="/usr/bin:$(cygpath ${SYSTEMROOT})/system32"
  108. cmake -B bld ${options} ${{ matrix.config }} \
  109. "-DCMAKE_C_FLAGS=${cflags}" \
  110. -DCMAKE_UNITY_BUILD=ON \
  111. -DCURL_WERROR=ON \
  112. -DBUILD_EXAMPLES=ON \
  113. -DENABLE_WEBSOCKETS=ON \
  114. -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON
  115. - name: 'cmake build'
  116. if: ${{ matrix.build == 'cmake' }}
  117. timeout-minutes: 10
  118. shell: C:\cygwin\bin\bash.exe '{0}'
  119. run: |
  120. cmake --build bld --config '${{ matrix.type }}' --parallel 3
  121. [[ '${{ matrix.config }}' != *'BUILD_SHARED_LIBS=OFF'* ]] && cp -f -p bld/lib/*.dll bld/src/
  122. find . -name '*.exe' -o -name '*.dll'
  123. bld/src/curl.exe --disable --version
  124. msys2:
  125. name: "msys2 (${{ matrix.build }}, ${{ matrix.sys }}, ${{ matrix.env }}, ${{ matrix.config }})"
  126. runs-on: windows-latest
  127. timeout-minutes: 45
  128. strategy:
  129. matrix:
  130. include:
  131. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !1233', config: '--enable-debug --disable-threaded-resolver --disable-proxy' }
  132. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '--enable-debug --disable-threaded-resolver' }
  133. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '' }
  134. # FIXME: WebSockets test results ignored due to frequent failures on native Windows:
  135. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '!TFTP ~2301 ~2302' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Debug' }
  136. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: 'skip' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release' }
  137. - { build: 'cmake' , sys: 'clang64', env: 'clang-x86_64', tflags: 'skip' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=OFF', type: 'Release' }
  138. fail-fast: false
  139. steps:
  140. - run: git config --global core.autocrlf input
  141. - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
  142. - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2
  143. if: ${{ matrix.sys == 'msys' }}
  144. with:
  145. msystem: ${{ matrix.sys }}
  146. # https://packages.msys2.org/search
  147. install: gcc ${{ matrix.build }} make openssl-devel zlib-devel brotli-devel libnghttp2-devel libpsl-devel libssh2-devel
  148. - uses: msys2/setup-msys2@d0e80f58dffbc64f6a3a1f43527d469b4fc7b6c8 # v2
  149. if: ${{ matrix.sys != 'msys' }}
  150. with:
  151. msystem: ${{ matrix.sys }}
  152. install: >-
  153. mingw-w64-${{ matrix.env }}-cc
  154. mingw-w64-${{ matrix.env }}-${{ matrix.build }} make
  155. mingw-w64-${{ matrix.env }}-openssl
  156. - name: 'autotools configure'
  157. if: ${{ matrix.build == 'autotools' }}
  158. timeout-minutes: 5
  159. shell: msys2 {0}
  160. run: |
  161. autoreconf -fi
  162. mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
  163. --prefix="${HOME}"/install \
  164. --enable-websockets \
  165. --with-openssl \
  166. --with-libssh2 \
  167. ${{ matrix.config }} || { tail -n 1200 config.log; false; }
  168. - name: 'autotools build'
  169. if: ${{ matrix.build == 'autotools' }}
  170. timeout-minutes: 10
  171. shell: msys2 {0}
  172. run: |
  173. make -C bld -j3 V=1 install
  174. find . -name '*.exe' -o -name '*.dll'
  175. bld/src/curl.exe --disable --version
  176. - name: 'autotools build examples'
  177. if: ${{ matrix.build == 'autotools' }}
  178. timeout-minutes: 5
  179. shell: msys2 {0}
  180. run: |
  181. make -C bld -j3 V=1 examples
  182. - name: 'autotools build tests'
  183. if: ${{ matrix.build == 'autotools' }}
  184. timeout-minutes: 10
  185. shell: msys2 {0}
  186. run: |
  187. make -C bld -j3 -C tests V=1
  188. - name: 'autotools run tests'
  189. if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skip' }}
  190. timeout-minutes: 30
  191. shell: msys2 {0}
  192. run: |
  193. export TFLAGS='-j14 ${{ matrix.tflags }}'
  194. if [ -x "$(cygpath -u 'C:/msys64/usr/bin/curl.exe')" ]; then
  195. TFLAGS+=" -ac $(cygpath -u 'C:/msys64/usr/bin/curl.exe')"
  196. fi
  197. make -C bld -j3 V=1 test-ci
  198. - name: 'cmake configure'
  199. if: ${{ matrix.build == 'cmake' }}
  200. timeout-minutes: 5
  201. shell: msys2 {0}
  202. run: |
  203. if [[ '${{ matrix.env }}' = 'clang'* ]]; then
  204. options='-DCMAKE_C_COMPILER=clang'
  205. else
  206. options='-DCMAKE_C_COMPILER=gcc'
  207. fi
  208. cflags='-Wno-deprecated-declarations'
  209. if [ '${{ matrix.test }}' = 'uwp' ]; then
  210. options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
  211. pacman --noconfirm --ask 20 --noprogressbar --sync --needed 'mingw-w64-${{ matrix.env }}-winstorecompat-git'
  212. specs="$(realpath gcc-specs-uwp)"
  213. gcc -dumpspecs | sed -e 's/-lmingwex/-lwindowsapp -lmingwex -lwindowsapp -lwindowsappcompat/' -e 's/-lmsvcrt/-lmsvcr120_app/' > "${specs}"
  214. cflags+=" -specs=${specs} -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
  215. # CMake (as of v3.26.4) gets confused and applies the MSVC rc.exe command-line
  216. # template to windres. Reset it to the windres template manually:
  217. rcopts='<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>'
  218. else
  219. rcopts=''
  220. fi
  221. [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
  222. [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
  223. [ '${{ matrix.type }}' = 'Release' ] && [[ '${{ matrix.config }}' = *'ENABLE_DEBUG=ON'* ]] && cflags+=' -DDEBUGBUILD'
  224. cmake -B bld ${options} ${{ matrix.config }} \
  225. "-DCMAKE_C_FLAGS=${cflags}" \
  226. "-DCMAKE_RC_COMPILE_OBJECT=${rcopts}" \
  227. "-DCMAKE_BUILD_TYPE=${{ matrix.type }}" \
  228. -DCMAKE_UNITY_BUILD=ON \
  229. -DCURL_WERROR=ON \
  230. -DBUILD_EXAMPLES=ON \
  231. -DENABLE_WEBSOCKETS=ON \
  232. -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON
  233. - name: 'cmake build'
  234. if: ${{ matrix.build == 'cmake' }}
  235. timeout-minutes: 10
  236. shell: msys2 {0}
  237. run: |
  238. cmake --build bld --config '${{ matrix.type }}' --parallel 3
  239. [[ '${{ matrix.config }}' != *'BUILD_SHARED_LIBS=OFF'* ]] && cp -f -p bld/lib/*.dll bld/src/
  240. find . -name '*.exe' -o -name '*.dll'
  241. bld/src/curl.exe --disable --version
  242. - name: 'cmake build tests'
  243. if: ${{ matrix.build == 'cmake' }}
  244. timeout-minutes: 10
  245. shell: msys2 {0}
  246. run: |
  247. cmake --build bld --config '${{ matrix.type }}' --parallel 3 --target testdeps
  248. - name: 'cmake run tests'
  249. if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skip' }}
  250. timeout-minutes: 40
  251. shell: msys2 {0}
  252. run: |
  253. export TFLAGS='-j14 ${{ matrix.tflags }}'
  254. if [ -x "$(cygpath -u 'C:/msys64/usr/bin/curl.exe')" ]; then
  255. TFLAGS+=" -ac $(cygpath -u 'C:/msys64/usr/bin/curl.exe')"
  256. fi
  257. ls bld/lib/*.dll >/dev/null 2>&1 && cp -f -p bld/lib/*.dll bld/tests/libtest/
  258. cmake --build bld --config '${{ matrix.type }}' --target test-ci