linux.yml 17 KB

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