windows.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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. - '.circleci/**'
  13. - 'appveyor.*'
  14. - 'packages/**'
  15. - 'plan9/**'
  16. - 'projects/**'
  17. - 'winbuild/**'
  18. pull_request:
  19. branches:
  20. - master
  21. paths-ignore:
  22. - '**/*.md'
  23. - '.circleci/**'
  24. - 'appveyor.*'
  25. - 'packages/**'
  26. - 'plan9/**'
  27. - 'projects/**'
  28. - 'winbuild/**'
  29. concurrency:
  30. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  31. cancel-in-progress: true
  32. permissions: {}
  33. jobs:
  34. msys2: # both msys and mingw-w64
  35. name: "${{ matrix.sys == 'msys' && 'msys2' || 'mingw' }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.env }} ${{ matrix.name }} ${{ matrix.test }}"
  36. runs-on: windows-latest
  37. timeout-minutes: 30
  38. defaults:
  39. run:
  40. shell: msys2 {0}
  41. strategy:
  42. matrix:
  43. include:
  44. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !1233', config: '--enable-debug --disable-threaded-resolver --disable-proxy', name: '!proxy' }
  45. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '--enable-debug --disable-threaded-resolver', name: 'default' }
  46. - { build: 'cmake' , sys: 'msys' , env: 'x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DENABLE_THREADED_RESOLVER=OFF', name: 'default' }
  47. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '', name: 'default R' }
  48. - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '--enable-debug --disable-threaded-resolver --disable-curldebug --enable-static=no --without-zlib', name: 'default' }
  49. - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: '~472 ~1299 ~1613' , config: '--enable-debug --enable-windows-unicode --enable-ares', name: 'c-ares U' }
  50. # FIXME: WebSockets test results ignored due to frequent failures on native Windows:
  51. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '~2301 ~2302' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_ARES=ON', type: 'Debug', name: 'schannel c-ares U' }
  52. - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_CURLDEBUG=ON', type: 'Release', name: 'schannel R TrackMemory' }
  53. - { build: 'cmake' , sys: 'clang64', env: 'clang-x86_64', tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=OFF', type: 'Release', name: 'openssl' }
  54. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release', test: 'uwp', name: 'schannel R' }
  55. - { build: 'cmake' , sys: 'mingw32', env: 'i686' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', type: 'Release', name: 'schannel R' }
  56. fail-fast: false
  57. steps:
  58. - run: git config --global core.autocrlf input
  59. shell: pwsh
  60. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
  61. - uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2
  62. if: ${{ matrix.sys == 'msys' }}
  63. with:
  64. msystem: ${{ matrix.sys }}
  65. # https://packages.msys2.org/search
  66. install: >-
  67. gcc
  68. ${{ matrix.build }} ${{ matrix.build == 'autotools' && 'make' || 'ninja' }}
  69. openssh
  70. openssl-devel
  71. zlib-devel
  72. brotli-devel
  73. libnghttp2-devel
  74. libpsl-devel
  75. libssh2-devel
  76. - uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2
  77. if: ${{ matrix.sys != 'msys' }}
  78. with:
  79. msystem: ${{ matrix.sys }}
  80. install: >-
  81. mingw-w64-${{ matrix.env }}-cc
  82. mingw-w64-${{ matrix.env }}-${{ matrix.build }} ${{ matrix.build == 'autotools' && 'make' || '' }}
  83. openssh
  84. mingw-w64-${{ matrix.env }}-openssl
  85. mingw-w64-${{ matrix.env }}-libssh2
  86. mingw-w64-${{ matrix.env }}-libpsl
  87. mingw-w64-${{ matrix.env }}-c-ares
  88. - name: 'autotools autoreconf'
  89. if: ${{ matrix.build == 'autotools' }}
  90. timeout-minutes: 2
  91. run: autoreconf -fi
  92. - name: 'autotools configure'
  93. if: ${{ matrix.build == 'autotools' }}
  94. timeout-minutes: 5
  95. run: |
  96. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  97. --prefix="${HOME}"/install \
  98. --enable-websockets \
  99. --with-openssl \
  100. --with-libssh2 \
  101. --disable-dependency-tracking \
  102. ${{ matrix.config }}
  103. - name: 'autotools configure log'
  104. if: ${{ matrix.build == 'autotools' && !cancelled() }}
  105. run: cat bld/config.log 2>/dev/null || true
  106. - name: 'curl_config.h'
  107. if: ${{ matrix.build == 'autotools' }}
  108. run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  109. - name: 'curl_config.h (full)'
  110. if: ${{ matrix.build == 'autotools' }}
  111. run: cat bld/lib/curl_config.h || true
  112. - name: 'autotools build'
  113. if: ${{ matrix.build == 'autotools' }}
  114. timeout-minutes: 10
  115. run: make -C bld -j5 V=1 install
  116. - name: 'curl version'
  117. if: ${{ matrix.build == 'autotools' }}
  118. timeout-minutes: 1
  119. run: |
  120. find . -name '*.exe' -o -name '*.dll'
  121. bld/src/curl.exe --disable --version
  122. - name: 'autotools build tests'
  123. if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skipall' }}
  124. timeout-minutes: 10
  125. run: make -C bld -j5 V=1 -C tests
  126. - name: 'install test tools'
  127. if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  128. timeout-minutes: 5
  129. run: |
  130. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
  131. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  132. - name: 'autotools run tests'
  133. if: ${{ matrix.build == 'autotools' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  134. timeout-minutes: 10
  135. run: |
  136. export TFLAGS='-j8 ${{ matrix.tflags }} ~SCP'
  137. if [ '${{ matrix.sys }}' != 'msys' ]; then
  138. TFLAGS+=' ~2301 ~2302' # WebSockets'
  139. TFLAGS+=' ~612 ~613 ~616 ~618' # SFTP
  140. else
  141. TFLAGS+=' ~SFTP'
  142. fi
  143. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  144. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  145. fi
  146. PATH="$PATH:/c/Program Files (x86)/stunnel/bin"
  147. make -C bld -j5 V=1 test-ci
  148. - name: 'autotools build examples'
  149. if: ${{ matrix.build == 'autotools' }}
  150. timeout-minutes: 5
  151. run: make -C bld -j5 V=1 examples
  152. - name: 'cmake configure'
  153. if: ${{ matrix.build == 'cmake' }}
  154. timeout-minutes: 5
  155. run: |
  156. if [[ '${{ matrix.env }}' = 'clang'* ]]; then
  157. options='-DCMAKE_C_COMPILER=clang'
  158. else
  159. options='-DCMAKE_C_COMPILER=gcc'
  160. fi
  161. if [ '${{ matrix.test }}' = 'uwp' ]; then
  162. options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
  163. pacman --noconfirm --ask 20 --noprogressbar --sync --needed 'mingw-w64-${{ matrix.env }}-winstorecompat-git'
  164. specs="$(realpath gcc-specs-uwp)"
  165. gcc -dumpspecs | sed -e 's/-lmingwex/-lwindowsapp -lmingwex -lwindowsapp -lwindowsappcompat/' -e 's/-lmsvcrt/-lmsvcr120_app/' > "${specs}"
  166. cflags="-specs=$(cygpath -w "${specs}") -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
  167. # CMake (as of v3.26.4) gets confused and applies the MSVC rc.exe command-line
  168. # template to windres. Reset it to the windres template manually:
  169. rcopts='<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>'
  170. else
  171. rcopts=''
  172. fi
  173. [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
  174. [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
  175. cmake -B bld -G Ninja ${options} \
  176. "-DCMAKE_C_FLAGS=${cflags}" \
  177. "-DCMAKE_RC_COMPILE_OBJECT=${rcopts}" \
  178. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  179. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  180. -DCURL_WERROR=ON \
  181. -DENABLE_WEBSOCKETS=ON \
  182. -DCURL_BROTLI=ON \
  183. ${{ matrix.config }}
  184. - name: 'cmake configure log'
  185. if: ${{ matrix.build == 'cmake' && !cancelled() }}
  186. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  187. - name: 'curl_config.h'
  188. if: ${{ matrix.build == 'cmake' }}
  189. run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  190. - name: 'curl_config.h (full)'
  191. if: ${{ matrix.build == 'cmake' }}
  192. run: cat bld/lib/curl_config.h || true
  193. - name: 'cmake build'
  194. if: ${{ matrix.build == 'cmake' }}
  195. timeout-minutes: 10
  196. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5
  197. - name: 'curl version'
  198. if: ${{ matrix.build == 'cmake' }}
  199. timeout-minutes: 1
  200. run: |
  201. find . -name '*.exe' -o -name '*.dll'
  202. if [ '${{ matrix.test }}' != 'uwp' ]; then # UWP missing 'msvcr120_app.dll', fails with exit code 0xc0000135
  203. PATH="$PWD/bld/lib:$PATH"
  204. bld/src/curl.exe --disable --version
  205. fi
  206. - name: 'cmake build tests'
  207. if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' }}
  208. timeout-minutes: 10
  209. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
  210. - name: 'install test tools'
  211. if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  212. timeout-minutes: 5
  213. run: |
  214. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
  215. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  216. - name: 'cmake run tests'
  217. if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  218. timeout-minutes: 10
  219. run: |
  220. export TFLAGS='-j8 ${{ matrix.tflags }} ~SCP'
  221. if [ '${{ matrix.sys }}' != 'msys' ]; then
  222. TFLAGS+=' ~WebSockets'
  223. TFLAGS+=' ~612 ~613 ~616 ~618' # SFTP
  224. else
  225. TFLAGS+=' ~SFTP'
  226. fi
  227. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  228. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  229. fi
  230. PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin"
  231. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  232. - name: 'cmake build examples'
  233. if: ${{ matrix.build == 'cmake' }}
  234. timeout-minutes: 5
  235. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
  236. old-mingw-w64:
  237. name: 'old-mingw, CM ${{ matrix.env }} ${{ matrix.name }}'
  238. runs-on: windows-latest
  239. timeout-minutes: 30
  240. defaults:
  241. run:
  242. shell: C:\msys64\usr\bin\bash.exe {0}
  243. strategy:
  244. matrix:
  245. include:
  246. - name: 'schannel'
  247. env: '9.5.0-x86_64'
  248. dir: 'mingw64'
  249. url: 'https://github.com/brechtsanders/winlibs_mingw/releases/download/9.5.0-10.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-9.5.0-mingw-w64msvcrt-10.0.0-r1.7z'
  250. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=OFF'
  251. type: 'Release'
  252. tflags: '~2301 ~2302 ~3027'
  253. - name: 'schannel U'
  254. env: '7.3.0-x86_64'
  255. dir: 'mingw64'
  256. url: 'https://downloads.sourceforge.net/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-win32/seh/x86_64-7.3.0-release-win32-seh-rt_v5-rev0.7z'
  257. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON'
  258. type: 'Release'
  259. tflags: '~2301 ~2302 ~3027 ~3023 ~3024 ~1451'
  260. - name: 'schannel !unity'
  261. env: '6.4.0-i686'
  262. dir: 'mingw32'
  263. url: 'https://downloads.sourceforge.net/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/6.4.0/threads-win32/dwarf/i686-6.4.0-release-win32-dwarf-rt_v5-rev0.7z'
  264. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=OFF -DCMAKE_UNITY_BUILD=OFF'
  265. type: 'Debug'
  266. tflags: 'skiprun'
  267. fail-fast: false
  268. steps:
  269. - name: 'cache compiler (gcc ${{ matrix.env }})'
  270. uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
  271. id: cache-compiler
  272. with:
  273. path: ~\my-cache
  274. key: ${{ runner.os }}-mingw-w64-${{ matrix.env }}
  275. - name: 'install compiler (gcc ${{ matrix.env }})'
  276. if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
  277. timeout-minutes: 5
  278. run: |
  279. cd "${USERPROFILE}" || exit 1
  280. mkdir my-cache
  281. cd my-cache || exit 1
  282. curl --fail --silent --show-error --retry 3 --retry-connrefused --output pack.bin --location --proto-redir =https '${{ matrix.url }}'
  283. pwd
  284. 7z x -y pack.bin >/dev/null
  285. rm -r -f pack.bin
  286. ls -l
  287. - run: git config --global core.autocrlf input
  288. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
  289. - name: 'cmake configure'
  290. timeout-minutes: 5
  291. run: |
  292. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  293. [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
  294. [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
  295. cmake -B bld -G 'MSYS Makefiles' ${options} \
  296. -DCMAKE_C_COMPILER=gcc \
  297. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  298. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  299. -DCURL_WERROR=ON \
  300. -DENABLE_WEBSOCKETS=ON \
  301. -DCURL_USE_LIBPSL=OFF \
  302. ${{ matrix.config }}
  303. - name: 'cmake configure log'
  304. if: ${{ !cancelled() }}
  305. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  306. - name: 'curl_config.h'
  307. run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  308. - name: 'curl_config.h (full)'
  309. run: cat bld/lib/curl_config.h || true
  310. - name: 'cmake build'
  311. timeout-minutes: 5
  312. run: |
  313. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  314. cmake --build bld --config '${{ matrix.type }}' --parallel 5
  315. - name: 'curl version'
  316. timeout-minutes: 1
  317. run: |
  318. find . -name '*.exe' -o -name '*.dll'
  319. PATH="$PWD/bld/lib:$PATH"
  320. bld/src/curl.exe --disable --version
  321. - name: 'cmake build tests'
  322. if: ${{ matrix.tflags != 'skipall' }}
  323. timeout-minutes: 10
  324. run: |
  325. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  326. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
  327. - name: 'install test tools'
  328. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  329. timeout-minutes: 5
  330. run: |
  331. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
  332. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  333. python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
  334. - name: 'cmake run tests'
  335. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  336. timeout-minutes: 10
  337. run: |
  338. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  339. export TFLAGS='-j4 ~WebSockets ${{ matrix.tflags }}'
  340. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  341. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  342. fi
  343. PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin"
  344. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  345. - name: 'cmake build examples'
  346. timeout-minutes: 5
  347. run: |
  348. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  349. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
  350. linux-cross-mingw-w64:
  351. name: "linux-mingw, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }}"
  352. runs-on: ubuntu-latest
  353. timeout-minutes: 15
  354. strategy:
  355. fail-fast: false
  356. matrix:
  357. build: [autotools, cmake]
  358. compiler: [gcc]
  359. env:
  360. TRIPLET: 'x86_64-w64-mingw32'
  361. steps:
  362. - name: 'install packages'
  363. run: sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install mingw-w64 ${{ matrix.build == 'cmake' && 'ninja-build' || '' }}
  364. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
  365. - name: 'autotools autoreconf'
  366. if: ${{ matrix.build == 'autotools' }}
  367. run: autoreconf -fi
  368. - name: 'autotools configure'
  369. if: ${{ matrix.build == 'autotools' }}
  370. run: |
  371. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  372. --host=${TRIPLET} \
  373. --with-schannel --with-winidn \
  374. --without-libpsl \
  375. --disable-dependency-tracking
  376. - name: 'autotools configure log'
  377. if: ${{ matrix.build == 'autotools' && !cancelled() }}
  378. run: cat bld/config.log 2>/dev/null || true
  379. - name: 'autotools build'
  380. if: ${{ matrix.build == 'autotools' }}
  381. run: make -C bld -j5
  382. - name: 'autotools build examples'
  383. if: ${{ matrix.build == 'autotools' }}
  384. run: make -C bld -j5 examples
  385. - name: 'cmake configure'
  386. if: ${{ matrix.build == 'cmake' }}
  387. run: |
  388. cmake -B bld -G Ninja \
  389. -DCMAKE_SYSTEM_NAME=Windows \
  390. -DCMAKE_C_COMPILER_TARGET=${TRIPLET} \
  391. -DCMAKE_C_COMPILER=${TRIPLET}-gcc \
  392. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  393. -DCURL_WERROR=ON \
  394. -DCURL_USE_SCHANNEL=ON -DUSE_WIN32_IDN=ON \
  395. -DCURL_USE_LIBPSL=OFF
  396. - name: 'cmake configure log'
  397. if: ${{ matrix.build == 'cmake' && !cancelled() }}
  398. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  399. - name: 'cmake build'
  400. if: ${{ matrix.build == 'cmake' }}
  401. run: cmake --build bld --parallel 5
  402. - name: 'cmake build tests'
  403. if: ${{ matrix.build == 'cmake' }}
  404. run: cmake --build bld --parallel 5 --target testdeps
  405. - name: 'cmake build examples'
  406. if: ${{ matrix.build == 'cmake' }}
  407. run: cmake --build bld --parallel 5 --target curl-examples
  408. msvc:
  409. name: 'msvc, CM ${{ matrix.arch }}-${{ matrix.plat }} ${{ matrix.name }}'
  410. runs-on: windows-latest
  411. timeout-minutes: 55
  412. defaults:
  413. run:
  414. shell: bash
  415. env:
  416. VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
  417. VCPKG_DISABLE_METRICS: '1'
  418. strategy:
  419. matrix:
  420. include:
  421. - name: 'schannel MultiSSL U'
  422. install: 'brotli zlib zstd libpsl nghttp2 libssh2[core,zlib] pkgconf gsasl openssl mbedtls shiftmedia-libgnutls'
  423. arch: 'x64'
  424. plat: 'windows'
  425. type: 'Debug'
  426. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  427. config: >
  428. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  429. -DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON -DCURL_USE_MBEDTLS=ON -DCURL_USE_GNUTLS=ON -DCURL_DEFAULT_SSL_BACKEND=schannel
  430. -DCURL_USE_GSASL=ON -DUSE_WIN32_IDN=ON -DENABLE_UNICODE=ON
  431. - name: 'openssl'
  432. install: 'brotli zlib zstd libpsl nghttp2 nghttp3 openssl libssh2 pkgconf gsasl c-ares libuv'
  433. arch: 'x64'
  434. plat: 'windows'
  435. type: 'Debug'
  436. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  437. config: >
  438. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  439. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
  440. -DCURL_USE_GSASL=ON -DENABLE_ARES=ON -DCURL_USE_LIBUV=ON
  441. - name: 'openssl'
  442. install: 'brotli zlib zstd nghttp2 nghttp3 openssl libssh2'
  443. arch: 'x64'
  444. plat: 'uwp'
  445. type: 'Debug'
  446. tflags: 'skiprun'
  447. config: >
  448. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  449. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
  450. -DCURL_USE_LIBPSL=OFF
  451. - name: 'libressl'
  452. install: 'brotli zlib zstd libpsl nghttp2 libressl libssh2[core,zlib]'
  453. arch: 'x64'
  454. plat: 'windows'
  455. type: 'Debug'
  456. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  457. config: >
  458. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  459. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON
  460. -DCURL_CA_SEARCH_SAFE=ON
  461. - name: 'boringssl-ECH'
  462. install: 'brotli zlib zstd libpsl nghttp2 boringssl libssh2[core,zlib]'
  463. arch: 'x64'
  464. plat: 'windows'
  465. type: 'Debug'
  466. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  467. config: >
  468. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  469. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON
  470. -DUSE_HTTPSRR=ON -DUSE_ECH=ON
  471. - name: 'wolfssl'
  472. install: 'brotli zlib zstd libpsl nghttp2 wolfssl libssh2 pkgconf gsasl ngtcp2[wolfssl] nghttp3'
  473. arch: 'x64'
  474. plat: 'windows'
  475. type: 'Debug'
  476. tflags: '~1516'
  477. config: >
  478. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  479. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_WOLFSSL=ON -DUSE_NGTCP2=ON
  480. -DCURL_USE_GSASL=ON
  481. - name: 'gnutls'
  482. install: 'brotli zlib zstd libpsl nghttp2 shiftmedia-libgnutls libssh pkgconf gsasl ngtcp2[gnutls] nghttp3'
  483. arch: 'x64'
  484. plat: 'windows'
  485. type: 'Debug'
  486. tflags: '~1516'
  487. # WARNING: libssh uses hard-coded world-writable paths (/etc/..., ~/.ssh/) to
  488. # read its configuration from, making it vulnerable to attacks on
  489. # Windows. Do not use this component till there is a fix for these.
  490. # https://github.com/curl/curl-for-win/blob/3951808deb04df9489ee17430f236ed54436f81a/libssh.sh#L6-L8
  491. config: >
  492. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
  493. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_GNUTLS=ON -DUSE_NGTCP2=ON
  494. -DCURL_USE_GSASL=ON
  495. - name: 'msh3'
  496. install: 'brotli zlib zstd libpsl nghttp2 msh3 libssh2 pkgconf gsasl'
  497. arch: 'x64'
  498. plat: 'windows'
  499. type: 'Debug'
  500. tflags: 'skipall'
  501. config: >
  502. -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
  503. -DCURL_USE_SCHANNEL=OFF -DUSE_MSH3=ON
  504. -DCURL_USE_GSASL=ON
  505. fail-fast: false
  506. steps:
  507. - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
  508. - name: 'vcpkg cache setup'
  509. uses: actions/github-script@v7
  510. with:
  511. script: |
  512. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  513. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  514. - name: 'vcpkg versions'
  515. timeout-minutes: 1
  516. run: |
  517. git -C "$VCPKG_INSTALLATION_ROOT" show --no-patch --format='%H %ai'
  518. vcpkg version
  519. - name: 'vcpkg build'
  520. timeout-minutes: 35
  521. run: vcpkg x-set-installed ${{ matrix.install }} '--triplet=${{ matrix.arch }}-${{ matrix.plat }}'
  522. - name: 'cmake configure'
  523. timeout-minutes: 5
  524. run: |
  525. if [[ '${{ matrix.install }}' = *'libressl'* ]]; then
  526. # without this, CMake gets confused by the non-vcpkg OpenSSL
  527. # installed on the runner and fails when linking.
  528. options+=" -DOPENSSL_ROOT_DIR=$VCPKG_INSTALLATION_ROOT/installed/${{ matrix.arch }}-${{ matrix.plat }}"
  529. fi
  530. cmake -B bld ${options} \
  531. "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
  532. "-DVCPKG_INSTALLED_DIR=$VCPKG_INSTALLATION_ROOT/installed" \
  533. '-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-${{ matrix.plat }}' \
  534. -DCMAKE_VS_GLOBALS=TrackFileAccess=false \
  535. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  536. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  537. -DCURL_WERROR=ON \
  538. -DBUILD_SHARED_LIBS=OFF \
  539. -DENABLE_DEBUG=ON \
  540. -DENABLE_WEBSOCKETS=ON \
  541. -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
  542. -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE= \
  543. ${{ matrix.config }}
  544. - name: 'cmake configure log'
  545. if: ${{ !cancelled() }}
  546. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  547. - name: 'curl_config.h'
  548. run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  549. - name: 'curl_config.h (full)'
  550. run: cat bld/lib/curl_config.h || true
  551. - name: 'cmake build'
  552. timeout-minutes: 5
  553. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5
  554. - name: 'curl version'
  555. timeout-minutes: 1
  556. run: |
  557. find . -name '*.exe' -o -name '*.dll'
  558. if [ '${{ matrix.plat }}' != 'uwp' ]; then
  559. PATH="$PWD/bld/lib:$PATH"
  560. bld/src/curl.exe --disable --version
  561. fi
  562. - name: 'cmake build tests'
  563. if: ${{ matrix.tflags != 'skipall' }}
  564. timeout-minutes: 10
  565. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
  566. - name: 'install test tools'
  567. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  568. timeout-minutes: 5
  569. run: |
  570. # GnuTLS is not fully functional on Windows, so skip the tests
  571. # https://github.com/ShiftMediaProject/gnutls/issues/23
  572. if [[ '${{ matrix.name }}' != *'gnutls'* ]]; then
  573. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel openssh || true
  574. fi
  575. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  576. python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
  577. - name: 'cmake run tests'
  578. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  579. timeout-minutes: 10
  580. run: |
  581. export TFLAGS='-j8 ~WebSockets ~SCP ~612 ${{ matrix.tflags }}'
  582. if [[ '${{ matrix.install }}' = *'libssh2[core,zlib]'* ]]; then
  583. TFLAGS+=' ~SFTP'
  584. elif [[ '${{ matrix.install }}' = *'libssh '* ]]; then
  585. TFLAGS+=' ~614' # 'SFTP pre-quote chmod' SFTP, pre-quote, directory
  586. fi
  587. PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin:/c/Program Files/OpenSSH-Win64"
  588. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  589. - name: 'cmake build examples'
  590. timeout-minutes: 5
  591. run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples