xref: /curl/.github/workflows/linux.yml (revision 1da198d1)
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 -j1 install_sw
454
455      - name: 'cache quictls'
456        if: contains(matrix.build.install_steps, 'quictls')
457        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
458        id: cache-quictls
459        env:
460          cache-name: cache-quictls
461        with:
462          path: /home/runner/quictls
463          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.quictls-version }}-quic1
464
465      - name: 'build quictls'
466        if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
467        run: |
468          git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }}-quic1 https://github.com/quictls/openssl
469          cd openssl
470          ./config --prefix=$HOME/quictls --libdir=lib no-makedepend no-apps no-docs no-tests
471          make -j1 install_sw
472
473      - name: 'cache msh3'
474        if: contains(matrix.build.install_steps, 'msh3')
475        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
476        id: cache-msh3
477        env:
478          cache-name: cache-msh3
479        with:
480          path: /home/runner/msh3
481          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.msh3-version }}
482
483      - name: 'build msh3'
484        if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
485        run: |
486          git clone --quiet --depth=1 -b v${{ env.msh3-version }} --recursive https://github.com/nibanks/msh3
487          cd msh3
488          cmake -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3
489          cmake --build .
490          cmake --install .
491
492      - name: 'cache awslc'
493        if: contains(matrix.build.install_steps, 'awslc')
494        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
495        id: cache-awslc
496        env:
497          cache-name: cache-awslc
498        with:
499          path: /home/runner/awslc
500          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.awslc-version }}
501
502      - name: 'build awslc'
503        if: contains(matrix.build.install_steps, 'awslc') && steps.cache-awslc.outputs.cache-hit != 'true'
504        run: |
505          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 \
506            https://github.com/awslabs/aws-lc/archive/refs/tags/v${{ env.awslc-version }}.tar.gz
507          tar xzf v${{ env.awslc-version }}.tar.gz
508          mkdir aws-lc-${{ env.awslc-version }}-build
509          cd aws-lc-${{ env.awslc-version }}-build
510          cmake -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/awslc ../aws-lc-${{ env.awslc-version }} -DBUILD_TOOL=OFF -DBUILD_TESTING=OFF
511          cmake --build .
512          cmake --install .
513
514      - name: 'cache rustls'
515        if: contains(matrix.build.install_steps, 'rustls')
516        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
517        id: cache-rustls
518        env:
519          cache-name: cache-rustls
520        with:
521          path: /home/runner/rustls
522          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.rustls-version }}
523
524      - name: 'install rust'
525        if: contains(matrix.build.install_steps, 'rust') && steps.cache-rustls.outputs.cache-hit != 'true'
526        run: |
527          cd $HOME
528          curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
529          source $HOME/.cargo/env
530          rustup toolchain install nightly
531
532      - name: 'build rustls'
533        if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
534        run: |
535          git clone --quiet --depth=1 -b v${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
536          cd rustls-ffi
537          make DESTDIR=$HOME/rustls install
538
539      - if: contains(matrix.build.install_steps, 'intel')
540        run: |
541          cd /tmp
542          curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
543          sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
544          sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
545          source /opt/intel/oneapi/setvars.sh
546          printenv >> $GITHUB_ENV
547        name: 'install Intel compilers'
548
549      - run: autoreconf -fi
550        if: ${{ matrix.build.configure }}
551        name: 'autoreconf'
552
553      - name: 'configure'
554        run: |
555          [[ '${{ matrix.build.install_steps }}' = *'awslc'* ]] && sudo apt remove --yes libssl-dev
556          if [ -n '${{ matrix.build.PKG_CONFIG_PATH }}' ]; then
557            export PKG_CONFIG_PATH="${{ matrix.build.PKG_CONFIG_PATH }}"
558          fi
559          if [ -n '${{ matrix.build.generate }}' ]; then
560            cmake -B . -G Ninja \
561              -DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
562              -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
563              -DCURL_BROTLI=ON -DCURL_ZSTD=ON \
564              ${{ matrix.build.generate }}
565          else
566            ${{ matrix.build.configure-prefix }} \
567            ./configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
568              ${{ matrix.build.configure }}
569          fi
570
571      - name: 'configure log'
572        if: ${{ !cancelled() }}
573        run: cat config.log CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
574
575      - name: 'curl_config.h'
576        run: |
577          echo '::group::raw'; cat lib/curl_config.h || true; echo '::endgroup::'
578          grep -F '#define' lib/curl_config.h | sort || true
579
580      - name: 'test configs'
581        run: |
582          cat tests/config || true
583          cat tests/http/config.ini || true
584
585      - name: 'build'
586        run: |
587          if [ -n '${{ matrix.build.generate }}' ]; then
588            ${{ matrix.build.make-prefix }} cmake --build . --verbose
589          else
590            ${{ matrix.build.make-prefix }} make V=1
591          fi
592
593      - name: 'single-use function check'
594        if: ${{ contains(matrix.build.configure, '--disable-unity') || contains(matrix.build.generate, '-DCMAKE_UNITY_BUILD=OFF') }}
595        run: |
596          git config --global --add safe.directory "*"
597          if [ -n '${{ matrix.build.generate }}' ]; then
598            libcurla=lib/libcurl.a
599          else
600            libcurla=lib/.libs/libcurl.a
601          fi
602          ./scripts/singleuse.pl --unit ${libcurla}
603
604      - run: ./src/curl -V
605        name: 'check curl -V output'
606
607      - run: cmake --install . --prefix $HOME/curl --strip
608        if: ${{ matrix.build.generate }}
609        name: 'cmake install'
610
611      - name: 'build tests'
612        if: ${{ matrix.build.install_steps != 'skipall' }}
613        run: |
614          if [ -n '${{ matrix.build.generate }}' ]; then
615            cmake --build . --verbose --target testdeps
616          else
617            make V=1 -C tests
618          fi
619
620      - name: 'install test prereqs'
621        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.container == null }}
622        run: |
623          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
624          python3 -m pip install -r tests/requirements.txt
625
626      - name: 'run tests'
627        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }}
628        timeout-minutes: ${{ contains(matrix.build.install_packages, 'valgrind') && 30 || 15 }}
629        run: |
630          export TFLAGS='${{ matrix.build.tflags }}'
631          if [ -z '${{ matrix.build.torture }}' ]; then
632            if [[ '${{ matrix.build.install_packages }}' = *'valgrind'* ]]; then
633              TFLAGS+=' -j6'
634            fi
635            if [[ '${{ matrix.build.install_packages }}' = *'heimdal-dev'* ]]; then
636              TFLAGS+=' ~2077 ~2078'  # valgrind errors
637            fi
638          fi
639          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
640          if [ -n '${{ matrix.build.generate }}' ]; then
641            cmake --build . --verbose --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
642          else
643            make V=1 ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
644          fi
645
646      - name: 'install pytest prereqs'
647        if: contains(matrix.build.install_steps, 'pytest')
648        run: |
649          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
650          python3 -m pip install -r tests/http/requirements.txt
651
652      - name: 'run pytest'
653        if: contains(matrix.build.install_steps, 'pytest')
654        env:
655          TFLAGS: "${{ matrix.build.tflags }}"
656          CURL_CI: github
657        run: |
658          [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
659          if [ -n '${{ matrix.build.generate }}' ]; then
660            cmake --build . --verbose --target curl-pytest-ci
661          else
662            make V=1 pytest-ci
663          fi
664
665      - name: 'build examples'
666        run: |
667          if [ -n '${{ matrix.build.generate }}' ]; then
668            ${{ matrix.build.make-prefix }} cmake --build . --verbose --target curl-examples
669          else
670            ${{ matrix.build.make-prefix }} make V=1 examples
671          fi
672