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