macos.yml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  2. #
  3. # SPDX-License-Identifier: curl
  4. name: macOS
  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. # Deprecated Apple APIs and the macos-version-min value required to avoid
  34. # deprecation warnings with llvm/clang:
  35. #
  36. # - 10.7 Lion (2011) - GSS
  37. # - 10.8 Mountain Lion (2012) - CFURLCreateDataAndPropertiesFromResource (used by curl Secure Transport code)
  38. # - 10.9 Maverick (2013) - LDAP
  39. # - 10.14 Mojave (2018) - Secure Transport
  40. #
  41. # For Secure Transport, curl implements features that require a target
  42. # newer than the 10.8 required by `CFURLCreateDataAndPropertiesFromResource`.
  43. # In this case `-Wno-deprecated-declarations` still comes handy to pacify
  44. # deprecation warnings, though the real solution would be to avoid calling
  45. # that function.
  46. env:
  47. LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
  48. MAKEFLAGS: -j 4
  49. jobs:
  50. autotools:
  51. name: 'AM ${{ matrix.compiler }} ${{ matrix.name }}'
  52. runs-on: 'macos-latest'
  53. timeout-minutes: 60
  54. env:
  55. DEVELOPER_DIR: "/Applications/Xcode${{ matrix.xcode && format('_{0}', matrix.xcode) || '' }}.app/Contents/Developer"
  56. CC: ${{ matrix.compiler }}
  57. CFLAGS: '-mmacosx-version-min=${{ matrix.macos-version-min }}'
  58. strategy:
  59. fail-fast: false
  60. matrix:
  61. include:
  62. - name: '!ssl !debug brotli zstd'
  63. compiler: clang
  64. install: brotli zstd
  65. configure: --without-ssl --with-brotli --with-zstd
  66. macos-version-min: '10.9'
  67. - name: '!ssl !debug'
  68. compiler: gcc-12
  69. configure: --without-ssl
  70. macos-version-min: '10.9'
  71. - name: '!ssl'
  72. compiler: clang
  73. configure: --enable-debug --without-ssl
  74. macos-version-min: '10.9'
  75. - name: '!ssl libssh2 AppleIDN'
  76. compiler: clang
  77. configure: --enable-debug --with-libssh2=$(brew --prefix libssh2) --without-ssl --with-apple-idn
  78. macos-version-min: '10.9'
  79. - name: 'OpenSSL libssh c-ares'
  80. compiler: clang
  81. install: libssh
  82. configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl) --enable-ares
  83. macos-version-min: '10.9'
  84. - name: 'OpenSSL libssh'
  85. compiler: llvm@15
  86. install: libssh
  87. configure: --enable-debug --with-libssh --with-openssl=$(brew --prefix openssl)
  88. macos-version-min: '10.9'
  89. - name: '!ssl c-ares'
  90. compiler: clang
  91. configure: --enable-debug --enable-ares --without-ssl
  92. macos-version-min: '10.9'
  93. - name: '!ssl HTTP-only'
  94. compiler: clang
  95. configure: |
  96. --enable-debug \
  97. --disable-alt-svc --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap \
  98. --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp \
  99. --disable-shared --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets \
  100. --without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2 \
  101. --without-nghttp2 --without-ntlm-auth --without-ssl --without-zlib --without-zstd
  102. macos-version-min: '10.15' # Catalina (2019)
  103. - name: 'SecureTransport libssh2'
  104. compiler: clang
  105. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  106. macos-version-min: '10.8'
  107. - name: 'SecureTransport libssh2 10.12'
  108. compiler: clang
  109. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  110. macos-version-min: '10.12' # for monotonic timers
  111. cflags: '-Wno-deprecated-declarations'
  112. - name: 'SecureTransport libssh2'
  113. compiler: gcc-12
  114. configure: --enable-debug --with-secure-transport --with-libssh2=$(brew --prefix libssh2)
  115. macos-version-min: '10.8'
  116. - name: 'LibreSSL +examples'
  117. compiler: clang
  118. install: libressl
  119. configure: --enable-debug --with-openssl=$(brew --prefix libressl)
  120. macos-version-min: '10.9'
  121. - name: 'OpenSSL'
  122. compiler: clang
  123. configure: --enable-debug --with-openssl=$(brew --prefix openssl)
  124. macos-version-min: '10.9'
  125. - name: 'OpenSSL event-based'
  126. compiler: clang
  127. configure: --enable-debug --with-openssl=$(brew --prefix openssl)
  128. macos-version-min: '10.9'
  129. tflags: -e
  130. - name: 'OpenSSL libssh2 !ldap 10.15'
  131. compiler: clang
  132. configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl)
  133. macos-version-min: '10.15'
  134. steps:
  135. - name: 'brew install'
  136. # Run this command with retries because of spurious failures seen
  137. # while running the tests, for example
  138. # https://github.com/curl/curl/runs/4095721123?check_suite_focus=true
  139. run: |
  140. echo automake libtool pkg-config libpsl libssh2 nghttp2 stunnel ${{ matrix.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
  141. while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
  142. - name: 'brew unlink openssl'
  143. run: |
  144. if test -d $(brew --prefix)/include/openssl; then
  145. brew unlink openssl
  146. fi
  147. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4
  148. - name: 'toolchain versions'
  149. run: |
  150. [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  151. [[ '${{ matrix.compiler }}' = 'gcc'* ]] && \
  152. grep -h -r -E -o '.+[0-9.]+\.sdk/' "$(dirname "$("${CC}" -print-libgcc-file-name)")/include-fixed" | sed -E 's/^\t+//g' | tr -d '"' | sort -u || true
  153. which "${CC}"; "${CC}" --version || true
  154. xcodebuild -version || true
  155. xcrun --sdk macosx --show-sdk-path 2>/dev/null || true
  156. xcrun --sdk macosx --show-sdk-version || true
  157. echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
  158. echo '::group::brew packages installed'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
  159. - name: 'autoreconf'
  160. run: autoreconf -fi
  161. - name: 'configure'
  162. run: |
  163. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  164. CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  165. CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  166. CC+=" --target=$(uname -m)-apple-darwin"
  167. options+=" --target=$(uname -m)-apple-darwin"
  168. fi
  169. CFLAGS+=' ${{ matrix.cflags }}'
  170. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  171. libgccdir="$(dirname "$("${CC}" -print-libgcc-file-name)")"
  172. echo '::group::gcc include-fixed details'; find "${libgccdir}/include-fixed" | sort; echo '::endgroup::'
  173. for f in dispatch os AvailabilityInternal.h stdio.h; do
  174. if [ -r "${libgccdir}/include-fixed/${f}" ]; then
  175. echo "Zap gcc hack: '${libgccdir}/include-fixed/${f}'"
  176. mv "${libgccdir}/include-fixed/${f}" "${libgccdir}/include-fixed/${f}-BAK"
  177. fi
  178. done
  179. fi
  180. if [ '${{ matrix.compiler }}' != 'clang' ]; then
  181. options+=" --with-sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  182. CFLAGS+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  183. fi
  184. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  185. --disable-dependency-tracking \
  186. --with-libpsl=$(brew --prefix libpsl) \
  187. ${{ matrix.configure }} ${options}
  188. - name: 'configure log'
  189. if: ${{ !cancelled() }}
  190. run: cat bld/config.log || true
  191. - name: 'curl_config.h'
  192. run: |
  193. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  194. cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  195. - name: 'build-cert'
  196. if: contains(matrix.configure, '--with-secure-transport')
  197. run: |
  198. make -C bld/tests/certs clean-certs
  199. make -C bld/tests/certs build-certs -j1
  200. - name: 'make'
  201. run: make -C bld V=1
  202. - name: 'curl version'
  203. run: bld/src/curl --disable --version
  204. - name: 'make tests'
  205. run: make -C bld V=1 -C tests
  206. - name: 'pip3 install'
  207. run: |
  208. python3 -m venv $HOME/venv
  209. source $HOME/venv/bin/activate
  210. python3 -m pip install impacket
  211. - name: 'run tests'
  212. timeout-minutes: 20
  213. run: |
  214. export TFLAGS='-j20 ${{ matrix.tflags }}'
  215. TFLAGS+=' ~2037 ~2041' # flaky
  216. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  217. TFLAGS+=' ~RTSP' # 567 568 569 570 571 572 577 689 3100
  218. TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length
  219. if [[ '${{ matrix.configure }}' = *'--with-secure-transport'* ]]; then
  220. TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059
  221. TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, Secure Transport + nghttp2
  222. else
  223. TFLAGS+=' ~2402 ~2404' # non-Secure Transport + nghttp2
  224. fi
  225. fi
  226. if [[ '${{ matrix.configure }}' = *'--with-secure-transport'* ]]; then
  227. TFLAGS+=' ~313' # Secure Transport does not support crl file
  228. TFLAGS+=' ~1631 ~1632' # Secure Transport is not able to shutdown ftp over https gracefully yet
  229. fi
  230. source $HOME/venv/bin/activate
  231. rm -f $HOME/.curlrc
  232. make -C bld V=1 test-ci
  233. - name: 'make examples'
  234. if: ${{ contains(matrix.build.name, '+examples') }}
  235. run: make -C bld V=1 examples
  236. cmake:
  237. name: 'CM ${{ matrix.compiler }} ${{ matrix.build.name }}'
  238. runs-on: 'macos-latest'
  239. timeout-minutes: 30
  240. env:
  241. DEVELOPER_DIR: "/Applications/Xcode${{ matrix.xcode && format('_{0}', matrix.xcode) || '' }}.app/Contents/Developer"
  242. CC: ${{ matrix.compiler }}
  243. strategy:
  244. fail-fast: false
  245. matrix:
  246. compiler: [clang, llvm@15, gcc-12]
  247. build:
  248. - name: 'OpenSSL ws gsasl AppleIDN'
  249. install: gsasl
  250. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_USE_GSASL=ON -DUSE_APPLE_IDN=ON
  251. macos-version-min: '10.9'
  252. - name: 'OpenSSL +static libssh'
  253. install: libssh
  254. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DBUILD_STATIC_LIBS=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
  255. macos-version-min: '10.9'
  256. - name: 'SecureTransport ws debug'
  257. generate: -DCURL_USE_SECTRANSP=ON -DENABLE_DEBUG=ON
  258. macos-version-min: '10.8'
  259. - name: 'LibreSSL !ldap heimdal c-ares +examples'
  260. install: libressl heimdal
  261. generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON
  262. macos-version-min: '10.15'
  263. - name: 'wolfSSL !ldap brotli zstd'
  264. install: brotli wolfssl zstd
  265. generate: -DCURL_USE_WOLFSSL=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_DISABLE_LDAP=ON
  266. macos-version-min: '10.15'
  267. - name: 'GnuTLS !ldap krb5'
  268. install: gnutls nettle krb5
  269. generate: -DCURL_USE_GNUTLS=ON -DCURL_USE_OPENSSL=OFF -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix krb5) -DCURL_DISABLE_LDAP=ON
  270. macos-version-min: '10.15'
  271. - name: 'OpenSSL torture !FTP'
  272. generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
  273. tflags: -t --shallow=25 !FTP
  274. macos-version-min: '10.9'
  275. torture: true
  276. - name: 'OpenSSL torture FTP'
  277. generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
  278. tflags: -t --shallow=20 FTP
  279. macos-version-min: '10.9'
  280. torture: true
  281. exclude:
  282. - { compiler: llvm@15, build: { macos-version-min: '10.15' } }
  283. - { compiler: llvm@15, build: { macos-version-min: '10.9' } }
  284. - { compiler: gcc-12, build: { torture: true } }
  285. steps:
  286. - name: 'brew install'
  287. run: |
  288. echo ninja pkg-config libpsl libssh2 nghttp2 stunnel ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
  289. while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
  290. - name: 'brew unlink openssl'
  291. run: |
  292. if test -d $(brew --prefix)/include/openssl; then
  293. brew unlink openssl
  294. fi
  295. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4
  296. - name: 'toolchain versions'
  297. run: |
  298. [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  299. [[ '${{ matrix.compiler }}' = 'gcc'* ]] && \
  300. grep -h -r -E -o '.+[0-9.]+\.sdk/' "$(dirname "$("${CC}" -print-libgcc-file-name)")/include-fixed" | sed -E 's/^\t+//g' | tr -d '"' | sort -u || true
  301. which "${CC}"; "${CC}" --version || true
  302. xcodebuild -version || true
  303. xcrun --sdk macosx --show-sdk-path 2>/dev/null || true
  304. xcrun --sdk macosx --show-sdk-version || true
  305. echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
  306. echo '::group::brew packages installed'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
  307. - name: 'cmake configure'
  308. run: |
  309. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  310. CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  311. CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  312. CC+=" --target=$(uname -m)-apple-darwin"
  313. fi
  314. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  315. libgccdir="$(dirname "$("${CC}" -print-libgcc-file-name)")"
  316. echo '::group::gcc include-fixed details'; find "${libgccdir}/include-fixed" | sort; echo '::endgroup::'
  317. for f in dispatch os AvailabilityInternal.h stdio.h; do
  318. if [ -r "${libgccdir}/include-fixed/${f}" ]; then
  319. echo "Zap gcc hack: '${libgccdir}/include-fixed/${f}'"
  320. mv "${libgccdir}/include-fixed/${f}" "${libgccdir}/include-fixed/${f}-BAK"
  321. fi
  322. done
  323. fi
  324. cmake -B bld -G Ninja -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
  325. -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.build.macos-version-min }} \
  326. "-DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" \
  327. "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
  328. ${{ matrix.build.generate }}
  329. - name: 'configure log'
  330. if: ${{ !cancelled() }}
  331. run: cat bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
  332. - name: 'curl_config.h'
  333. run: |
  334. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  335. cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  336. - name: 'build-cert'
  337. if: contains(matrix.build.generate, '-DCURL_USE_SECTRANSP=ON')
  338. run: |
  339. ninja -C bld clean-certs
  340. ninja -C bld build-certs -j 1
  341. - name: 'cmake build'
  342. run: ninja -C bld --verbose
  343. - name: 'curl version'
  344. run: bld/src/curl --disable --version
  345. - name: 'cmake build tests'
  346. run: ninja -C bld testdeps
  347. - name: 'pip3 install'
  348. run: |
  349. python3 -m venv $HOME/venv
  350. source $HOME/venv/bin/activate
  351. python3 -m pip install impacket
  352. - name: 'cmake run tests'
  353. timeout-minutes: ${{ matrix.build.torture && 20 || 10 }}
  354. run: |
  355. export TFLAGS='-j20 ${{ matrix.build.tflags }}'
  356. if [ -z '${{ matrix.build.torture }}' ]; then
  357. TFLAGS+=' ~2037 ~2041' # flaky
  358. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  359. TFLAGS+=' ~RTSP' # 567 568 569 570 571 572 577 689 3100
  360. TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length
  361. if [[ '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then
  362. TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059
  363. TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, Secure Transport + nghttp2
  364. else
  365. TFLAGS+=' ~2402 ~2404' # non-Secure Transport + nghttp2
  366. fi
  367. fi
  368. if [[ '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then
  369. TFLAGS+=' ~313' # Secure Transport does not support crl file
  370. TFLAGS+=' ~1631 ~1632' # Secure Transport is not able to shutdown ftp over https gracefully yet
  371. fi
  372. fi
  373. source $HOME/venv/bin/activate
  374. rm -f $HOME/.curlrc
  375. ninja -C bld test-ci
  376. - name: 'cmake build examples'
  377. if: ${{ contains(matrix.name, '+examples') }}
  378. run: make -C bld VERBOSE=1
  379. combinations: # Test buildability with host OS, Xcode / SDK, compiler, target-OS, Secure Transport/not, built tool, combinations
  380. if: true # Set to `true` to enable this test matrix. It runs quickly.
  381. name: "${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} ${{ matrix.image }} ${{ matrix.xcode }} ${{ matrix.config }}"
  382. runs-on: ${{ matrix.image }}
  383. timeout-minutes: 10
  384. env:
  385. DEVELOPER_DIR: "/Applications/Xcode${{ matrix.xcode && format('_{0}', matrix.xcode) || '' }}.app/Contents/Developer"
  386. CC: ${{ matrix.compiler }}
  387. strategy:
  388. fail-fast: false
  389. matrix:
  390. config: [SecureTransport] # also: OpenSSL
  391. compiler: [gcc-12, gcc-13, gcc-14, llvm@15, llvm@18, clang]
  392. # Xcode support matrix as of 2024-07, with default macOS SDK versions and OS names, years:
  393. # * = default Xcode on the runner.
  394. # macos-13: 14.1, 14.2, 14.3.1, 15.0.1, 15.1,*15.2
  395. # macos-14: 15.0.1, 15.1, 15.2, 15.3,*15.4
  396. # macos-15: *16.0, 16.1
  397. # macOSSDK: 13.0, 13.1, 13.3, 14.0, 14.2, 14.2, 14.4, 14.5, 15.0, 15.1
  398. # Ventura (2022) Sonoma (2023) Sequoia (2024)
  399. # https://github.com/actions/runner-images/tree/main/images/macos
  400. # https://en.wikipedia.org/wiki/MacOS_version_history
  401. image: [macos-13, macos-14, macos-15]
  402. # Can skip these to reduce jobs:
  403. # 15.1 has the same default macOS SDK as 15.2 and identical test result.
  404. # 14.1, 15.4 not revealing new fallouts.
  405. #xcode: ['14.1', '14.2', '14.3.1', '15.0.1', '15.1', '15.2', '15.3', '15.4', '16.0', '16.1'] # all Xcode
  406. #xcode: ['14.1', '14.2', '14.3.1', '15.0.1' , '15.2', '15.3', '15.4', '16.0', '16.1'] # all SDK
  407. #xcode: [ '14.2', '14.3.1', '15.0.1' , '15.2', '15.3' , '16.0' ] # coverage
  408. xcode: [''] # default Xcodes
  409. macos-version-min: ['10.8']
  410. build: [autotools, cmake]
  411. exclude:
  412. # Combinations uncovered by runner images:
  413. - { image: macos-13, xcode: '15.3' }
  414. - { image: macos-13, xcode: '15.4' }
  415. - { image: macos-13, xcode: '16.0' }
  416. - { image: macos-13, xcode: '16.1' }
  417. - { image: macos-14, xcode: '14.1' }
  418. - { image: macos-14, xcode: '14.2' }
  419. - { image: macos-14, xcode: '14.3.1' }
  420. - { image: macos-14, xcode: '16.0' }
  421. - { image: macos-14, xcode: '16.1' }
  422. - { image: macos-15, xcode: '14.1' }
  423. - { image: macos-15, xcode: '14.2' }
  424. - { image: macos-15, xcode: '14.3.1' }
  425. - { image: macos-15, xcode: '15.0.1' }
  426. - { image: macos-15, xcode: '15.1' }
  427. - { image: macos-15, xcode: '15.2' }
  428. - { image: macos-15, xcode: '15.3' }
  429. - { image: macos-15, xcode: '15.4' }
  430. - { image: macos-13, compiler: 'llvm@18' }
  431. - { image: macos-14, compiler: 'llvm@18' }
  432. - { image: macos-15, compiler: 'llvm@15' }
  433. # Reduce build combinations, by dropping less interesting ones
  434. - { compiler: gcc-12, config: SecureTransport }
  435. - { compiler: gcc-13, build: cmake }
  436. - { compiler: gcc-13, image: macos-13 }
  437. - { compiler: gcc-14, config: SecureTransport }
  438. steps:
  439. - name: 'install autotools'
  440. if: ${{ matrix.build == 'autotools' }}
  441. run: |
  442. echo automake libtool | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
  443. while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
  444. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4
  445. - name: 'toolchain versions'
  446. run: |
  447. [[ '${{ matrix.compiler }}' = 'llvm'* ]] && CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  448. [[ '${{ matrix.compiler }}' = 'gcc'* ]] && \
  449. grep -h -r -E -o '.+[0-9.]+\.sdk/' "$(dirname "$("${CC}" -print-libgcc-file-name)")/include-fixed" | sed -E 's/^\t+//g' | tr -d '"' | sort -u || true
  450. which "${CC}"; "${CC}" --version || true
  451. xcodebuild -version || true
  452. xcrun --sdk macosx --show-sdk-path 2>/dev/null || true
  453. xcrun --sdk macosx --show-sdk-version || true
  454. echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
  455. echo '::group::brew packages preinstalled'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
  456. - name: 'autoreconf'
  457. if: ${{ matrix.build == 'autotools' }}
  458. run: autoreconf -fi
  459. - name: 'configure / ${{ matrix.build }}'
  460. run: |
  461. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  462. CC="$(brew --prefix ${{ matrix.compiler }})/bin/clang"
  463. CC+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  464. CC+=" --target=$(uname -m)-apple-darwin"
  465. fi
  466. # gcc ships with an `include-fixed` header set, which overrides SDK
  467. # headers with the intent of making them compatible with gcc. The
  468. # source for these headers is:
  469. # https://github.com/gcc-mirror/gcc/tree/master/fixincludes
  470. # with extra Apple-specific patches applied from here for Homebrew:
  471. # https://github.com/iains/gcc-12-branch
  472. #
  473. # They pass through a generator phase at build-time which seems to
  474. # pick the SDK installed on the build machine (maintained by the
  475. # Homebrew project in our case) and patches it according to a set
  476. # of rules in `inclhack.def`.
  477. #
  478. # Homebrew builds and ships different binaries for different macOS
  479. # versions and CPUs, built on machines using the same OS version as
  480. # the target one. Each of these machines have a particular version
  481. # of Apple CommandLineTools with a default SDK version installed with
  482. # them.
  483. #
  484. # Then this binary gets installed onto the end-user machine,
  485. # matching the OS version at the time of installation.
  486. #
  487. # The problem with this approach is that the SDK version picked up
  488. # at gcc build-time has a high chance of being or becoming out of
  489. # sync with actual SDK installed on the end-user machine. This
  490. # can happen after upgrading the OS, Xcode, selecting an SDK version
  491. # manually, or other reasons.
  492. #
  493. # When the SDK versions do not match, the gcc hacks, instead of
  494. # improving compatibility the SDK, are actively _breaking_
  495. # compatibility, in an unexpected, hard to diagnose way.
  496. #
  497. # The SDK version used for gcc-hacks is not advertised. We can
  498. # extract the major SDK version from the generated gcc-hack header
  499. # files, assuming someone knows what to look for and where.
  500. #
  501. # Basically it also means that the same `gcc-N` Homebrew package
  502. # behaves differently depending on the OS it was built on. Causing
  503. # an explosion of build combination. It may also mean that a minor
  504. # gcc version bump is built against a different SDK version, and due
  505. # to the extra patch for the hack applied by Homebrew, there may
  506. # be extra changes as well.
  507. #
  508. # For GHA runners, it means that the default Xcode + OS combo have
  509. # and SDK mismatch in 8 out of 12 combinations (66%). All fail to
  510. # build, plus one more with matching SDK. This is 9 in total (75%)
  511. # that fail to build out of the box. These are the 3 lucky default
  512. # combinations that worked to build curl:
  513. # macos-14 + Xcode 15.0.1 + gcc-12, gcc-14
  514. #
  515. # Of all possible valid GHA runner, gcc, manually selected Xcode
  516. # combinations, 40% are broken.
  517. #
  518. # Compared to mainline llvm: llvm ships the same binaries regardless
  519. # of build-OS or environment, it contains no SDK-version-specific
  520. # hacks, and has no 3rd party patches. This still leaves some
  521. # occasional issues, but works much closer to expectations.
  522. #
  523. # Some of these hacks are helpful, in particular for fixing this
  524. # issue via math.h:
  525. # /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:53:5: error: #error "Unsupported value of
  526. # 53 | # error "Unsupported value of __FLT_EVAL_METHOD__."
  527. #
  528. # Errors seen in available CI combinations:
  529. # error: two or more data types in declaration specifiers # fatal error: AvailabilityInternalLegacy.h: No such file or directory
  530. # gcc-13 + macos-14 + Xcode 14.3.1
  531. # error: two or more data types in declaration specifiers
  532. # gcc-13 + macos-12 + Xcode 14.1, 14.2
  533. # gcc-13 + Xcode 15.0.1, 15.1, 5.2
  534. # error: expected ';' before 'extern'
  535. # gcc-12, gcc-14 + macos-12 + Xcode 14.1, 14.2
  536. # error: unknown type name 'dispatch_queue_t'
  537. # gcc-12 + macos-13 + Xcode 15.0.1, 15.1, 15.2
  538. # error: type defaults to 'int' in declaration of 'DISPATCH_DECL_FACTORY_CLASS_SWIFT' [-Wimplicit-int]
  539. # gcc-14 macos-13 Xcode 15.0.1, 15.1, 15.2
  540. # error: unknown type name 'FILE'
  541. # Xcode 16.0
  542. #
  543. # Unbreak Homebrew gcc builds by moving problematic SDK header overlay
  544. # directories/files out of the way:
  545. if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then
  546. # E.g.:
  547. # $(brew --prefix)/Cellar/gcc@11/11.4.0/lib/gcc/11/gcc/aarch64-apple-darwin23/11/include-fixed
  548. # $(brew --prefix)/Cellar/gcc@11/11.4.0/lib/gcc/11/gcc/x86_64-apple-darwin21/11/include-fixed
  549. # $(brew --prefix)/Cellar/gcc/14.1.0_1/lib/gcc/14/gcc/x86_64-apple-darwin21/14/include-fixed
  550. libgccdir="$(dirname "$("${CC}" -print-libgcc-file-name)")"
  551. echo '::group::gcc include-fixed details'; find "${libgccdir}/include-fixed" | sort; echo '::endgroup::'
  552. patch_out='dispatch os AvailabilityInternal.h'
  553. patch_out+=' stdio.h' # for Xcode 16 error: unknown type name 'FILE'
  554. for f in ${patch_out}; do
  555. if [ -r "${libgccdir}/include-fixed/${f}" ]; then
  556. echo "Zap gcc hack: '${libgccdir}/include-fixed/${f}'"
  557. mv "${libgccdir}/include-fixed/${f}" "${libgccdir}/include-fixed/${f}-BAK"
  558. fi
  559. done
  560. fi
  561. if [ '${{ matrix.build }}' = 'autotools' ]; then
  562. export CFLAGS
  563. if [[ '${{ matrix.compiler }}' = 'llvm'* ]]; then
  564. options+=" --target=$(uname -m)-apple-darwin"
  565. fi
  566. if [ '${{ matrix.compiler }}' != 'clang' ]; then
  567. options+=" --with-sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  568. CFLAGS+=" --sysroot=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)"
  569. fi
  570. [ '${{ matrix.config }}' = 'OpenSSL' ] && options+=" --with-openssl=$(brew --prefix openssl)"
  571. [ '${{ matrix.config }}' = 'SecureTransport' ] && options+=' --with-secure-transport'
  572. CFLAGS+=' -mmacosx-version-min=${{ matrix.macos-version-min }}'
  573. # would pick up nghttp2, libidn2, but libssh2 is disabled by default
  574. mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
  575. --disable-dependency-tracking \
  576. --disable-docs --disable-manual \
  577. --without-nghttp2 --without-libidn2 \
  578. --without-libpsl \
  579. ${options}
  580. else
  581. [ '${{ matrix.config }}' = 'OpenSSL' ] && options+=' -DCURL_USE_OPENSSL=ON'
  582. [ '${{ matrix.config }}' = 'SecureTransport' ] && options+=' -DCURL_USE_SECTRANSP=ON'
  583. # would pick up nghttp2, libidn2, and libssh2
  584. cmake -B bld -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
  585. -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.macos-version-min }} \
  586. "-DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path 2>/dev/null)" \
  587. "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
  588. "-DCMAKE_IGNORE_PREFIX_PATH=$(brew --prefix)" \
  589. -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF \
  590. -DUSE_NGHTTP2=OFF -DUSE_LIBIDN2=OFF \
  591. -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF \
  592. ${options}
  593. fi
  594. - name: 'configure log'
  595. if: ${{ !cancelled() }}
  596. run: cat bld/config.log bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
  597. - name: 'curl_config.h'
  598. run: |
  599. echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
  600. cat bld/lib/curl_config.h | grep -F '#define' | sort || true
  601. - name: 'build / ${{ matrix.build }}'
  602. run: make -C bld V=1 VERBOSE=1
  603. - name: 'curl version'
  604. run: bld/src/curl --disable --version