linux.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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.yml'
  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.yml'
  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.21
  43. msh3-version: v0.6.0
  44. openssl3-version: openssl-3.1.3
  45. quictls-version: OpenSSL_1_1_1w+quic
  46. rustls-version: v0.10.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: LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib64" --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: CFLAGS=-O3 LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib64" --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/lib64" --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-websocketsx
  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
  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. - if: contains(matrix.build.install_steps, 'gcc-11')
  173. run: |
  174. sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
  175. sudo apt-get update
  176. sudo apt-get install gcc-11
  177. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
  178. sudo update-alternatives --set gcc /usr/bin/gcc-11
  179. gcc --version
  180. name: 'install gcc-11'
  181. - name: cache bearssl
  182. if: contains(matrix.build.install_steps, 'bearssl')
  183. uses: actions/cache@v3
  184. id: cache-bearssl
  185. env:
  186. cache-name: cache-bearssl
  187. with:
  188. path: /home/runner/bearssl
  189. key: ${{ runner.os }}-build-${{ env.cache-name }}-bearssl-${{ env.bearssl-version }}
  190. - name: 'build bearssl'
  191. if: contains(matrix.build.install_steps, 'bearssl') && steps.cache-bearssl.outputs.cache-hit != 'true'
  192. run: |
  193. curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://bearssl.org/bearssl-${{ env.bearssl-version }}.tar.gz
  194. tar -xzf bearssl-${{ env.bearssl-version }}.tar.gz
  195. cd bearssl-${{ env.bearssl-version }}
  196. make
  197. mkdir -p $HOME/bearssl/lib $HOME/bearssl/include
  198. cp inc/*.h $HOME/bearssl/include
  199. cp build/libbearssl.* $HOME/bearssl/lib
  200. - name: cache libressl
  201. if: contains(matrix.build.install_steps, 'libressl')
  202. uses: actions/cache@v3
  203. id: cache-libressl
  204. env:
  205. cache-name: cache-libressl
  206. with:
  207. path: /home/runner/libressl
  208. key: ${{ runner.os }}-build-${{ env.cache-name }}-libressl-${{ env.libressl-version }}
  209. - name: 'build libressl'
  210. if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
  211. run: |
  212. git clone --quiet --depth=1 -b ${{ env.libressl-version }} https://github.com/libressl-portable/portable.git libressl-git
  213. cd libressl-git
  214. ./autogen.sh
  215. ./configure --prefix=$HOME/libressl
  216. make install
  217. - name: cache mbedtls
  218. if: contains(matrix.build.install_steps, 'mbedtls')
  219. uses: actions/cache@v3
  220. id: cache-mbedtls
  221. env:
  222. cache-name: cache-mbedtls
  223. with:
  224. path: /home/runner/mbedtls
  225. key: ${{ runner.os }}-build-${{ env.cache-name }}-mbedtls-${{ env.mbedtls-version }}
  226. - name: 'build mbedtls'
  227. if: contains(matrix.build.install_steps, 'mbedtls') && steps.cache-mbedtls.outputs.cache-hit != 'true'
  228. run: |
  229. git clone --quiet --depth=1 -b ${{ env.mbedtls-version }} https://github.com/ARMmbed/mbedtls
  230. cd mbedtls
  231. make DESTDIR=$HOME/mbedtls install
  232. - name: cache openssl3
  233. if: contains(matrix.build.install_steps, 'openssl3')
  234. uses: actions/cache@v3
  235. id: cache-openssl3
  236. env:
  237. cache-name: cache-openssl3
  238. with:
  239. path: /home/runner/openssl3
  240. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl3-version }}
  241. - name: 'install openssl3'
  242. if: contains(matrix.build.install_steps, 'openssl3') && steps.cache-openssl3.outputs.cache-hit != 'true'
  243. run: |
  244. git clone --quiet --depth=1 -b ${{ env.openssl3-version }} https://github.com/openssl/openssl
  245. cd openssl
  246. ./config enable-tls1_3 --prefix=$HOME/openssl3
  247. make -j1 install_sw
  248. - name: cache quictls
  249. if: contains(matrix.build.install_steps, 'quictls')
  250. uses: actions/cache@v3
  251. id: cache-quictls
  252. env:
  253. cache-name: cache-quictls
  254. with:
  255. path: /home/runner/quictls
  256. key: ${{ runner.os }}-build-${{ env.cache-name }}-quictls-${{ env.quictls-version }}
  257. - name: 'build quictls'
  258. if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
  259. run: |
  260. git clone --quiet --depth=1 -b ${{ env.quictls-version }} https://github.com/quictls/openssl
  261. cd openssl
  262. ./config enable-tls1_3 --prefix=$HOME/quictls
  263. make -j1 install_sw
  264. - name: cache msh3
  265. if: contains(matrix.build.install_steps, 'msh3')
  266. uses: actions/cache@v3
  267. id: cache-msh3
  268. env:
  269. cache-name: cache-msh3
  270. with:
  271. path: /home/runner/msh3
  272. key: ${{ runner.os }}-build-${{ env.cache-name }}-msh3-${{ env.msh3-version }}
  273. - name: 'build msh3'
  274. if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
  275. run: |
  276. git clone --quiet -b ${{ env.msh3-version }} --depth=1 --recursive https://github.com/nibanks/msh3
  277. cd msh3 && mkdir build && cd build
  278. cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3 ..
  279. cmake --build .
  280. cmake --install .
  281. - if: contains(matrix.build.install_steps, 'rust')
  282. run: |
  283. cd $HOME
  284. curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
  285. source $HOME/.cargo/env
  286. rustup toolchain install nightly
  287. name: 'install rust'
  288. - name: cache rustls
  289. if: contains(matrix.build.install_steps, 'rustls')
  290. uses: actions/cache@v3
  291. id: cache-rustls
  292. env:
  293. cache-name: cache-rustls
  294. with:
  295. path: /home/runner/rustls
  296. key: ${{ runner.os }}-build-${{ env.cache-name }}-rustls-${{ env.rustls-version }}
  297. - name: 'build rustls'
  298. if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
  299. run: |
  300. git clone --quiet --depth=1 -b ${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
  301. cd rustls-ffi
  302. make DESTDIR=$HOME/rustls install
  303. - if: contains(matrix.build.install_steps, 'hyper')
  304. run: |
  305. cd $HOME
  306. git clone --quiet --depth=1 https://github.com/hyperium/hyper.git
  307. cd $HOME/hyper
  308. RUSTFLAGS="--cfg hyper_unstable_ffi" cargo +nightly rustc --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib
  309. echo "LD_LIBRARY_PATH=$HOME/hyper/target/debug:/usr/local/lib" >> $GITHUB_ENV
  310. name: 'install hyper'
  311. - if: contains(matrix.build.install_steps, 'intel')
  312. run: |
  313. cd /tmp
  314. curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
  315. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  316. sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
  317. source /opt/intel/oneapi/setvars.sh
  318. printenv >> $GITHUB_ENV
  319. name: 'install Intel compilers'
  320. - if: contains(matrix.build.install_steps, 'pytest')
  321. run: |
  322. sudo apt-get install apache2 apache2-dev libnghttp2-dev
  323. sudo python3 -m pip install -r tests/http/requirements.txt
  324. name: 'install pytest and apach2-dev'
  325. - name: cache mod_h2
  326. if: contains(matrix.build.install_steps, 'pytest')
  327. uses: actions/cache@v3
  328. id: cache-mod_h2
  329. env:
  330. cache-name: cache-mod_h2
  331. with:
  332. path: /home/runner/mod_h2
  333. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
  334. - name: 'build mod_h2'
  335. if: contains(matrix.build.install_steps, 'pytest') && steps.cache-mod_h2.outputs.cache-hit != 'true'
  336. run: |
  337. cd $HOME
  338. git clone --quiet --depth=1 -b ${{ env.mod_h2-version }} https://github.com/icing/mod_h2
  339. cd mod_h2
  340. autoreconf -fi
  341. ./configure
  342. make
  343. - name: 'install mod_h2'
  344. if: contains(matrix.build.install_steps, 'pytest')
  345. run: |
  346. cd $HOME/mod_h2
  347. sudo make install
  348. - run: autoreconf -fi
  349. name: 'autoreconf'
  350. - run: ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }}
  351. name: 'configure'
  352. - run: make V=1
  353. name: 'make'
  354. - run: |
  355. git config --global --add safe.directory "*"
  356. ./scripts/singleuse.pl ${{ matrix.build.singleuse }} lib/.libs/libcurl.a
  357. name: single-use function check
  358. - run: ./src/curl -V
  359. name: 'check curl -V output'
  360. - run: make V=1 examples
  361. name: 'make examples'
  362. - run: make V=1 -C tests
  363. name: 'make tests'
  364. - run: make V=1 test-ci
  365. name: 'run tests'
  366. env:
  367. TFLAGS: "${{ matrix.build.tflags }}"
  368. - if: contains(matrix.build.install_steps, 'pytest')
  369. # run for `tests` directory, so pytest does not pick up any other
  370. # packages we might have built here
  371. run:
  372. pytest -v tests
  373. name: 'run pytest'
  374. env:
  375. TFLAGS: "${{ matrix.build.tflags }}"
  376. CURL_CI: github