xref: /curl/.github/workflows/linux.yml (revision b13078d6)
1# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2#
3# SPDX-License-Identifier: curl
4
5name: Linux
6
7'on':
8  push:
9    branches:
10      - master
11      - '*/ci'
12    paths-ignore:
13      - '**/*.md'
14      - '.circleci/**'
15      - 'appveyor.*'
16      - 'packages/**'
17      - 'plan9/**'
18      - 'projects/**'
19      - 'winbuild/**'
20  pull_request:
21    branches:
22      - master
23    paths-ignore:
24      - '**/*.md'
25      - '.circleci/**'
26      - 'appveyor.*'
27      - 'packages/**'
28      - 'plan9/**'
29      - 'projects/**'
30      - 'winbuild/**'
31
32concurrency:
33  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
34  cancel-in-progress: true
35
36permissions: {}
37
38env:
39  MAKEFLAGS: -j 5
40  # unhandled
41  bearssl-version: 0.6
42  # renovate: datasource=github-tags depName=libressl-portable/portable versioning=semver registryUrl=https://github.com
43  libressl-version: 4.0.0
44  # renovate: datasource=github-tags depName=wolfSSL/wolfssl versioning=semver extractVersion=^v?(?<version>.+)-stable$ registryUrl=https://github.com
45  wolfssl-version: 5.7.4
46  # renovate: datasource=github-tags depName=Mbed-TLS/mbedtls versioning=semver registryUrl=https://github.com
47  mbedtls-version: 3.6.2
48  # renovate: datasource=github-tags depName=nibanks/msh3 versioning=semver registryUrl=https://github.com
49  msh3-version: 0.6.0
50  # renovate: datasource=github-tags depName=awslabs/aws-lc versioning=semver registryUrl=https://github.com
51  awslc-version: 1.39.0
52  # handled in renovate.json
53  openssl-version: 3.4.0
54  # handled in renovate.json
55  quictls-version: 3.3.0
56  # renovate: datasource=github-tags depName=rustls/rustls-ffi versioning=semver registryUrl=https://github.com
57  rustls-version: 0.14.0
58
59jobs:
60  linux:
61    name: ${{ matrix.build.generate && 'CM' || 'AM' }} ${{ matrix.build.name }}
62    runs-on: 'ubuntu-24.04'
63    container: ${{ matrix.build.container }}
64    timeout-minutes: 45
65    strategy:
66      fail-fast: false
67      matrix:
68        build:
69          - name: bearssl
70            install_packages: zlib1g-dev
71            install_steps: bearssl pytest
72            configure: LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
73
74          - name: bearssl clang
75            install_packages: zlib1g-dev clang
76            install_steps: bearssl
77            configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
78
79          - name: libressl heimdal
80            install_packages: zlib1g-dev heimdal-dev
81            install_steps: libressl pytest
82            configure: LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --with-gssapi --enable-debug
83
84          - name: libressl heimdal valgrind
85            install_packages: zlib1g-dev heimdal-dev valgrind
86            install_steps: libressl pytest
87            generate: -DOPENSSL_ROOT_DIR=$HOME/libressl -DCURL_USE_GSSAPI=ON -DENABLE_DEBUG=ON -DCURL_LIBCURL_VERSIONED_SYMBOLS=ON
88
89          - name: libressl clang
90            install_packages: zlib1g-dev clang
91            install_steps: libressl
92            configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --enable-debug
93
94          - name: wolfssl-all
95            install_packages: zlib1g-dev
96            install_steps: wolfssl-all
97            configure: LDFLAGS="-Wl,-rpath,$HOME/wolfssl-all/lib" --with-wolfssl=$HOME/wolfssl-all --enable-httpsrr --enable-ech --enable-debug
98
99          - name: wolfssl-opensslextra valgrind
100            install_packages: zlib1g-dev valgrind
101            install_steps: wolfssl-opensslextra
102            configure: LDFLAGS="-Wl,-rpath,$HOME/wolfssl-opensslextra/lib" --with-wolfssl=$HOME/wolfssl-opensslextra --enable-debug
103
104          - name: mbedtls valgrind
105            install_packages: libnghttp2-dev valgrind
106            install_steps: mbedtls pytest
107            configure: LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
108
109          - name: mbedtls clang
110            install_packages: libnghttp2-dev clang
111            install_steps: mbedtls
112            configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
113
114          - name: mbedtls
115            install_packages: libnghttp2-dev
116            install_steps: mbedtls
117            PKG_CONFIG_PATH: '$HOME/mbedtls/lib/pkgconfig'  # Requires v3.6.0 or v2.28.8
118            generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON
119
120          - name: mbedtls-pkg
121            install_packages: libnghttp2-dev libmbedtls-dev
122            generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON
123
124          - name: mbedtls-pkg !pc
125            install_packages: libnghttp2-dev libmbedtls-dev
126            install_steps: skipall
127            generate: -DCURL_USE_MBEDTLS=ON -DENABLE_DEBUG=ON -DCURL_USE_PKGCONFIG=OFF
128
129          - name: msh3
130            install_packages: zlib1g-dev
131            install_steps: quictls msh3
132            configure: LDFLAGS="-Wl,-rpath,$HOME/msh3/lib -Wl,-rpath,$HOME/quictls/lib" --with-msh3=$HOME/msh3 --with-openssl=$HOME/quictls --enable-debug
133
134          - name: msh3
135            install_packages: zlib1g-dev
136            install_steps: quictls msh3 skipall
137            PKG_CONFIG_PATH: '$HOME/msh3/lib/pkgconfig'  # Broken as of v0.6.0
138            generate: -DOPENSSL_ROOT_DIR=$HOME/quictls -DUSE_MSH3=ON -DMSH3_INCLUDE_DIR=$HOME/msh3/include -DMSH3_LIBRARY=$HOME/msh3/lib/libmsh3.so -DENABLE_DEBUG=ON
139
140          - name: awslc
141            install_packages: zlib1g-dev
142            install_steps: awslc
143            configure: LDFLAGS="-Wl,-rpath,$HOME/awslc/lib" --with-openssl=$HOME/awslc --enable-httpsrr --enable-ech
144
145          - name: awslc
146            install_packages: zlib1g-dev
147            install_steps: awslc
148            generate: -DOPENSSL_ROOT_DIR=$HOME/awslc -DUSE_HTTPSRR=ON -DUSE_ECH=ON -DCMAKE_UNITY_BUILD=OFF
149
150          - name: openssl default
151            install_steps: pytest
152            configure: --with-openssl --enable-debug --disable-unity
153
154          - name: openssl libssh2 sync-resolver valgrind
155            install_packages: zlib1g-dev libssh2-1-dev valgrind
156            install_steps: pytest
157            configure: --with-openssl --enable-debug --disable-threaded-resolver --with-libssh2
158
159          - name: openssl
160            install_packages: zlib1g-dev
161            install_steps: pytest
162            configure: CFLAGS=-std=gnu89 --with-openssl --enable-debug
163
164          - name: openssl -O3 valgrind
165            install_packages: zlib1g-dev valgrind
166            configure: CPPFLAGS=-DCURL_WARN_SIGN_CONVERSION CFLAGS=-O3 --with-openssl --enable-debug
167
168          - name: openssl clang krb5
169            install_packages: zlib1g-dev libkrb5-dev clang
170            configure: CC=clang --with-openssl --with-gssapi --enable-debug
171
172          - name: openssl clang krb5
173            install_packages: zlib1g-dev libkrb5-dev clang
174            install_steps: skipall
175            generate: -DCURL_USE_OPENSSL=ON -DCURL_USE_GSSAPI=ON -DENABLE_DEBUG=ON
176
177          - name: openssl !ipv6
178            configure: --with-openssl --disable-ipv6 --enable-debug --disable-unity
179
180          - name: openssl https-only
181            configure: >-
182              --with-openssl --enable-debug --disable-unity
183              --disable-dict --disable-gopher --disable-ldap --disable-telnet
184              --disable-imap --disable-pop3 --disable-smtp
185              --disable-rtmp --disable-rtsp
186              --disable-scp --disable-sftp --disable-tftp --disable-ftp --disable-file --disable-smb
187
188          - name: openssl torture !FTP
189            install_packages: zlib1g-dev libnghttp2-dev libssh2-1-dev libc-ares-dev
190            generate: -DCURL_USE_OPENSSL=ON -DENABLE_DEBUG=ON -DENABLE_ARES=ON
191            tflags: -t --shallow=25 !FTP
192            torture: true
193
194          - name: openssl torture FTP
195            install_packages: zlib1g-dev libnghttp2-dev libssh2-1-dev libc-ares-dev
196            generate: -DCURL_USE_OPENSSL=ON -DENABLE_DEBUG=ON -DENABLE_ARES=ON
197            tflags: -t --shallow=20 FTP
198            torture: true
199
200          - name: openssl i686
201            install_packages: gcc-14-i686-linux-gnu libssl-dev:i386 librtmp-dev:i386 libssh2-1-dev:i386 libidn2-0-dev:i386 libc-ares-dev:i386 zlib1g-dev:i386
202            configure: >-
203              PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
204              CC=i686-linux-gnu-gcc-14
205              CPPFLAGS=-I/usr/include/i386-linux-gnu
206              LDFLAGS=-L/usr/lib/i386-linux-gnu
207              --host=i686-linux-gnu
208              --with-openssl --with-librtmp --with-libssh2 --with-libidn2 --enable-ares --enable-debug
209
210          - name: '!ssl !http !smtp !imap'
211            configure: --without-ssl --enable-debug --disable-http --disable-smtp --disable-imap --disable-unity
212
213          - name: scanbuild
214            install_packages: clang-tools clang libssl-dev libssh2-1-dev
215            install_steps: skipall
216            configure: --with-openssl --enable-debug --with-libssh2 --disable-unity
217            configure-prefix: CC=clang scan-build
218            make-prefix: scan-build --status-bugs
219
220          - name: address-sanitizer
221            install_packages: zlib1g-dev libssh2-1-dev clang libssl-dev libubsan1 libasan8 libtsan2
222            install_steps: pytest
223            configure: >-
224              CC=clang
225              CFLAGS="-fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g"
226              LDFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer"
227              LIBS="-ldl -lubsan"
228              --with-openssl --enable-debug
229
230          - name: thread-sanitizer
231            install_packages: zlib1g-dev clang libtsan2
232            install_steps: pytest openssl-tsan
233            configure: >-
234              CC=clang
235              CFLAGS="-fsanitize=thread -g"
236              LDFLAGS="-fsanitize=thread -Wl,-rpath,$HOME/openssl/lib"
237              --with-openssl=$HOME/openssl --enable-debug
238
239          - name: memory-sanitizer
240            install_packages: clang
241            configure: >-
242              CC=clang
243              CFLAGS="-fsanitize=memory -Wformat -Werror=format-security -Werror=array-bounds -g"
244              LDFLAGS="-fsanitize=memory"
245              LIBS="-ldl"
246              --without-ssl --without-zlib --without-brotli --without-zstd --without-libpsl --without-nghttp2 --enable-debug
247
248          - name: event-based
249            install_packages: libssh-dev
250            configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
251            tflags: -n --test-event '!TLS-SRP'
252
253          - name: duphandle
254            install_packages: libssh-dev
255            configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
256            tflags: -n --test-duphandle '!TLS-SRP'
257
258          - name: rustls valgrind
259            install_packages: valgrind
260            install_steps: rust rustls pytest
261            configure: --with-rustls=$HOME/rustls --enable-debug
262
263          - name: rustls
264            install_steps: rust rustls skipall
265            PKG_CONFIG_PATH: '$HOME/rustls/lib/pkgconfig'  # Not built as of v0.14.0
266            generate: -DCURL_USE_RUSTLS=ON -DRUSTLS_INCLUDE_DIR=$HOME/rustls/include -DRUSTLS_LIBRARY=$HOME/rustls/lib/librustls.a -DENABLE_DEBUG=ON
267
268          - name: IntelC openssl
269            install_packages: zlib1g-dev libssl-dev
270            install_steps: intel
271            configure: CC=icc --enable-debug --with-openssl
272
273          - name: Slackware openssl gssapi gcc
274            # These are essentially the same flags used to build the curl Slackware package
275            # https://ftpmirror.infania.net/slackware/slackware64-current/source/n/curl/curl.SlackBuild
276            configure: --with-openssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs
277            # Docker Hub image that `container-job` executes in
278            container: 'andy5995/slackware-build-essential:15.0'
279
280          - name: Alpine MUSL
281            configure: --enable-debug --with-ssl --with-libssh2 --with-libidn2 --with-gssapi --enable-ldap --with-libpsl
282            container: 'alpine:3.18'
283
284    steps:
285      - if: matrix.build.container == null && !contains(matrix.build.name, 'i686')
286        run: |
287          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
288          sudo apt-get update -y
289          sudo apt-get install -y --no-install-suggests --no-install-recommends \
290            libtool autoconf automake pkgconf ninja-build stunnel4 \
291            libpsl-dev libbrotli-dev libzstd-dev \
292            ${{ matrix.build.install_packages }}
293          python3 -m venv $HOME/venv
294        name: 'install prereqs'
295
296      - if: contains(matrix.build.name, 'i686')
297        run: |
298          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
299          sudo dpkg --add-architecture i386
300          sudo apt-get update -y
301          sudo apt-get install -y --no-install-suggests --no-install-recommends \
302            libtool autoconf automake pkgconf stunnel4 \
303            libpsl-dev:i386 libbrotli-dev:i386 libzstd-dev:i386 \
304            ${{ matrix.build.install_packages }}
305          python3 -m venv $HOME/venv
306        name: 'install prereqs'
307
308      - if: contains(matrix.build.install_steps, 'pytest')
309        run: |
310          sudo apt-get install -y --no-install-suggests --no-install-recommends \
311            apache2 apache2-dev libnghttp2-dev vsftpd
312        name: 'install prereqs for pytest'
313
314      - if: startsWith(matrix.build.container, 'alpine')
315        run: |
316          apk add --no-cache build-base autoconf automake libtool perl openssl-dev libssh2-dev \
317            zlib-dev brotli-dev zstd-dev libidn2-dev openldap-dev heimdal-dev libpsl-dev \
318            py3-impacket py3-asn1 py3-six py3-pycryptodomex \
319            perl-time-hires openssh stunnel sudo git
320        name: 'install dependencies'
321
322      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
323
324      - name: 'Fix kernel mmap rnd bits'
325        # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
326        # high-entropy ASLR in much newer kernels that GitHub runners are
327        # using leading to random crashes: https://reviews.llvm.org/D148280
328        # See https://github.com/actions/runner-images/issues/9491
329        continue-on-error: true
330        run: sudo sysctl vm.mmap_rnd_bits=28
331
332      - name: 'cache bearssl'
333        if: contains(matrix.build.install_steps, 'bearssl')
334        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
335        id: cache-bearssl
336        env:
337          cache-name: cache-bearssl
338        with:
339          path: /home/runner/bearssl
340          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.bearssl-version }}
341
342      - name: 'build bearssl'
343        if: contains(matrix.build.install_steps, 'bearssl') && steps.cache-bearssl.outputs.cache-hit != 'true'
344        run: |
345          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://bearssl.org/bearssl-${{ env.bearssl-version }}.tar.gz
346          tar -xzf bearssl-${{ env.bearssl-version }}.tar.gz
347          cd bearssl-${{ env.bearssl-version }}
348          make
349          mkdir -p $HOME/bearssl/lib $HOME/bearssl/include
350          cp inc/*.h $HOME/bearssl/include
351          cp build/libbearssl.* $HOME/bearssl/lib
352
353      - name: 'cache libressl'
354        if: contains(matrix.build.install_steps, 'libressl')
355        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
356        id: cache-libressl
357        env:
358          cache-name: cache-libressl
359        with:
360          path: /home/runner/libressl
361          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.libressl-version }}
362
363      - name: 'build libressl'
364        if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
365        run: |
366          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/libressl/portable/releases/download/v${{ env.libressl-version }}/libressl-${{ env.libressl-version }}.tar.gz
367          tar -xzf libressl-${{ env.libressl-version }}.tar.gz
368          cd libressl-${{ env.libressl-version }}
369          ./configure --disable-dependency-tracking --prefix=$HOME/libressl
370          make install
371
372      - name: 'cache wolfssl (all)'
373        if: contains(matrix.build.install_steps, 'wolfssl-all')
374        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
375        id: cache-wolfssl-all
376        env:
377          cache-name: cache-wolfssl-all
378        with:
379          path: /home/runner/wolfssl-all
380          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
381
382      - name: 'build wolfssl (all)'
383        if: contains(matrix.build.install_steps, 'wolfssl-all') && steps.cache-wolfssl-all.outputs.cache-hit != 'true'
384        run: |
385          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssl/archive/v${{ env.wolfssl-version }}-stable.tar.gz
386          tar -xzf v${{ env.wolfssl-version }}-stable.tar.gz
387          cd wolfssl-${{ env.wolfssl-version }}-stable
388          ./autogen.sh
389          ./configure --disable-dependency-tracking --enable-tls13 --enable-harden --enable-all \
390            --disable-benchmark --disable-crypttests --disable-examples --prefix=$HOME/wolfssl-all
391          make install
392
393      - name: 'cache wolfssl (opensslextra)'
394        if: contains(matrix.build.install_steps, 'wolfssl-opensslextra')
395        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
396        id: cache-wolfssl-opensslextra
397        env:
398          cache-name: cache-wolfssl-opensslextra
399        with:
400          path: /home/runner/wolfssl-opensslextra
401          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
402
403      - name: 'build wolfssl (opensslextra)'
404        if: contains(matrix.build.install_steps, 'wolfssl-opensslextra') && steps.cache-wolfssl-opensslextra.outputs.cache-hit != 'true'
405        run: |
406          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssl/archive/v${{ env.wolfssl-version }}-stable.tar.gz
407          tar -xzf v${{ env.wolfssl-version }}-stable.tar.gz
408          cd wolfssl-${{ env.wolfssl-version }}-stable
409          ./autogen.sh
410          ./configure --disable-dependency-tracking --enable-tls13 --enable-harden --enable-opensslextra \
411            --disable-benchmark --disable-crypttests --disable-examples --prefix=$HOME/wolfssl-opensslextra
412          make install
413
414      - name: 'cache mbedtls'
415        if: contains(matrix.build.install_steps, 'mbedtls')
416        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
417        id: cache-mbedtls
418        env:
419          cache-name: cache-mbedtls-threadsafe
420        with:
421          path: /home/runner/mbedtls
422          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mbedtls-version }}
423
424      - name: 'build mbedtls'
425        if: contains(matrix.build.install_steps, 'mbedtls') && steps.cache-mbedtls.outputs.cache-hit != 'true'
426        run: |
427          git clone --quiet --depth=1 -b v${{ env.mbedtls-version }} https://github.com/Mbed-TLS/mbedtls
428          cd mbedtls
429          git submodule update --init --depth=1
430          ./scripts/config.py set MBEDTLS_THREADING_C
431          ./scripts/config.py set MBEDTLS_THREADING_PTHREAD
432          cmake -B . -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=$HOME/mbedtls \
433            -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF
434          cmake --build .
435          cmake --install .
436
437      - name: 'cache openssl (thread sanitizer)'
438        if: contains(matrix.build.install_steps, 'openssl-tsan')
439        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
440        id: cache-openssl-tsan
441        env:
442          cache-name: cache-openssl-tsan
443        with:
444          path: /home/runner/openssl
445          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl-version }}
446
447      - name: 'build openssl (thread sanitizer)'
448        if: contains(matrix.build.install_steps, 'openssl-tsan') && steps.cache-openssl-tsan.outputs.cache-hit != 'true'
449        run: |
450          git clone --quiet --depth=1 -b openssl-${{ env.openssl-version }} https://github.com/openssl/openssl
451          cd openssl
452          CC="clang" CFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread" ./config --prefix=$HOME/openssl --libdir=lib no-makedepend no-apps no-docs no-tests
453          make
454          make -j1 install_sw
455
456      - name: 'cache quictls'
457        if: contains(matrix.build.install_steps, 'quictls')
458        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
459        id: cache-quictls
460        env:
461          cache-name: cache-quictls
462        with:
463          path: /home/runner/quictls
464          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.quictls-version }}-quic1
465
466      - name: 'build quictls'
467        if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
468        run: |
469          git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }}-quic1 https://github.com/quictls/openssl
470          cd openssl
471          ./config --prefix=$HOME/quictls --libdir=lib no-makedepend no-apps no-docs no-tests
472          make
473          make -j1 install_sw
474
475      - name: 'cache msh3'
476        if: contains(matrix.build.install_steps, 'msh3')
477        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
478        id: cache-msh3
479        env:
480          cache-name: cache-msh3
481        with:
482          path: /home/runner/msh3
483          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.msh3-version }}
484
485      - name: 'build msh3'
486        if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
487        run: |
488          git clone --quiet --depth=1 -b v${{ env.msh3-version }} --recursive https://github.com/nibanks/msh3
489          cd msh3
490          cmake -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3
491          cmake --build .
492          cmake --install .
493
494      - name: 'cache awslc'
495        if: contains(matrix.build.install_steps, 'awslc')
496        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
497        id: cache-awslc
498        env:
499          cache-name: cache-awslc
500        with:
501          path: /home/runner/awslc
502          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.awslc-version }}
503
504      - name: 'build awslc'
505        if: contains(matrix.build.install_steps, 'awslc') && steps.cache-awslc.outputs.cache-hit != 'true'
506        run: |
507          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 \
508            https://github.com/awslabs/aws-lc/archive/refs/tags/v${{ env.awslc-version }}.tar.gz
509          tar xzf v${{ env.awslc-version }}.tar.gz
510          mkdir aws-lc-${{ env.awslc-version }}-build
511          cd aws-lc-${{ env.awslc-version }}-build
512          cmake -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/awslc ../aws-lc-${{ env.awslc-version }} -DBUILD_TOOL=OFF -DBUILD_TESTING=OFF
513          cmake --build .
514          cmake --install .
515
516      - name: 'cache rustls'
517        if: contains(matrix.build.install_steps, 'rustls')
518        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
519        id: cache-rustls
520        env:
521          cache-name: cache-rustls
522        with:
523          path: /home/runner/rustls
524          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.rustls-version }}
525
526      - name: 'install rust'
527        if: contains(matrix.build.install_steps, 'rust') && steps.cache-rustls.outputs.cache-hit != 'true'
528        run: |
529          cd $HOME
530          curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
531          source $HOME/.cargo/env
532          rustup toolchain install nightly
533
534      - name: 'build rustls'
535        if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
536        run: |
537          git clone --quiet --depth=1 -b v${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
538          cd rustls-ffi
539          make DESTDIR=$HOME/rustls install
540
541      - if: contains(matrix.build.install_steps, 'intel')
542        run: |
543          cd /tmp
544          curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
545          sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
546          sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
547          source /opt/intel/oneapi/setvars.sh
548          printenv >> $GITHUB_ENV
549        name: 'install Intel compilers'
550
551      - run: autoreconf -fi
552        if: ${{ matrix.build.configure }}
553        name: 'autoreconf'
554
555      - name: 'configure'
556        run: |
557          [[ '${{ matrix.build.install_steps }}' = *'awslc'* ]] && sudo apt remove --yes libssl-dev
558          if [ -n '${{ matrix.build.PKG_CONFIG_PATH }}' ]; then
559            export PKG_CONFIG_PATH="${{ matrix.build.PKG_CONFIG_PATH }}"
560          fi
561          if [ -n '${{ matrix.build.generate }}' ]; then
562            cmake -B . -G Ninja \
563              -DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
564              -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
565              -DCURL_BROTLI=ON -DCURL_ZSTD=ON \
566              ${{ matrix.build.generate }}
567          else
568            ${{ matrix.build.configure-prefix }} \
569            ./configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
570              ${{ matrix.build.configure }}
571          fi
572
573      - name: 'configure log'
574        if: ${{ !cancelled() }}
575        run: cat config.log CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
576
577      - name: 'curl_config.h'
578        run: |
579          echo '::group::raw'; cat lib/curl_config.h || true; echo '::endgroup::'
580          grep -F '#define' lib/curl_config.h | sort || true
581
582      - name: 'test configs'
583        run: |
584          cat tests/config || true
585          cat tests/http/config.ini || true
586
587      - name: 'build'
588        run: |
589          if [ -n '${{ matrix.build.generate }}' ]; then
590            ${{ matrix.build.make-prefix }} cmake --build . --verbose
591          else
592            ${{ matrix.build.make-prefix }} make V=1
593          fi
594
595      - name: 'single-use function check'
596        if: ${{ contains(matrix.build.configure, '--disable-unity') || contains(matrix.build.generate, '-DCMAKE_UNITY_BUILD=OFF') }}
597        run: |
598          git config --global --add safe.directory "*"
599          if [ -n '${{ matrix.build.generate }}' ]; then
600            libcurla=lib/libcurl.a
601          else
602            libcurla=lib/.libs/libcurl.a
603          fi
604          ./scripts/singleuse.pl --unit ${libcurla}
605
606      - run: ./src/curl -V
607        name: 'check curl -V output'
608
609      - run: cmake --install . --prefix $HOME/curl --strip
610        if: ${{ matrix.build.generate }}
611        name: 'cmake install'
612
613      - name: 'build tests'
614        if: ${{ matrix.build.install_steps != 'skipall' }}
615        run: |
616          if [ -n '${{ matrix.build.generate }}' ]; then
617            cmake --build . --verbose --target testdeps
618          else
619            make V=1 -C tests
620          fi
621
622      - name: 'install test prereqs'
623        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.container == null }}
624        run: |
625          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
626          python3 -m pip install -r tests/requirements.txt
627
628      - name: 'run tests'
629        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }}
630        timeout-minutes: ${{ contains(matrix.build.install_packages, 'valgrind') && 30 || 15 }}
631        run: |
632          export TFLAGS='${{ matrix.build.tflags }}'
633          if [ -z '${{ matrix.build.torture }}' ]; then
634            if [[ '${{ matrix.build.install_packages }}' = *'valgrind'* ]]; then
635              TFLAGS+=' -j6'
636            fi
637            if [[ '${{ matrix.build.install_packages }}' = *'heimdal-dev'* ]]; then
638              TFLAGS+=' ~2077 ~2078'  # valgrind errors
639            fi
640          fi
641          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
642          if [ -n '${{ matrix.build.generate }}' ]; then
643            cmake --build . --verbose --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
644          else
645            make V=1 ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
646          fi
647
648      - name: 'install pytest prereqs'
649        if: contains(matrix.build.install_steps, 'pytest')
650        run: |
651          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
652          python3 -m pip install -r tests/http/requirements.txt
653
654      - name: 'run pytest'
655        if: contains(matrix.build.install_steps, 'pytest')
656        env:
657          TFLAGS: "${{ matrix.build.tflags }}"
658          CURL_CI: github
659        run: |
660          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
661          if [ -n '${{ matrix.build.generate }}' ]; then
662            cmake --build . --verbose --target curl-pytest-ci
663          else
664            make V=1 pytest-ci
665          fi
666
667      - name: 'build examples'
668        run: |
669          if [ -n '${{ matrix.build.generate }}' ]; then
670            ${{ matrix.build.make-prefix }} cmake --build . --verbose --target curl-examples
671          else
672            ${{ matrix.build.make-prefix }} make V=1 examples
673          fi
674