xref: /curl/.github/workflows/http3-linux.yml (revision 6081703b)
1# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2#
3# SPDX-License-Identifier: curl
4
5name: Linux HTTP/3
6
7'on':
8  push:
9    branches:
10      - master
11      - '*/ci'
12    paths-ignore:
13      - '**/*.md'
14      - '**/CMakeLists.txt'
15      - '.circleci/**'
16      - 'appveyor.*'
17      - 'CMake/**'
18      - 'packages/**'
19      - 'plan9/**'
20      - 'projects/**'
21      - 'winbuild/**'
22  pull_request:
23    branches:
24      - master
25    paths-ignore:
26      - '**/*.md'
27      - '**/CMakeLists.txt'
28      - '.circleci/**'
29      - 'appveyor.*'
30      - 'CMake/**'
31      - 'packages/**'
32      - 'plan9/**'
33      - 'projects/**'
34      - 'winbuild/**'
35
36concurrency:
37  # Hardcoded workflow filename as workflow name above is just Linux again
38  group: http3-${{ github.event.pull_request.number || github.sha }}
39  cancel-in-progress: true
40
41permissions: {}
42
43env:
44  MAKEFLAGS: -j 5
45  # handled in renovate.json
46  openssl-version: 3.4.0
47  # handled in renovate.json
48  quictls-version: 3.3.0
49  # renovate: datasource=github-tags depName=gnutls/gnutls versioning=semver registryUrl=https://github.com
50  gnutls-version: 3.8.8
51  wolfssl-version: master
52  # renovate: datasource=github-tags depName=ngtcp2/nghttp3 versioning=semver registryUrl=https://github.com
53  nghttp3-version: 1.6.0
54  # renovate: datasource=github-tags depName=ngtcp2/ngtcp2 versioning=semver registryUrl=https://github.com
55  ngtcp2-version: 1.8.1
56  # renovate: datasource=github-tags depName=nghttp2/nghttp2 versioning=semver registryUrl=https://github.com
57  nghttp2-version: 1.64.0
58  # renovate: datasource=github-tags depName=cloudflare/quiche versioning=semver registryUrl=https://github.com
59  quiche-version: 0.22.0
60
61jobs:
62  setup:
63    runs-on: ubuntu-latest
64    outputs:
65      wolfssl-version: ${{ steps.wolfssl-version.outputs.result }}
66
67    steps:
68      - id: wolfssl-version
69        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
70        with:
71          result-encoding: string
72          script: |
73            let version = '${{ env.wolfssl-version }}'
74
75            if (version != 'master') {
76                return version
77            }
78
79            let { data: commits } = await github.rest.repos.listCommits({
80                owner: 'wolfSSL',
81                repo: 'wolfssl',
82            })
83
84            return commits[0].sha
85
86  build-cache:
87    needs:
88      - setup
89    runs-on: ubuntu-latest
90
91    steps:
92      - name: cache quictls
93        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
94        id: cache-quictls-no-deprecated
95        env:
96          cache-name: cache-quictls-no-deprecated
97        with:
98          path: /home/runner/quictls/build
99          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.quictls-version }}-quic1
100
101      - name: cache gnutls
102        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
103        id: cache-gnutls
104        env:
105          cache-name: cache-gnutls
106        with:
107          path: /home/runner/gnutls/build
108          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.gnutls-version }}
109
110      - name: cache wolfssl
111        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
112        id: cache-wolfssl
113        env:
114          cache-name: cache-wolfssl
115          wolfssl-version: ${{ needs.setup.outputs.wolfssl-version }}
116        with:
117          path: /home/runner/wolfssl/build
118          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
119
120      - name: cache nghttp3
121        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
122        id: cache-nghttp3
123        env:
124          cache-name: cache-nghttp3
125        with:
126          path: /home/runner/nghttp3/build
127          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.nghttp3-version }}
128
129      - name: cache ngtcp2
130        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
131        id: cache-ngtcp2
132        env:
133          cache-name: cache-ngtcp2
134        with:
135          path: /home/runner/ngtcp2/build
136          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.ngtcp2-version }}
137
138      - name: cache nghttp2
139        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
140        id: cache-nghttp2
141        env:
142          cache-name: cache-nghttp2
143        with:
144          path: /home/runner/nghttp2/build
145          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.nghttp2-version }}
146
147      - id: settings
148        if: |
149          steps.cache-quictls-no-deprecated.outputs.cache-hit != 'true' ||
150          steps.cache-gnutls.outputs.cache-hit != 'true' ||
151          steps.cache-wolfssl.outputs.cache-hit != 'true' ||
152          steps.cache-nghttp3.outputs.cache-hit != 'true' ||
153          steps.cache-ngtcp2.outputs.cache-hit != 'true' ||
154          steps.cache-nghttp2.outputs.cache-hit != 'true'
155        run: |
156          echo 'needs-build=true' >> $GITHUB_OUTPUT
157
158      - name: install build prereqs
159        if: steps.settings.outputs.needs-build == 'true'
160        run: |
161          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
162          sudo apt-get update -y
163          sudo apt-get install -y --no-install-suggests --no-install-recommends \
164            libtool autoconf automake pkgconf stunnel4 \
165            libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev libev-dev libc-ares-dev \
166            nettle-dev libp11-kit-dev libtspi-dev libunistring-dev guile-2.2-dev libtasn1-bin \
167            libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \
168            texinfo texlive texlive-extra-utils autopoint libev-dev \
169            apache2 apache2-dev libnghttp2-dev
170          echo 'CC=gcc-12' >> $GITHUB_ENV
171          echo 'CXX=g++-12' >> $GITHUB_ENV
172
173      - if: steps.cache-quictls-no-deprecated.outputs.cache-hit != 'true'
174        run: |
175          cd $HOME
176          git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }}-quic1 https://github.com/quictls/openssl quictls
177          cd quictls
178          ./config no-deprecated --prefix=$PWD/build --libdir=lib
179          make
180          make -j1 install_sw
181        name: 'build quictls'
182
183      - if: steps.cache-gnutls.outputs.cache-hit != 'true'
184        run: |
185          cd $HOME
186          git clone --quiet --depth=1 -b ${{ env.gnutls-version }} https://github.com/gnutls/gnutls.git
187          cd gnutls
188          ./bootstrap
189          ./configure --disable-dependency-tracking --prefix=$PWD/build \
190            LDFLAGS="-Wl,-rpath,$PWD/build/lib -L$PWD/build/lib" \
191            --with-included-libtasn1 --with-included-unistring \
192            --disable-guile --disable-doc --disable-tests --disable-tools
193          make
194          make install
195        name: 'build gnutls'
196
197      - if: steps.cache-wolfssl.outputs.cache-hit != 'true'
198        env:
199          wolfssl-version: ${{ needs.setup.outputs.wolfssl-version }}
200        run: |
201          cd $HOME
202          mkdir wolfssl
203          cd wolfssl
204          git init
205          git remote add origin https://github.com/wolfSSL/wolfssl.git
206          git fetch origin --depth=1 ${{ env.wolfssl-version }}
207          git checkout ${{ env.wolfssl-version }}
208          ./autogen.sh
209          ./configure --disable-dependency-tracking --enable-all --enable-quic --prefix=$PWD/build
210          make
211          make install
212        name: 'build wolfssl'
213
214      - if: steps.cache-nghttp3.outputs.cache-hit != 'true'
215        run: |
216          cd $HOME
217          git clone --quiet --depth=1 -b v${{ env.nghttp3-version }} https://github.com/ngtcp2/nghttp3
218          cd nghttp3
219          git submodule update --init --depth=1
220          autoreconf -fi
221          ./configure --disable-dependency-tracking --prefix=$PWD/build PKG_CONFIG_PATH="$PWD/build/lib/pkgconfig" --enable-lib-only
222          make
223          make install
224        name: 'build nghttp3'
225
226      - if: steps.cache-ngtcp2.outputs.cache-hit != 'true'
227        run: |
228          cd $HOME
229          git clone --quiet --depth=1 -b v${{ env.ngtcp2-version }} https://github.com/ngtcp2/ngtcp2
230          cd ngtcp2
231          autoreconf -fi
232          ./configure --disable-dependency-tracking --prefix=$PWD/build \
233            PKG_CONFIG_PATH="$PWD/build/lib/pkgconfig:$HOME/quictls/build/lib/pkgconfig:$HOME/gnutls/build/lib/pkgconfig:$HOME/wolfssl/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig" \
234            --enable-lib-only --with-openssl --with-gnutls --with-wolfssl
235          make install
236        name: 'build ngtcp2'
237
238      - if: steps.cache-nghttp2.outputs.cache-hit != 'true'
239        run: |
240          cd $HOME
241          git clone --quiet --depth=1 -b v${{ env.nghttp2-version }} https://github.com/nghttp2/nghttp2
242          cd nghttp2
243          autoreconf -fi
244          ./configure --disable-dependency-tracking --prefix=$PWD/build \
245            PKG_CONFIG_PATH="$HOME/build/lib/pkgconfig:$HOME/quictls/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig:$HOME/ngtcp2/build/lib/pkgconfig" \
246            LDFLAGS="-Wl,-rpath,$HOME/quictls/build/lib" \
247            --enable-http3
248          make install
249        name: 'build nghttp2'
250
251  linux:
252    name: ${{ matrix.build.generate && 'CM' || 'AM' }} ${{ matrix.build.name }}
253    needs:
254      - setup
255      - build-cache
256    runs-on: 'ubuntu-24.04'
257    timeout-minutes: 45
258    strategy:
259      fail-fast: false
260      matrix:
261        build:
262          - name: quictls
263            PKG_CONFIG_PATH: '$HOME/quictls/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig:$HOME/ngtcp2/build/lib/pkgconfig:$HOME/nghttp2/build/lib/pkgconfig'
264            configure: >-
265              LDFLAGS="-Wl,-rpath,$HOME/quictls/build/lib"
266              --with-ngtcp2=$HOME/ngtcp2/build --enable-warnings --enable-werror --enable-debug --disable-ntlm
267              --with-test-nghttpx="$HOME/nghttp2/build/bin/nghttpx"
268              --with-openssl=$HOME/quictls/build
269
270          - name: gnutls
271            PKG_CONFIG_PATH: '$HOME/gnutls/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig:$HOME/ngtcp2/build/lib/pkgconfig:$HOME/nghttp2/build/lib/pkgconfig'
272            configure: >-
273              LDFLAGS="-Wl,-rpath,$HOME/gnutls/build/lib"
274              --with-ngtcp2=$HOME/ngtcp2/build --enable-warnings --enable-werror --enable-debug
275              --with-test-nghttpx="$HOME/nghttp2/build/bin/nghttpx"
276              --with-gnutls=$HOME/gnutls/build
277
278          - name: wolfssl
279            PKG_CONFIG_PATH: '$HOME/wolfssl/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig:$HOME/ngtcp2/build/lib/pkgconfig:$HOME/nghttp2/build/lib/pkgconfig'
280            configure: >-
281              LDFLAGS="-Wl,-rpath,$HOME/wolfssl/build/lib"
282              --with-ngtcp2=$HOME/ngtcp2/build --enable-warnings --enable-werror --enable-debug
283              --with-test-nghttpx="$HOME/nghttp2/build/bin/nghttpx"
284              --with-wolfssl=$HOME/wolfssl/build
285              --enable-httpsrr --enable-ech
286
287          - name: wolfssl
288            PKG_CONFIG_PATH: '$HOME/wolfssl/build/lib/pkgconfig:$HOME/nghttp3/build/lib/pkgconfig:$HOME/ngtcp2/build/lib/pkgconfig:$HOME/nghttp2/build/lib/pkgconfig'
289            generate: >-
290              -DCURL_USE_WOLFSSL=ON -DUSE_NGTCP2=ON -DENABLE_DEBUG=ON
291              -DTEST_NGHTTPX="$HOME/nghttp2/build/bin/nghttpx"
292              -DHTTPD_NGHTTPX="$HOME/nghttp2/build/bin/nghttpx"
293              -DUSE_HTTPSRR=ON -DUSE_ECH=ON
294
295          - name: openssl-quic
296            PKG_CONFIG_PATH: '$HOME/openssl/build/lib64/pkgconfig'
297            configure: >-
298              LDFLAGS="-Wl,-rpath,$HOME/openssl/build/lib64"
299              --enable-warnings --enable-werror --enable-debug --disable-ntlm
300              --with-test-nghttpx="$HOME/nghttp2/build/bin/nghttpx"
301              --with-openssl=$HOME/openssl/build --with-openssl-quic
302              --with-nghttp3=$HOME/nghttp3/build
303
304          - name: quiche
305            configure: >-
306              LDFLAGS="-Wl,-rpath,$HOME/quiche/target/release"
307              --with-openssl=$HOME/quiche/quiche/deps/boringssl/src
308              --enable-warnings --enable-werror --enable-debug
309              --with-quiche=$HOME/quiche/target/release
310              --with-test-nghttpx="$HOME/nghttp2/build/bin/nghttpx"
311              --with-ca-fallback
312
313          - name: quiche
314            PKG_CONFIG_PATH: '$HOME/quiche/target/release'
315            generate: >-
316              -DOPENSSL_ROOT_DIR=$HOME/quiche/quiche/deps/boringssl/src -DENABLE_DEBUG=ON
317              -DUSE_QUICHE=ON
318              -DTEST_NGHTTPX="$HOME/nghttp2/build/bin/nghttpx"
319              -DHTTPD_NGHTTPX="$HOME/nghttp2/build/bin/nghttpx"
320              -DCURL_CA_FALLBACK=ON
321
322    steps:
323      - run: |
324          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
325          sudo apt-get update -y
326          sudo apt-get install -y --no-install-suggests --no-install-recommends \
327            libtool autoconf automake ninja-build pkgconf stunnel4 \
328            libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev libev-dev libc-ares-dev \
329            nettle-dev libp11-kit-dev libtspi-dev libunistring-dev guile-2.2-dev libtasn1-bin \
330            libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \
331            texinfo texlive texlive-extra-utils autopoint libev-dev \
332            apache2 apache2-dev libnghttp2-dev vsftpd
333          python3 -m venv $HOME/venv
334          echo 'CC=gcc-12' >> $GITHUB_ENV
335          echo 'CXX=g++-12' >> $GITHUB_ENV
336        name: 'install prereqs'
337
338      - name: cache quictls
339        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
340        id: cache-quictls-no-deprecated
341        env:
342          cache-name: cache-quictls-no-deprecated
343        with:
344          path: /home/runner/quictls/build
345          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.quictls-version }}
346          fail-on-cache-miss: true
347
348      - name: cache gnutls
349        if: matrix.build.name == 'gnutls'
350        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
351        id: cache-gnutls
352        env:
353          cache-name: cache-gnutls
354        with:
355          path: /home/runner/gnutls/build
356          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.gnutls-version }}
357          fail-on-cache-miss: true
358
359      - name: cache wolfssl
360        if: matrix.build.name == 'wolfssl'
361        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
362        id: cache-wolfssl
363        env:
364          cache-name: cache-wolfssl
365          wolfssl-version: ${{ needs.setup.outputs.wolfssl-version }}
366        with:
367          path: /home/runner/wolfssl/build
368          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
369          fail-on-cache-miss: true
370
371      - name: cache nghttp3
372        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
373        id: cache-nghttp3
374        env:
375          cache-name: cache-nghttp3
376        with:
377          path: /home/runner/nghttp3/build
378          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.nghttp3-version }}
379          fail-on-cache-miss: true
380
381      - name: cache ngtcp2
382        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
383        id: cache-ngtcp2
384        env:
385          cache-name: cache-ngtcp2
386        with:
387          path: /home/runner/ngtcp2/build
388          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.ngtcp2-version }}
389          fail-on-cache-miss: true
390
391      - name: cache nghttp2
392        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
393        id: cache-nghttp2
394        env:
395          cache-name: cache-nghttp2
396        with:
397          path: /home/runner/nghttp2/build
398          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.nghttp2-version }}
399          fail-on-cache-miss: true
400
401      - name: cache openssl
402        if: matrix.build.name == 'openssl-quic'
403        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
404        id: cache-openssl
405        env:
406          cache-name: cache-openssl
407        with:
408          path: /home/runner/openssl/build
409          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.openssl-version }}
410
411      - name: 'install openssl'
412        if: matrix.build.name == 'openssl-quic' && steps.cache-openssl.outputs.cache-hit != 'true'
413        run: |
414          git clone --quiet --depth=1 -b openssl-${{ env.openssl-version }} https://github.com/openssl/openssl
415          cd openssl
416          ./config --prefix=$HOME/openssl/build
417          make -j1 install_sw
418          cat exporters/openssl.pc
419
420      - name: cache quiche
421        if: matrix.build.name == 'quiche'
422        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
423        id: cache-quiche
424        env:
425          cache-name: cache-quiche
426        with:
427          path: /home/runner/quiche
428          key: ${{ runner.os }}-http3-build-${{ env.cache-name }}-${{ env.quiche-version }}
429
430      - if: matrix.build.name == 'quiche' && steps.cache-quiche.outputs.cache-hit != 'true'
431        run: |
432          cd $HOME
433          git clone --quiet --depth=1 -b ${{ env.quiche-version }} --recursive https://github.com/cloudflare/quiche.git
434          cd quiche
435          #### Work-around https://github.com/curl/curl/issues/7927 #######
436          #### See https://github.com/alexcrichton/cmake-rs/issues/131 ####
437          sed -i -e 's/cmake = "0.1"/cmake = "=0.1.45"/' quiche/Cargo.toml
438
439          cargo build -v --package quiche --release --features ffi,pkg-config-meta,qlog --verbose
440          ln -s libquiche.so target/release/libquiche.so.0
441          mkdir -v quiche/deps/boringssl/src/lib
442          ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) quiche/deps/boringssl/src/lib/
443
444          # include dir
445          # $HOME/quiche/quiche/deps/boringssl/src/include
446          # lib dir
447          # $HOME/quiche/quiche/deps/boringssl/src/lib
448        name: 'build quiche and boringssl'
449
450      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
451
452      - run: autoreconf -fi
453        if: ${{ matrix.build.configure }}
454        name: 'autoreconf'
455
456      - name: 'configure'
457        run: |
458          if [ -n '${{ matrix.build.PKG_CONFIG_PATH }}' ]; then
459            export PKG_CONFIG_PATH="${{ matrix.build.PKG_CONFIG_PATH }}"
460          fi
461          if [ -n '${{ matrix.build.generate }}' ]; then
462            cmake -B . -G Ninja \
463              -DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
464              -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
465              -DCURL_BROTLI=ON -DCURL_ZSTD=ON \
466              ${{ matrix.build.generate }}
467          else
468            ./configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
469              ${{ matrix.build.configure }}
470          fi
471
472      - name: 'configure log'
473        if: ${{ !cancelled() }}
474        run: cat config.log CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
475
476      - name: 'curl_config.h'
477        run: |
478          echo '::group::raw'; cat lib/curl_config.h || true; echo '::endgroup::'
479          grep -F '#define' lib/curl_config.h | sort || true
480
481      - name: 'test configs'
482        run: |
483          cat tests/config || true
484          cat tests/http/config.ini || true
485
486      - name: 'build'
487        run: |
488          if [ -n '${{ matrix.build.generate }}' ]; then
489            cmake --build . --verbose
490          else
491            make V=1
492          fi
493
494      - run: ./src/curl -V
495        name: 'check curl -V output'
496
497      - name: 'build tests'
498        run: |
499          if [ -n '${{ matrix.build.generate }}' ]; then
500            cmake --build . --verbose --target testdeps
501          else
502            make V=1 -C tests
503          fi
504
505      - name: 'install test prereqs'
506        run: |
507          source $HOME/venv/bin/activate
508          python3 -m pip install -r tests/requirements.txt
509
510      - name: 'run tests'
511        env:
512          TFLAGS: "${{ matrix.build.tflags }}"
513        run: |
514          source $HOME/venv/bin/activate
515          if [ -n '${{ matrix.build.generate }}' ]; then
516            cmake --build . --verbose --target test-ci
517          else
518            make V=1 test-ci
519          fi
520
521      - name: 'install pytest prereqs'
522        run: |
523          source $HOME/venv/bin/activate
524          python3 -m pip install -r tests/http/requirements.txt
525
526      - name: 'run pytest'
527        env:
528          TFLAGS: "${{ matrix.build.tflags }}"
529          CURL_CI: github
530        run: |
531          source $HOME/venv/bin/activate
532          if [ -n '${{ matrix.build.generate }}' ]; then
533            cmake --build . --verbose --target curl-pytest-ci
534          else
535            make V=1 pytest-ci
536          fi
537
538      - name: 'build examples'
539        run: |
540          if [ -n '${{ matrix.build.generate }}' ]; then
541            cmake --build . --verbose --target curl-examples
542          else
543            make V=1 examples
544          fi
545