windows.yml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  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. cygwin:
  35. name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"
  36. runs-on: windows-latest
  37. timeout-minutes: 45
  38. defaults:
  39. run:
  40. shell: C:\cygwin\bin\bash.exe '{0}'
  41. env:
  42. SHELLOPTS: 'igncr'
  43. strategy:
  44. matrix:
  45. include:
  46. - { build: 'automake', platform: 'x86_64', tflags: 'skiprun', config: '', name: 'openssl R' }
  47. - { build: 'cmake' , platform: 'x86_64', tflags: '' , config: '-DENABLE_DEBUG=ON -DCURL_USE_OPENSSL=ON -DENABLE_THREADED_RESOLVER=OFF', name: 'openssl' }
  48. fail-fast: false
  49. steps:
  50. - run: git config --global core.autocrlf input
  51. shell: pwsh
  52. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  53. with:
  54. persist-credentials: false
  55. - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
  56. with:
  57. platform: ${{ matrix.platform }}
  58. site: https://mirrors.kernel.org/sourceware/cygwin/
  59. # https://cygwin.com/cgi-bin2/package-grep.cgi
  60. packages: >-
  61. autoconf libtool gcc-core gcc-g++ binutils
  62. ${{ matrix.build }} make ninja
  63. openssh
  64. libssl-devel
  65. libssh2-devel
  66. libpsl-devel
  67. zlib-devel
  68. libbrotli-devel
  69. libnghttp2-devel
  70. - name: 'autoreconf'
  71. if: ${{ matrix.build == 'automake' }}
  72. timeout-minutes: 2
  73. run: autoreconf -fi
  74. - name: 'configure'
  75. timeout-minutes: 5
  76. run: |
  77. if [ '${{ matrix.build }}' = 'cmake' ]; then
  78. PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
  79. cmake -B bld -G Ninja ${options} \
  80. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  81. -DCURL_WERROR=ON \
  82. ${{ matrix.config }}
  83. else
  84. PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
  85. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  86. --prefix="${HOME}"/install \
  87. --with-openssl \
  88. --with-libssh2 \
  89. --disable-dependency-tracking \
  90. ${{ matrix.config }}
  91. fi
  92. - name: 'configure log'
  93. if: ${{ !cancelled() }}
  94. run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  95. - name: 'curl_config.h'
  96. run: |
  97. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  98. grep -F '#define' bld/lib/curl_config.h | sort || true
  99. - name: 'build'
  100. timeout-minutes: 10
  101. run: |
  102. if [ '${{ matrix.build }}' = 'cmake' ]; then
  103. cmake --build bld --config '${{ matrix.type }}'
  104. else
  105. make -C bld -j5 V=1 install
  106. fi
  107. - name: 'curl version'
  108. timeout-minutes: 1
  109. run: |
  110. find . -name '*.exe' -o -name '*.dll'
  111. if [ '${{ matrix.build }}' = 'cmake' ]; then
  112. PATH="$PWD/bld/lib:$PATH"
  113. fi
  114. bld/src/curl.exe --disable --version
  115. - name: 'build tests'
  116. if: ${{ matrix.tflags != 'skipall' }}
  117. timeout-minutes: 15
  118. run: |
  119. if [ '${{ matrix.build }}' = 'cmake' ]; then
  120. cmake --build bld --config '${{ matrix.type }}' --target testdeps
  121. else
  122. make -C bld -j5 V=1 -C tests
  123. fi
  124. - name: 'run tests'
  125. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  126. timeout-minutes: 15
  127. run: |
  128. export TFLAGS='-j8 ${{ matrix.tflags }} ~615'
  129. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  130. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  131. fi
  132. if [ '${{ matrix.build }}' = 'cmake' ]; then
  133. PATH="$PWD/bld/lib:$PATH"
  134. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  135. else
  136. make -C bld -j5 V=1 test-ci
  137. fi
  138. - name: 'build examples'
  139. if: ${{ matrix.build == 'cmake' }}
  140. timeout-minutes: 5
  141. run: |
  142. if [ '${{ matrix.build }}' = 'cmake' ]; then
  143. cmake --build bld --config '${{ matrix.type }}' --target curl-examples
  144. else
  145. make -C bld -j5 V=1 examples
  146. fi
  147. msys2: # both msys and mingw-w64
  148. name: "${{ matrix.sys == 'msys' && 'msys2' || 'mingw' }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.env }} ${{ matrix.name }} ${{ matrix.test }}"
  149. runs-on: windows-latest
  150. timeout-minutes: 30
  151. defaults:
  152. run:
  153. shell: msys2 {0}
  154. strategy:
  155. matrix:
  156. include:
  157. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !1233', config: '--enable-debug --disable-threaded-resolver --disable-proxy', name: '!proxy' }
  158. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: 'skiprun' , config: '--enable-debug --disable-threaded-resolver', name: 'default' }
  159. - { build: 'cmake' , sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '-DENABLE_DEBUG=ON -DENABLE_THREADED_RESOLVER=OFF', name: 'default' }
  160. - { build: 'autotools', sys: 'msys' , env: 'x86_64' , tflags: '!19 !504 !704 !705 !1233', config: '', name: 'default R' }
  161. - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '--enable-debug --disable-threaded-resolver --disable-curldebug --enable-static=no --without-zlib', name: 'default' }
  162. - { build: 'autotools', sys: 'mingw64', env: 'x86_64' , tflags: '' , config: '--enable-debug --enable-windows-unicode --enable-ares', name: 'c-ares U' }
  163. # FIXME: WebSockets test results ignored due to frequent failures on native Windows:
  164. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: '' , 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' }
  165. - { 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' }
  166. - { 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' }
  167. - { build: 'cmake' , sys: 'ucrt64' , env: 'ucrt-x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON', type: 'Release', test: 'uwp', name: 'schannel' }
  168. - { build: 'cmake' , sys: 'mingw64', env: 'x86_64' , tflags: 'skiprun' , config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=ON -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DCMAKE_VERBOSE_MAKEFILE=ON', type: 'Debug', cflags: '-DCURL_SCHANNEL_DEV_DEBUG', name: 'schannel dev debug' }
  169. - { 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' }
  170. fail-fast: false
  171. steps:
  172. - run: git config --global core.autocrlf input
  173. shell: pwsh
  174. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  175. with:
  176. persist-credentials: false
  177. - uses: msys2/setup-msys2@d44ca8e88d8b43d56cf5670f91747359d5537f97 # v2
  178. if: ${{ matrix.sys == 'msys' }}
  179. with:
  180. msystem: ${{ matrix.sys }}
  181. # https://packages.msys2.org/search
  182. install: >-
  183. gcc
  184. ${{ matrix.build }} ${{ matrix.build == 'autotools' && 'make' || 'ninja' }}
  185. openssh
  186. openssl-devel
  187. zlib-devel
  188. brotli-devel
  189. libnghttp2-devel
  190. libpsl-devel
  191. libssh2-devel
  192. - uses: msys2/setup-msys2@d44ca8e88d8b43d56cf5670f91747359d5537f97 # v2
  193. if: ${{ matrix.sys != 'msys' }}
  194. with:
  195. msystem: ${{ matrix.sys }}
  196. install: >-
  197. mingw-w64-${{ matrix.env }}-cc
  198. mingw-w64-${{ matrix.env }}-${{ matrix.build }} ${{ matrix.build == 'autotools' && 'make' || '' }}
  199. openssh
  200. mingw-w64-${{ matrix.env }}-openssl
  201. mingw-w64-${{ matrix.env }}-libssh2
  202. mingw-w64-${{ matrix.env }}-libpsl
  203. mingw-w64-${{ matrix.env }}-c-ares
  204. - name: 'autoreconf'
  205. if: ${{ matrix.build == 'autotools' }}
  206. timeout-minutes: 2
  207. run: autoreconf -fi
  208. - name: 'configure'
  209. timeout-minutes: 5
  210. run: |
  211. if [ '${{ matrix.build }}' = 'cmake' ]; then
  212. if [[ '${{ matrix.env }}' = 'clang'* ]]; then
  213. options='-DCMAKE_C_COMPILER=clang'
  214. else
  215. options='-DCMAKE_C_COMPILER=gcc'
  216. fi
  217. if [ '${{ matrix.test }}' = 'uwp' ]; then
  218. options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
  219. cflags='-DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP'
  220. if [[ '${{ matrix.env }}' != 'clang'* ]]; then
  221. specs="$(realpath gcc-specs-uwp)"
  222. gcc -dumpspecs | sed -e 's/-lmingwex/-lwindowsapp -lmingwex -lwindowsapp/' -e 's/-lmsvcrt/-lucrtapp/' > "${specs}"
  223. cflags+=" -specs=$(cygpath -w "${specs}")"
  224. fi
  225. # CMake (as of v3.31.0) gets confused and applies the MSVC rc.exe command-line
  226. # template to windres. Reset it to the windres template manually:
  227. rcopts='<CMAKE_RC_COMPILER> -O coff <DEFINES> <INCLUDES> <FLAGS> <SOURCE> <OBJECT>'
  228. else
  229. rcopts=''
  230. fi
  231. [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
  232. [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
  233. cmake -B bld -G Ninja ${options} \
  234. "-DCMAKE_C_FLAGS=${{ matrix.cflags }} ${cflags}" \
  235. "-DCMAKE_RC_COMPILE_OBJECT=${rcopts}" \
  236. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  237. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  238. -DCURL_WERROR=ON \
  239. ${{ matrix.config }}
  240. else
  241. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  242. --prefix="${HOME}"/install \
  243. --with-openssl \
  244. --with-libssh2 \
  245. --disable-dependency-tracking \
  246. ${{ matrix.config }}
  247. fi
  248. - name: 'configure log'
  249. if: ${{ !cancelled() }}
  250. run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  251. - name: 'curl_config.h'
  252. run: |
  253. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  254. grep -F '#define' bld/lib/curl_config.h | sort || true
  255. - name: 'build'
  256. timeout-minutes: 10
  257. run: |
  258. if [ '${{ matrix.build }}' = 'cmake' ]; then
  259. cmake --build bld --config '${{ matrix.type }}'
  260. else
  261. make -C bld -j5 V=1 install
  262. fi
  263. - name: 'curl version'
  264. timeout-minutes: 1
  265. run: |
  266. if [ '${{ matrix.build }}' = 'cmake' ]; then
  267. PATH="$PWD/bld/lib:$PATH"
  268. else
  269. PATH="$PWD/bld/lib/.libs:$PATH"
  270. # avoid libtool's curl.exe wrapper
  271. mv bld/src/.libs/curl.exe bld/src/curl.exe
  272. fi
  273. find . -name '*.exe' -o -name '*.dll'
  274. if [ '${{ matrix.test }}' != 'uwp' ]; then # curl: error initializing curl library
  275. bld/src/curl.exe --disable --version
  276. fi
  277. - name: 'build tests'
  278. if: ${{ matrix.tflags != 'skipall' }} # Save time by skipping this for autotools
  279. timeout-minutes: 10
  280. run: |
  281. if [ '${{ matrix.build }}' = 'cmake' ]; then
  282. cmake --build bld --config '${{ matrix.type }}' --target testdeps
  283. else
  284. make -C bld -j5 V=1 -C tests
  285. fi
  286. if [ '${{ matrix.build }}' != 'cmake' ]; then
  287. # avoid libtool's .exe wrappers
  288. mv bld/tests/http/clients/.libs/*.exe bld/tests/http/clients
  289. mv bld/tests/libtest/.libs/*.exe bld/tests/libtest
  290. mv bld/tests/server/.libs/*.exe bld/tests/server
  291. mv bld/tests/unit/.libs/*.exe bld/tests/unit || true
  292. fi
  293. - name: 'install test prereqs'
  294. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  295. timeout-minutes: 5
  296. run: |
  297. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
  298. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  299. - name: 'run tests'
  300. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  301. timeout-minutes: 10
  302. run: |
  303. export TFLAGS='-j8 ${{ matrix.tflags }} ~SCP'
  304. if [ '${{ matrix.sys }}' != 'msys' ]; then
  305. TFLAGS+=' ~2301 ~2302' # WebSockets'
  306. TFLAGS+=' ~612 ~613 ~616 ~618' # SFTP
  307. else
  308. TFLAGS+=' ~SFTP'
  309. fi
  310. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  311. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  312. fi
  313. PATH="$PATH:/c/Program Files (x86)/stunnel/bin"
  314. if [ '${{ matrix.build }}' = 'cmake' ]; then
  315. PATH="$PWD/bld/lib:$PATH"
  316. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  317. else
  318. PATH="$PWD/bld/lib/.libs:$PATH"
  319. make -C bld -j5 V=1 test-ci
  320. fi
  321. - name: 'build examples'
  322. if: ${{ matrix.build == 'cmake' || (matrix.tflags == 'skipall' || matrix.tflags == 'skiprun') }} # Save time by skipping this for autotools running tests
  323. timeout-minutes: 5
  324. run: |
  325. if [ '${{ matrix.build }}' = 'cmake' ]; then
  326. cmake --build bld --config '${{ matrix.type }}' --target curl-examples
  327. else
  328. make -C bld -j5 V=1 examples
  329. fi
  330. old-mingw-w64:
  331. name: 'old-mingw, CM ${{ matrix.env }} ${{ matrix.name }}'
  332. runs-on: windows-latest
  333. timeout-minutes: 30
  334. defaults:
  335. run:
  336. shell: C:\msys64\usr\bin\bash.exe {0}
  337. strategy:
  338. matrix:
  339. include:
  340. - name: 'schannel'
  341. env: '9.5.0-x86_64'
  342. dir: 'mingw64'
  343. 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'
  344. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=OFF'
  345. type: 'Release'
  346. tflags: '~2301 ~2302 ~3027'
  347. - name: 'schannel U'
  348. env: '7.3.0-x86_64'
  349. dir: 'mingw64'
  350. 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'
  351. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON'
  352. type: 'Release'
  353. tflags: '~2301 ~2302 ~3027 ~3023 ~3024 ~1451'
  354. - name: 'schannel !unity'
  355. env: '6.4.0-i686'
  356. dir: 'mingw32'
  357. 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'
  358. config: '-DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=OFF -DCMAKE_UNITY_BUILD=OFF'
  359. type: 'Debug'
  360. tflags: 'skiprun'
  361. fail-fast: false
  362. steps:
  363. - name: 'cache compiler (gcc ${{ matrix.env }})'
  364. uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
  365. id: cache-compiler
  366. with:
  367. path: ~\my-cache
  368. key: ${{ runner.os }}-mingw-w64-${{ matrix.env }}
  369. - name: 'install compiler (gcc ${{ matrix.env }})'
  370. if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
  371. timeout-minutes: 5
  372. run: |
  373. cd "${USERPROFILE}" || exit 1
  374. mkdir my-cache
  375. cd my-cache || exit 1
  376. curl --fail --silent --show-error --retry 3 --retry-connrefused --output pack.bin --location --proto-redir =https '${{ matrix.url }}'
  377. pwd
  378. 7z x -y pack.bin >/dev/null
  379. rm -r -f pack.bin
  380. ls -l
  381. - run: git config --global core.autocrlf input
  382. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  383. with:
  384. persist-credentials: false
  385. - name: 'configure'
  386. timeout-minutes: 5
  387. run: |
  388. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  389. [ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
  390. [ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
  391. cmake -B bld -G 'MSYS Makefiles' ${options} \
  392. -DCMAKE_C_COMPILER=gcc \
  393. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  394. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  395. -DCURL_WERROR=ON \
  396. -DCURL_USE_LIBPSL=OFF \
  397. ${{ matrix.config }}
  398. - name: 'configure log'
  399. if: ${{ !cancelled() }}
  400. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  401. - name: 'curl_config.h'
  402. run: |
  403. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  404. grep -F '#define' bld/lib/curl_config.h | sort || true
  405. - name: 'build'
  406. timeout-minutes: 5
  407. run: |
  408. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  409. cmake --build bld --config '${{ matrix.type }}' --parallel 5
  410. - name: 'curl version'
  411. timeout-minutes: 1
  412. run: |
  413. PATH=/usr/bin find . -name '*.exe' -o -name '*.dll'
  414. PATH="$PWD/bld/lib:$PATH"
  415. bld/src/curl.exe --disable --version
  416. - name: 'build tests'
  417. if: ${{ matrix.tflags != 'skipall' }}
  418. timeout-minutes: 10
  419. run: |
  420. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  421. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
  422. - name: 'install test prereqs'
  423. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  424. timeout-minutes: 5
  425. run: |
  426. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel || true
  427. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  428. python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
  429. - name: 'run tests'
  430. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  431. timeout-minutes: 10
  432. run: |
  433. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  434. export TFLAGS='-j4 ~WebSockets ${{ matrix.tflags }}'
  435. if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
  436. TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
  437. fi
  438. PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin"
  439. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  440. - name: 'build examples'
  441. timeout-minutes: 5
  442. run: |
  443. PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
  444. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
  445. linux-cross-mingw-w64:
  446. name: "linux-mingw, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }}"
  447. runs-on: ubuntu-latest
  448. timeout-minutes: 15
  449. strategy:
  450. fail-fast: false
  451. matrix:
  452. build: [autotools, cmake]
  453. compiler: [gcc]
  454. env:
  455. TRIPLET: 'x86_64-w64-mingw32'
  456. steps:
  457. - name: 'install packages'
  458. run: sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install mingw-w64 ${{ matrix.build == 'cmake' && 'ninja-build' || '' }}
  459. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  460. with:
  461. persist-credentials: false
  462. - name: 'autoreconf'
  463. if: ${{ matrix.build == 'autotools' }}
  464. run: autoreconf -fi
  465. - name: 'configure'
  466. run: |
  467. if [ '${{ matrix.build }}' = 'cmake' ]; then
  468. cmake -B bld -G Ninja \
  469. -DCMAKE_SYSTEM_NAME=Windows \
  470. -DCMAKE_C_COMPILER_TARGET=${TRIPLET} \
  471. -DCMAKE_C_COMPILER=${TRIPLET}-gcc \
  472. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  473. -DCURL_WERROR=ON \
  474. -DCURL_USE_SCHANNEL=ON -DUSE_WIN32_IDN=ON \
  475. -DCURL_USE_LIBPSL=OFF
  476. else
  477. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  478. --host=${TRIPLET} \
  479. --with-schannel --with-winidn \
  480. --without-libpsl \
  481. --disable-dependency-tracking
  482. fi
  483. - name: 'configure log'
  484. if: ${{ !cancelled() }}
  485. run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  486. - name: 'curl_config.h'
  487. run: |
  488. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  489. grep -F '#define' bld/lib/curl_config.h | sort || true
  490. - name: 'build'
  491. run: |
  492. if [ '${{ matrix.build }}' = 'cmake' ]; then
  493. cmake --build bld
  494. else
  495. make -C bld -j5
  496. fi
  497. - name: 'build tests'
  498. if: ${{ matrix.build == 'cmake' }} # Save time by skipping this for autotools
  499. run: |
  500. if [ '${{ matrix.build }}' = 'cmake' ]; then
  501. cmake --build bld --target testdeps
  502. else
  503. make -C bld -j5 -C tests
  504. fi
  505. - name: 'build examples'
  506. run: |
  507. if [ '${{ matrix.build }}' = 'cmake' ]; then
  508. cmake --build bld --target curl-examples
  509. else
  510. make -C bld -j5 examples
  511. fi
  512. msvc:
  513. name: 'msvc, CM ${{ matrix.arch }}-${{ matrix.plat }} ${{ matrix.name }}'
  514. runs-on: windows-latest
  515. timeout-minutes: 55
  516. defaults:
  517. run:
  518. shell: C:\msys64\usr\bin\bash.exe {0}
  519. env:
  520. VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
  521. VCPKG_DISABLE_METRICS: '1'
  522. strategy:
  523. matrix:
  524. include:
  525. - name: 'schannel MultiSSL U'
  526. install: 'brotli zlib zstd libpsl nghttp2 libssh2[core,zlib] pkgconf gsasl openssl mbedtls'
  527. arch: 'x64'
  528. plat: 'windows'
  529. type: 'Debug'
  530. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  531. config: >-
  532. -DCURL_USE_LIBSSH2=ON
  533. -DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON -DCURL_USE_MBEDTLS=ON -DCURL_DEFAULT_SSL_BACKEND=schannel
  534. -DCURL_USE_GSASL=ON -DUSE_WIN32_IDN=ON -DENABLE_UNICODE=ON
  535. - name: 'openssl'
  536. install: 'brotli zlib zstd libpsl nghttp2 nghttp3 openssl libssh2 pkgconf gsasl c-ares libuv krb5'
  537. arch: 'x64'
  538. plat: 'windows'
  539. type: 'Debug'
  540. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  541. config: >-
  542. -DCURL_USE_LIBSSH2=ON
  543. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
  544. -DCURL_USE_GSASL=ON -DENABLE_ARES=ON -DCURL_USE_LIBUV=ON -DCURL_USE_GSSAPI=ON
  545. - name: 'openssl'
  546. install: 'brotli zlib zstd nghttp2 nghttp3 openssl libssh2'
  547. arch: 'x64'
  548. plat: 'uwp'
  549. type: 'Debug'
  550. tflags: 'skiprun'
  551. config: >-
  552. -DCURL_USE_LIBSSH2=ON
  553. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
  554. -DCURL_USE_LIBPSL=OFF
  555. - name: 'libressl'
  556. install: 'brotli zlib zstd libpsl nghttp2 libressl libssh2[core,zlib] pkgconf ngtcp2[libressl] nghttp3'
  557. arch: 'x64'
  558. plat: 'windows'
  559. type: 'Debug'
  560. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  561. config: >-
  562. -DCURL_USE_LIBSSH2=ON
  563. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_NGTCP2=ON
  564. -DCURL_CA_SEARCH_SAFE=ON
  565. - name: 'boringssl'
  566. install: 'brotli zlib zstd libpsl nghttp2 boringssl libssh2[core,zlib]'
  567. arch: 'x64'
  568. plat: 'windows'
  569. type: 'Debug'
  570. tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
  571. config: >-
  572. -DCURL_USE_LIBSSH2=ON
  573. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON
  574. -DUSE_ECH=ON
  575. - name: 'wolfssl'
  576. install: 'brotli zlib zstd libpsl nghttp2 wolfssl libssh2 pkgconf gsasl ngtcp2[wolfssl] nghttp3'
  577. arch: 'x64'
  578. plat: 'windows'
  579. type: 'Debug'
  580. tflags: '~1516'
  581. config: >-
  582. -DCURL_USE_LIBSSH2=ON
  583. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_WOLFSSL=ON -DUSE_NGTCP2=ON
  584. -DCURL_USE_GSASL=ON
  585. -DUSE_ECH=ON
  586. - name: 'mbedtls'
  587. install: 'brotli zlib zstd libpsl nghttp2 mbedtls libssh pkgconf gsasl'
  588. arch: 'x64'
  589. plat: 'windows'
  590. type: 'Debug'
  591. tflags: '~1516'
  592. # WARNING: libssh uses hard-coded world-writable paths (/etc/..., ~/.ssh/) to
  593. # read its configuration from, making it vulnerable to attacks on
  594. # Windows. Do not use this component till there is a fix for these.
  595. # https://github.com/curl/curl-for-win/blob/3951808deb04df9489ee17430f236ed54436f81a/libssh.sh#L6-L8
  596. config: >-
  597. -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
  598. -DCURL_USE_SCHANNEL=OFF -DCURL_USE_MBEDTLS=ON
  599. -DCURL_USE_GSASL=ON
  600. - name: 'msh3'
  601. install: 'brotli zlib zstd libpsl nghttp2 msh3 libssh2 pkgconf gsasl'
  602. arch: 'x64'
  603. plat: 'windows'
  604. type: 'Debug'
  605. tflags: 'skipall'
  606. config: >-
  607. -DCURL_USE_LIBSSH2=ON
  608. -DCURL_USE_SCHANNEL=OFF -DUSE_MSH3=ON
  609. -DCURL_USE_GSASL=ON
  610. fail-fast: false
  611. steps:
  612. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
  613. with:
  614. persist-credentials: false
  615. - name: 'vcpkg cache setup'
  616. uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
  617. with:
  618. script: |
  619. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  620. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  621. - name: 'vcpkg versions'
  622. timeout-minutes: 1
  623. run: |
  624. git -C "$VCPKG_INSTALLATION_ROOT" show --no-patch --format='%H %ai'
  625. vcpkg version
  626. - name: 'vcpkg build'
  627. timeout-minutes: 35
  628. run: vcpkg x-set-installed ${{ matrix.install }} '--triplet=${{ matrix.arch }}-${{ matrix.plat }}'
  629. - name: 'configure'
  630. timeout-minutes: 5
  631. run: |
  632. PATH="/c/msys64/usr/bin:$PATH"
  633. if [ '${{ matrix.plat }}' = 'uwp' ]; then
  634. options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
  635. cflags='-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP'
  636. ldflags='/OPT:NOREF /OPT:NOICF /APPCONTAINER:NO'
  637. vsglobals=';AppxPackage=false;WindowsAppContainer=false'
  638. fi
  639. cmake -B bld ${options} \
  640. "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
  641. "-DVCPKG_INSTALLED_DIR=$VCPKG_INSTALLATION_ROOT/installed" \
  642. '-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-${{ matrix.plat }}' \
  643. "-DCMAKE_C_FLAGS=${cflags}" \
  644. "-DCMAKE_EXE_LINKER_FLAGS=/INCREMENTAL:NO ${ldflags}" \
  645. "-DCMAKE_SHARED_LINKER_FLAGS=/INCREMENTAL:NO ${ldflags}" \
  646. "-DCMAKE_VS_GLOBALS=TrackFileAccess=false${vsglobals}" \
  647. '-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
  648. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
  649. -DCURL_WERROR=ON \
  650. -DBUILD_SHARED_LIBS=OFF \
  651. -DENABLE_DEBUG=ON \
  652. -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
  653. -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE= \
  654. ${{ matrix.config }}
  655. - name: 'configure log'
  656. if: ${{ !cancelled() }}
  657. run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
  658. - name: 'curl_config.h'
  659. run: |
  660. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  661. grep -F '#define' bld/lib/curl_config.h | sort || true
  662. - name: 'build'
  663. timeout-minutes: 5
  664. run: |
  665. PATH="/c/msys64/usr/bin:$PATH"
  666. cmake --build bld --config '${{ matrix.type }}' --parallel 5
  667. - name: 'curl version'
  668. timeout-minutes: 1
  669. run: |
  670. PATH=/usr/bin find . -name '*.exe' -o -name '*.dll'
  671. if [ '${{ matrix.plat }}' != 'uwp' ]; then # Missing: ucrtbased.dll, VCRUNTIME140D.dll, VCRUNTIME140D_APP.dll
  672. PATH="$PWD/bld/lib:$PATH"
  673. bld/src/curl.exe --disable --version
  674. fi
  675. - name: 'build tests'
  676. if: ${{ matrix.tflags != 'skipall' }}
  677. timeout-minutes: 10
  678. run: |
  679. PATH="/c/msys64/usr/bin:$PATH"
  680. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
  681. - name: 'install test prereqs'
  682. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  683. timeout-minutes: 5
  684. run: |
  685. # GnuTLS is not fully functional on Windows, so skip the tests
  686. # https://github.com/ShiftMediaProject/gnutls/issues/23
  687. if [[ '${{ matrix.name }}' != *'gnutls'* ]]; then
  688. /c/ProgramData/chocolatey/choco.exe install --yes --no-progress --limit-output --timeout 180 --force stunnel openssh || true
  689. fi
  690. curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 https://live.sysinternals.com/handle64.exe --output /bin/handle64.exe
  691. python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary impacket
  692. - name: 'run tests'
  693. if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
  694. timeout-minutes: 10
  695. run: |
  696. export TFLAGS='-j8 ~WebSockets ~SCP ~612 ${{ matrix.tflags }}'
  697. if [[ '${{ matrix.install }}' = *'libssh2[core,zlib]'* ]]; then
  698. TFLAGS+=' ~SFTP'
  699. elif [[ '${{ matrix.install }}' = *'libssh '* ]]; then
  700. TFLAGS+=' ~614' # 'SFTP pre-quote chmod' SFTP, pre-quote, directory
  701. fi
  702. PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin:/c/Program Files/OpenSSH-Win64"
  703. PATH="/c/msys64/usr/bin:$PATH"
  704. cmake --build bld --config '${{ matrix.type }}' --target test-ci
  705. - name: 'build examples'
  706. timeout-minutes: 5
  707. run: |
  708. PATH="/c/msys64/usr/bin:$PATH"
  709. cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples