linux.yml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  2. #
  3. # SPDX-License-Identifier: curl
  4. name: Linux
  5. on:
  6. push:
  7. branches:
  8. - master
  9. - '*/ci'
  10. paths-ignore:
  11. - '**/*.md'
  12. - '.azure-pipelines.yml'
  13. - '.circleci/**'
  14. - '.cirrus.yml'
  15. - 'appveyor.*'
  16. - 'packages/**'
  17. - 'plan9/**'
  18. - 'projects/**'
  19. - 'winbuild/**'
  20. pull_request:
  21. branches:
  22. - master
  23. paths-ignore:
  24. - '**/*.md'
  25. - '.azure-pipelines.yml'
  26. - '.circleci/**'
  27. - '.cirrus.yml'
  28. - 'appveyor.*'
  29. - 'packages/**'
  30. - 'plan9/**'
  31. - 'projects/**'
  32. - 'winbuild/**'
  33. concurrency:
  34. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  35. cancel-in-progress: true
  36. permissions: {}
  37. env:
  38. MAKEFLAGS: -j 3
  39. # unhandled
  40. bearssl-version: 0.6
  41. # renovate: datasource=github-tags depName=libressl-portable/portable versioning=semver registryUrl=https://github.com
  42. libressl-version: 3.9.2
  43. # renovate: datasource=github-tags depName=ARMmbed/mbedtls versioning=semver registryUrl=https://github.com
  44. mbedtls-version: 3.5.0
  45. # renovate: datasource=github-tags depName=icing/mod_h2 versioning=semver registryUrl=https://github.com
  46. mod_h2-version: 2.0.27
  47. # renovate: datasource=github-tags depName=nibanks/msh3 versioning=semver registryUrl=https://github.com
  48. msh3-version: 0.6.0
  49. # handled in renovate.json
  50. openssl3-version: openssl-3.1.3
  51. # unhandled
  52. quictls-version: 3.1.4+quic
  53. # renovate: datasource=github-tags depName=rustls/rustls-ffi versioning=semver registryUrl=https://github.com
  54. rustls-version: 0.13.0
  55. jobs:
  56. autotools:
  57. name: ${{ matrix.build.name }}
  58. runs-on: 'ubuntu-latest'
  59. container: ${{ matrix.build.container }}
  60. timeout-minutes: 90
  61. strategy:
  62. fail-fast: false
  63. matrix:
  64. build:
  65. - name: bearssl
  66. install_packages: zlib1g-dev valgrind
  67. install_steps: bearssl pytest
  68. configure: LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
  69. singleuse: --unit
  70. - name: bearssl-clang
  71. install_packages: zlib1g-dev clang
  72. install_steps: bearssl
  73. configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
  74. singleuse: --unit
  75. - name: libressl
  76. install_packages: zlib1g-dev valgrind
  77. install_steps: libressl pytest
  78. configure: LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --enable-debug
  79. singleuse: --unit
  80. - name: libressl-clang
  81. install_packages: zlib1g-dev clang
  82. install_steps: libressl
  83. configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --enable-debug
  84. singleuse: --unit
  85. - name: mbedtls
  86. install_packages: libnghttp2-dev valgrind
  87. install_steps: mbedtls pytest
  88. configure: LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
  89. singleuse: --unit
  90. - name: mbedtls-clang
  91. install_packages: libnghttp2-dev clang
  92. install_steps: mbedtls
  93. configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
  94. singleuse: --unit
  95. - name: msh3
  96. install_packages: zlib1g-dev valgrind
  97. install_steps: quictls msh3
  98. configure: LDFLAGS="-Wl,-rpath,$HOME/msh3/lib -Wl,-rpath,$HOME/quictls/lib" --with-msh3=$HOME/msh3 --with-openssl=$HOME/quictls --enable-debug
  99. singleuse: --unit
  100. - name: openssl3
  101. install_packages: zlib1g-dev valgrind
  102. install_steps: gcc-11 openssl3 pytest
  103. configure: CFLAGS=-std=gnu89 LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
  104. singleuse: --unit
  105. - name: openssl3-O3
  106. install_packages: zlib1g-dev valgrind
  107. install_steps: gcc-11 openssl3
  108. configure: CPPFLAGS=-DCURL_WARN_SIGN_CONVERSION CFLAGS=-O3 LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
  109. singleuse: --unit
  110. - name: openssl3-clang
  111. install_packages: zlib1g-dev clang
  112. install_steps: openssl3
  113. configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
  114. singleuse: --unit
  115. - name: address-sanitizer
  116. install_packages: zlib1g-dev libssh2-1-dev clang libssl-dev libubsan1 libasan8 libtsan2
  117. install_steps: pytest
  118. configure: >
  119. CC=clang
  120. CFLAGS="-fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g"
  121. LDFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer"
  122. LIBS="-ldl -lubsan"
  123. --with-openssl --enable-debug --enable-websockets
  124. singleuse: --unit
  125. - name: memory-sanitizer
  126. install_packages: clang
  127. install_steps:
  128. configure: >
  129. CC=clang
  130. CFLAGS="-fsanitize=memory -Wformat -Werror=format-security -Werror=array-bounds -g"
  131. LDFLAGS="-fsanitize=memory"
  132. LIBS="-ldl"
  133. --without-ssl --without-zlib --without-brotli --without-zstd --without-libpsl --without-nghttp2 --enable-debug --enable-websockets
  134. singleuse: --unit
  135. - name: event-based
  136. install_packages: libssh-dev valgrind
  137. configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
  138. tflags: -n -e '!TLS-SRP'
  139. singleuse: --unit
  140. - name: hyper
  141. install_steps: rust hyper valgrind
  142. configure: LDFLAGS="-Wl,-rpath,$HOME/hyper/target/debug" --with-openssl --with-hyper=$HOME/hyper --enable-debug --enable-websockets
  143. singleuse: --unit
  144. - name: rustls
  145. install_steps: rust rustls pytest valgrind libpsl-dev
  146. configure: --with-rustls=$HOME/rustls --enable-debug
  147. singleuse: --unit
  148. - name: Intel compiler - without SSL
  149. install_packages: zlib1g-dev valgrind
  150. install_steps: intel
  151. configure: CC=icc --enable-debug --without-ssl
  152. singleuse: --unit
  153. - name: Intel compiler - OpenSSL
  154. install_packages: zlib1g-dev libssl-dev valgrind
  155. install_steps: intel
  156. configure: CC=icc --enable-debug --with-openssl
  157. singleuse: --unit
  158. - name: Slackware-openssl-with-gssapi-gcc
  159. # These are essentially the same flags used to build the curl Slackware package
  160. # https://ftpmirror.infania.net/slackware/slackware64-current/source/n/curl/curl.SlackBuild
  161. configure: --with-openssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs
  162. # Docker Hub image that `container-job` executes in
  163. container: 'andy5995/slackware-build-essential:15.0'
  164. - name: Alpine MUSL
  165. configure: --enable-debug --enable-websockets --with-ssl --with-libssh2 --with-libidn2 --with-gssapi --enable-ldap --with-libpsl
  166. container: 'alpine:3.18'
  167. singleuse: --unit
  168. steps:
  169. - if: matrix.build.container == null
  170. run: |
  171. sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
  172. sudo apt-get update
  173. sudo apt-get install libtool autoconf automake pkg-config stunnel4 libpsl-dev libbrotli-dev libzstd-dev ${{ matrix.build.install_packages }}
  174. sudo python3 -m pip install impacket
  175. name: 'install prereqs and impacket'
  176. - if: startsWith(matrix.build.container, 'alpine')
  177. run: |
  178. apk add --no-cache build-base autoconf automake libtool perl openssl-dev libssh2-dev zlib-dev brotli-dev zstd-dev libidn2-dev openldap-dev heimdal-dev libpsl-dev py3-impacket py3-asn1 py3-six py3-pycryptodomex perl-time-hires openssh stunnel sudo git
  179. name: 'install dependencies'
  180. - uses: actions/checkout@v4
  181. - name: Fix kernel mmap rnd bits
  182. # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
  183. # high-entropy ASLR in much newer kernels that GitHub runners are
  184. # using leading to random crashes: https://reviews.llvm.org/D148280
  185. # See https://github.com/actions/runner-images/issues/9491
  186. continue-on-error: true
  187. run: sudo sysctl vm.mmap_rnd_bits=28
  188. - if: contains(matrix.build.install_steps, 'gcc-11')
  189. run: |
  190. sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
  191. sudo apt-get update
  192. sudo apt-get install gcc-11
  193. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
  194. sudo update-alternatives --set gcc /usr/bin/gcc-11
  195. gcc --version
  196. name: 'install gcc-11'
  197. - name: cache bearssl
  198. if: contains(matrix.build.install_steps, 'bearssl')
  199. uses: actions/cache@v4
  200. id: cache-bearssl
  201. env:
  202. cache-name: cache-bearssl
  203. with:
  204. path: /home/runner/bearssl
  205. key: ${{ runner.os }}-build-${{ env.cache-name }}-bearssl-${{ env.bearssl-version }}
  206. - name: 'build bearssl'
  207. if: contains(matrix.build.install_steps, 'bearssl') && steps.cache-bearssl.outputs.cache-hit != 'true'
  208. run: |
  209. curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://bearssl.org/bearssl-${{ env.bearssl-version }}.tar.gz
  210. tar -xzf bearssl-${{ env.bearssl-version }}.tar.gz
  211. cd bearssl-${{ env.bearssl-version }}
  212. make
  213. mkdir -p $HOME/bearssl/lib $HOME/bearssl/include
  214. cp inc/*.h $HOME/bearssl/include
  215. cp build/libbearssl.* $HOME/bearssl/lib
  216. - name: cache libressl
  217. if: contains(matrix.build.install_steps, 'libressl')
  218. uses: actions/cache@v4
  219. id: cache-libressl
  220. env:
  221. cache-name: cache-libressl
  222. with:
  223. path: /home/runner/libressl
  224. key: ${{ runner.os }}-build-${{ env.cache-name }}-libressl-${{ env.libressl-version }}
  225. - name: 'build libressl'
  226. if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
  227. run: |
  228. git clone --quiet --depth=1 -b v${{ env.libressl-version }} https://github.com/libressl-portable/portable.git libressl-git
  229. cd libressl-git
  230. ./autogen.sh
  231. ./configure --prefix=$HOME/libressl
  232. make install
  233. - name: cache mbedtls
  234. if: contains(matrix.build.install_steps, 'mbedtls')
  235. uses: actions/cache@v4
  236. id: cache-mbedtls
  237. env:
  238. cache-name: cache-mbedtls
  239. with:
  240. path: /home/runner/mbedtls
  241. key: ${{ runner.os }}-build-${{ env.cache-name }}-mbedtls-${{ env.mbedtls-version }}
  242. - name: 'build mbedtls'
  243. if: contains(matrix.build.install_steps, 'mbedtls') && steps.cache-mbedtls.outputs.cache-hit != 'true'
  244. run: |
  245. git clone --quiet --depth=1 -b v${{ env.mbedtls-version }} https://github.com/ARMmbed/mbedtls
  246. cd mbedtls
  247. git submodule update --init
  248. make DESTDIR=$HOME/mbedtls install
  249. - name: cache openssl3
  250. if: contains(matrix.build.install_steps, 'openssl3')
  251. uses: actions/cache@v4
  252. id: cache-openssl3
  253. env:
  254. cache-name: cache-openssl3
  255. with:
  256. path: /home/runner/openssl3
  257. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl3-version }}
  258. - name: 'install openssl3'
  259. if: contains(matrix.build.install_steps, 'openssl3') && steps.cache-openssl3.outputs.cache-hit != 'true'
  260. run: |
  261. git clone --quiet --depth=1 -b ${{ env.openssl3-version }} https://github.com/openssl/openssl
  262. cd openssl
  263. ./config --prefix=$HOME/openssl3 --libdir=$HOME/openssl3/lib
  264. make -j1 install_sw
  265. - name: cache quictls
  266. if: contains(matrix.build.install_steps, 'quictls')
  267. uses: actions/cache@v4
  268. id: cache-quictls
  269. env:
  270. cache-name: cache-quictls
  271. with:
  272. path: /home/runner/quictls
  273. key: ${{ runner.os }}-build-${{ env.cache-name }}-quictls-${{ env.quictls-version }}
  274. - name: 'build quictls'
  275. if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
  276. run: |
  277. git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }} https://github.com/quictls/openssl
  278. cd openssl
  279. ./config --prefix=$HOME/quictls --libdir=$HOME/quictls/lib
  280. make -j1 install_sw
  281. - name: cache msh3
  282. if: contains(matrix.build.install_steps, 'msh3')
  283. uses: actions/cache@v4
  284. id: cache-msh3
  285. env:
  286. cache-name: cache-msh3
  287. with:
  288. path: /home/runner/msh3
  289. key: ${{ runner.os }}-build-${{ env.cache-name }}-msh3-${{ env.msh3-version }}
  290. - name: 'build msh3'
  291. if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
  292. run: |
  293. git clone --quiet -b v${{ env.msh3-version }} --depth=1 --recursive https://github.com/nibanks/msh3
  294. cd msh3 && mkdir build && cd build
  295. cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3 ..
  296. cmake --build .
  297. cmake --install .
  298. - if: contains(matrix.build.install_steps, 'rust')
  299. run: |
  300. cd $HOME
  301. curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
  302. source $HOME/.cargo/env
  303. rustup toolchain install nightly
  304. name: 'install rust'
  305. - name: cache rustls
  306. if: contains(matrix.build.install_steps, 'rustls')
  307. uses: actions/cache@v4
  308. id: cache-rustls
  309. env:
  310. cache-name: cache-rustls
  311. with:
  312. path: /home/runner/rustls
  313. key: ${{ runner.os }}-build-${{ env.cache-name }}-rustls-${{ env.rustls-version }}
  314. - name: 'build rustls'
  315. if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
  316. run: |
  317. git clone --quiet --depth=1 -b v${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
  318. cd rustls-ffi
  319. make DESTDIR=$HOME/rustls install
  320. - if: contains(matrix.build.install_steps, 'hyper')
  321. run: |
  322. cd $HOME
  323. git clone --quiet --depth=1 https://github.com/hyperium/hyper.git
  324. cd $HOME/hyper
  325. RUSTFLAGS="--cfg hyper_unstable_ffi" cargo +nightly rustc --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib
  326. echo "LD_LIBRARY_PATH=$HOME/hyper/target/debug:/usr/local/lib" >> $GITHUB_ENV
  327. name: 'install hyper'
  328. - if: contains(matrix.build.install_steps, 'intel')
  329. run: |
  330. cd /tmp
  331. curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
  332. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  333. sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
  334. source /opt/intel/oneapi/setvars.sh
  335. printenv >> $GITHUB_ENV
  336. name: 'install Intel compilers'
  337. - if: contains(matrix.build.install_steps, 'pytest')
  338. run: |
  339. sudo apt-get install apache2 apache2-dev libnghttp2-dev
  340. sudo python3 -m pip install -r tests/http/requirements.txt
  341. name: 'install pytest and apach2-dev'
  342. - name: cache mod_h2
  343. if: contains(matrix.build.install_steps, 'pytest')
  344. uses: actions/cache@v4
  345. id: cache-mod_h2
  346. env:
  347. cache-name: cache-mod_h2
  348. with:
  349. path: /home/runner/mod_h2
  350. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
  351. - name: 'build mod_h2'
  352. if: contains(matrix.build.install_steps, 'pytest') && steps.cache-mod_h2.outputs.cache-hit != 'true'
  353. run: |
  354. cd $HOME
  355. git clone --quiet --depth=1 -b v${{ env.mod_h2-version }} https://github.com/icing/mod_h2
  356. cd mod_h2
  357. autoreconf -fi
  358. ./configure
  359. make
  360. - name: 'install mod_h2'
  361. if: contains(matrix.build.install_steps, 'pytest')
  362. run: |
  363. cd $HOME/mod_h2
  364. sudo make install
  365. - run: autoreconf -fi
  366. name: 'autoreconf'
  367. - run: ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }}
  368. name: 'configure'
  369. - run: make V=1
  370. name: 'make'
  371. - run: |
  372. git config --global --add safe.directory "*"
  373. ./scripts/singleuse.pl ${{ matrix.build.singleuse }} lib/.libs/libcurl.a
  374. name: single-use function check
  375. - run: ./src/curl -V
  376. name: 'check curl -V output'
  377. - run: make V=1 examples
  378. name: 'make examples'
  379. - run: make V=1 -C tests
  380. name: 'make tests'
  381. - run: make V=1 test-ci
  382. name: 'run tests'
  383. env:
  384. TFLAGS: "${{ matrix.build.tflags }}"
  385. - if: contains(matrix.build.install_steps, 'pytest')
  386. # run for `tests` directory, so pytest does not pick up any other
  387. # packages we might have built here
  388. run:
  389. pytest -v tests
  390. name: 'run pytest'
  391. env:
  392. TFLAGS: "${{ matrix.build.tflags }}"
  393. CURL_CI: github