xref: /curl/.github/workflows/linux.yml (revision 770702fa)
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.37.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-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
144
145          - name: awslc
146            install_packages: zlib1g-dev
147            install_steps: awslc
148            generate: -DOPENSSL_ROOT_DIR=$HOME/awslc -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 -e '!TLS-SRP'
252
253          - name: rustls valgrind
254            install_packages: valgrind
255            install_steps: rust rustls pytest
256            configure: --with-rustls=$HOME/rustls --enable-debug
257
258          - name: rustls
259            install_steps: rust rustls skipall
260            PKG_CONFIG_PATH: '$HOME/rustls/lib/pkgconfig'  # Not built as of v0.14.0
261            generate: -DCURL_USE_RUSTLS=ON -DRUSTLS_INCLUDE_DIR=$HOME/rustls/include -DRUSTLS_LIBRARY=$HOME/rustls/lib/librustls.a -DENABLE_DEBUG=ON
262
263          - name: IntelC openssl
264            install_packages: zlib1g-dev libssl-dev
265            install_steps: intel
266            configure: CC=icc --enable-debug --with-openssl
267
268          - name: Slackware openssl gssapi gcc
269            # These are essentially the same flags used to build the curl Slackware package
270            # https://ftpmirror.infania.net/slackware/slackware64-current/source/n/curl/curl.SlackBuild
271            configure: --with-openssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs
272            # Docker Hub image that `container-job` executes in
273            container: 'andy5995/slackware-build-essential:15.0'
274
275          - name: Alpine MUSL
276            configure: --enable-debug --with-ssl --with-libssh2 --with-libidn2 --with-gssapi --enable-ldap --with-libpsl
277            container: 'alpine:3.18'
278
279    steps:
280      - if: matrix.build.container == null && !contains(matrix.build.name, 'i686')
281        run: |
282          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
283          sudo apt-get update -y
284          sudo apt-get install -y --no-install-suggests --no-install-recommends \
285            libtool autoconf automake pkgconf ninja-build stunnel4 \
286            libpsl-dev libbrotli-dev libzstd-dev \
287            ${{ matrix.build.install_packages }}
288        name: 'install prereqs'
289
290      - if: contains(matrix.build.name, 'i686')
291        run: |
292          sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
293          sudo dpkg --add-architecture i386
294          sudo apt-get update -y
295          sudo apt-get install -y --no-install-suggests --no-install-recommends \
296            libtool autoconf automake pkgconf stunnel4 \
297            libpsl-dev:i386 libbrotli-dev:i386 libzstd-dev:i386 \
298            ${{ matrix.build.install_packages }}
299        name: 'install prereqs'
300
301      - if: contains(matrix.build.install_steps, 'pytest')
302        run: |
303          sudo apt-get install -y --no-install-suggests --no-install-recommends \
304            apache2 apache2-dev libnghttp2-dev vsftpd
305        name: 'install prereqs for pytest'
306
307      - if: startsWith(matrix.build.container, 'alpine')
308        run: |
309          apk add --no-cache build-base autoconf automake libtool perl openssl-dev libssh2-dev \
310            zlib-dev brotli-dev zstd-dev libidn2-dev openldap-dev heimdal-dev libpsl-dev \
311            py3-impacket py3-asn1 py3-six py3-pycryptodomex \
312            perl-time-hires openssh stunnel sudo git
313        name: 'install dependencies'
314
315      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
316
317      - name: 'Fix kernel mmap rnd bits'
318        # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
319        # high-entropy ASLR in much newer kernels that GitHub runners are
320        # using leading to random crashes: https://reviews.llvm.org/D148280
321        # See https://github.com/actions/runner-images/issues/9491
322        continue-on-error: true
323        run: sudo sysctl vm.mmap_rnd_bits=28
324
325      - name: 'cache bearssl'
326        if: contains(matrix.build.install_steps, 'bearssl')
327        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
328        id: cache-bearssl
329        env:
330          cache-name: cache-bearssl
331        with:
332          path: /home/runner/bearssl
333          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.bearssl-version }}
334
335      - name: 'build bearssl'
336        if: contains(matrix.build.install_steps, 'bearssl') && steps.cache-bearssl.outputs.cache-hit != 'true'
337        run: |
338          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://bearssl.org/bearssl-${{ env.bearssl-version }}.tar.gz
339          tar -xzf bearssl-${{ env.bearssl-version }}.tar.gz
340          cd bearssl-${{ env.bearssl-version }}
341          make
342          mkdir -p $HOME/bearssl/lib $HOME/bearssl/include
343          cp inc/*.h $HOME/bearssl/include
344          cp build/libbearssl.* $HOME/bearssl/lib
345
346      - name: 'cache libressl'
347        if: contains(matrix.build.install_steps, 'libressl')
348        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
349        id: cache-libressl
350        env:
351          cache-name: cache-libressl
352        with:
353          path: /home/runner/libressl
354          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.libressl-version }}
355
356      - name: 'build libressl'
357        if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
358        run: |
359          git clone --quiet --depth=1 -b v${{ env.libressl-version }} https://github.com/libressl-portable/portable.git libressl-git
360          cd libressl-git
361          ./autogen.sh
362          ./configure --disable-dependency-tracking --prefix=$HOME/libressl
363          make install
364
365      - name: 'cache wolfssl (all)'
366        if: contains(matrix.build.install_steps, 'wolfssl-all')
367        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
368        id: cache-wolfssl-all
369        env:
370          cache-name: cache-wolfssl-all
371        with:
372          path: /home/runner/wolfssl-all
373          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
374
375      - name: 'build wolfssl (all)'
376        if: contains(matrix.build.install_steps, 'wolfssl-all') && steps.cache-wolfssl-all.outputs.cache-hit != 'true'
377        run: |
378          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssl/archive/v${{ env.wolfssl-version }}-stable.tar.gz
379          tar -xzf v${{ env.wolfssl-version }}-stable.tar.gz
380          cd wolfssl-${{ env.wolfssl-version }}-stable
381          ./autogen.sh
382          ./configure --disable-dependency-tracking --enable-tls13 --enable-harden --prefix=$HOME/wolfssl-all --enable-all
383          make install
384
385      - name: 'cache wolfssl (opensslextra)'
386        if: contains(matrix.build.install_steps, 'wolfssl-opensslextra')
387        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
388        id: cache-wolfssl-opensslextra
389        env:
390          cache-name: cache-wolfssl-opensslextra
391        with:
392          path: /home/runner/wolfssl-opensslextra
393          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
394
395      - name: 'build wolfssl (opensslextra)'
396        if: contains(matrix.build.install_steps, 'wolfssl-opensslextra') && steps.cache-wolfssl-opensslextra.outputs.cache-hit != 'true'
397        run: |
398          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssl/archive/v${{ env.wolfssl-version }}-stable.tar.gz
399          tar -xzf v${{ env.wolfssl-version }}-stable.tar.gz
400          cd wolfssl-${{ env.wolfssl-version }}-stable
401          ./autogen.sh
402          ./configure --disable-dependency-tracking --enable-tls13 --enable-harden --prefix=$HOME/wolfssl-opensslextra --enable-opensslextra
403          make install
404
405      - name: 'cache mbedtls'
406        if: contains(matrix.build.install_steps, 'mbedtls')
407        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
408        id: cache-mbedtls
409        env:
410          cache-name: cache-mbedtls
411        with:
412          path: /home/runner/mbedtls
413          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mbedtls-version }}
414
415      - name: 'build mbedtls'
416        if: contains(matrix.build.install_steps, 'mbedtls') && steps.cache-mbedtls.outputs.cache-hit != 'true'
417        run: |
418          git clone --quiet --depth=1 -b v${{ env.mbedtls-version }} https://github.com/Mbed-TLS/mbedtls
419          cd mbedtls
420          git submodule update --init --depth=1
421          cmake -B . -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=$HOME/mbedtls \
422            -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF
423          cmake --build .
424          cmake --install .
425
426      - name: 'cache openssl (thread sanitizer)'
427        if: contains(matrix.build.install_steps, 'openssl-tsan')
428        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
429        id: cache-openssl-tsan
430        env:
431          cache-name: cache-openssl-tsan
432        with:
433          path: /home/runner/openssl
434          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl-version }}
435
436      - name: 'build openssl (thread sanitizer)'
437        if: contains(matrix.build.install_steps, 'openssl-tsan') && steps.cache-openssl-tsan.outputs.cache-hit != 'true'
438        run: |
439          git clone --quiet --depth=1 -b openssl-${{ env.openssl-version }} https://github.com/openssl/openssl
440          cd openssl
441          CC="clang" CFLAGS="-fsanitize=thread" LDFLAGS="-fsanitize=thread" ./config --prefix=$HOME/openssl --libdir=lib
442          make -j1 install_sw
443
444      - name: 'cache quictls'
445        if: contains(matrix.build.install_steps, 'quictls')
446        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
447        id: cache-quictls
448        env:
449          cache-name: cache-quictls
450        with:
451          path: /home/runner/quictls
452          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.quictls-version }}-quic1
453
454      - name: 'build quictls'
455        if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
456        run: |
457          git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }}-quic1 https://github.com/quictls/openssl
458          cd openssl
459          ./config --prefix=$HOME/quictls --libdir=lib
460          make -j1 install_sw
461
462      - name: 'cache msh3'
463        if: contains(matrix.build.install_steps, 'msh3')
464        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
465        id: cache-msh3
466        env:
467          cache-name: cache-msh3
468        with:
469          path: /home/runner/msh3
470          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.msh3-version }}
471
472      - name: 'build msh3'
473        if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
474        run: |
475          git clone --quiet --depth=1 -b v${{ env.msh3-version }} --recursive https://github.com/nibanks/msh3
476          cd msh3
477          cmake -B . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3
478          cmake --build .
479          cmake --install .
480
481      - name: 'cache awslc'
482        if: contains(matrix.build.install_steps, 'awslc')
483        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
484        id: cache-awslc
485        env:
486          cache-name: cache-awslc
487        with:
488          path: /home/runner/awslc
489          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.awslc-version }}
490
491      - name: 'build awslc'
492        if: contains(matrix.build.install_steps, 'awslc') && steps.cache-awslc.outputs.cache-hit != 'true'
493        run: |
494          curl -LOsSf --retry 6 --retry-connrefused --max-time 999 \
495            https://github.com/awslabs/aws-lc/archive/refs/tags/v${{ env.awslc-version }}.tar.gz
496          tar xzf v${{ env.awslc-version }}.tar.gz
497          mkdir aws-lc-${{ env.awslc-version }}-build
498          cd aws-lc-${{ env.awslc-version }}-build
499          cmake -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/awslc ../aws-lc-${{ env.awslc-version }}
500          cmake --build .
501          cmake --install .
502
503      - name: 'cache rustls'
504        if: contains(matrix.build.install_steps, 'rustls')
505        uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
506        id: cache-rustls
507        env:
508          cache-name: cache-rustls
509        with:
510          path: /home/runner/rustls
511          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.rustls-version }}
512
513      - name: 'install rust'
514        if: contains(matrix.build.install_steps, 'rust') && steps.cache-rustls.outputs.cache-hit != 'true'
515        run: |
516          cd $HOME
517          curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
518          source $HOME/.cargo/env
519          rustup toolchain install nightly
520
521      - name: 'build rustls'
522        if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
523        run: |
524          git clone --quiet --depth=1 -b v${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
525          cd rustls-ffi
526          make DESTDIR=$HOME/rustls install
527
528      - if: contains(matrix.build.install_steps, 'intel')
529        run: |
530          cd /tmp
531          curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
532          sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
533          sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
534          source /opt/intel/oneapi/setvars.sh
535          printenv >> $GITHUB_ENV
536        name: 'install Intel compilers'
537
538      - run: autoreconf -fi
539        if: ${{ matrix.build.configure }}
540        name: 'autoreconf'
541
542      - name: 'configure'
543        run: |
544          [[ '${{ matrix.build.install_steps }}' = *'awslc'* ]] && sudo apt remove --yes libssl-dev
545          if [ -n '${{ matrix.build.PKG_CONFIG_PATH }}' ]; then
546            export PKG_CONFIG_PATH="${{ matrix.build.PKG_CONFIG_PATH }}"
547          fi
548          if [ -n '${{ matrix.build.generate }}' ]; then
549            cmake -B . -G Ninja \
550              -DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
551              -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
552              -DCURL_BROTLI=ON -DCURL_ZSTD=ON \
553              ${{ matrix.build.generate }}
554          else
555            ${{ matrix.build.configure-prefix }} \
556            ./configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
557              ${{ matrix.build.configure }}
558          fi
559
560      - name: 'configure log'
561        if: ${{ !cancelled() }}
562        run: cat config.log CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
563
564      - name: 'curl_config.h'
565        run: |
566          echo '::group::raw'; cat lib/curl_config.h || true; echo '::endgroup::'
567          grep -F '#define' lib/curl_config.h | sort || true
568
569      - name: 'test configs'
570        run: |
571          cat tests/config || true
572          cat tests/http/config.ini || true
573
574      - name: 'build'
575        run: |
576          if [ -n '${{ matrix.build.generate }}' ]; then
577            ${{ matrix.build.make-prefix }} cmake --build . --verbose
578          else
579            ${{ matrix.build.make-prefix }} make V=1
580          fi
581
582      - name: 'single-use function check'
583        if: ${{ contains(matrix.build.configure, '--disable-unity') || contains(matrix.build.generate, '-DCMAKE_UNITY_BUILD=OFF') }}
584        run: |
585          git config --global --add safe.directory "*"
586          if [ -n '${{ matrix.build.generate }}' ]; then
587            libcurla=lib/libcurl.a
588          else
589            libcurla=lib/.libs/libcurl.a
590          fi
591          ./scripts/singleuse.pl --unit ${libcurla}
592
593      - run: ./src/curl -V
594        name: 'check curl -V output'
595
596      - run: cmake --install . --prefix $HOME/curl --strip
597        if: ${{ matrix.build.generate }}
598        name: 'cmake install'
599
600      - name: 'build tests'
601        if: ${{ matrix.build.install_steps != 'skipall' }}
602        run: |
603          if [ -n '${{ matrix.build.generate }}' ]; then
604            cmake --build . --verbose --target testdeps
605          else
606            make V=1 -C tests
607          fi
608
609      - name: 'install test prereqs'
610        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.container == null }}
611        run: |
612          sudo python3 -m pip install --break-system-packages -r tests/requirements.txt
613
614      - name: 'run tests'
615        if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }}
616        timeout-minutes: ${{ contains(matrix.build.install_packages, 'valgrind') && 30 || 15 }}
617        run: |
618          export TFLAGS='${{ matrix.build.tflags }}'
619          if [ -z '${{ matrix.build.torture }}' ]; then
620            if [[ '${{ matrix.build.install_packages }}' = *'valgrind'* ]]; then
621              TFLAGS+=' -j6'
622            fi
623            if [[ '${{ matrix.build.install_packages }}' = *'heimdal-dev'* ]]; then
624              TFLAGS+=' ~2077 ~2078'  # valgrind errors
625            fi
626          fi
627          if [ -n '${{ matrix.build.generate }}' ]; then
628            cmake --build . --verbose --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
629          else
630            make V=1 ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
631          fi
632
633      - name: 'install pytest prereqs'
634        if: contains(matrix.build.install_steps, 'pytest')
635        run: |
636          sudo python3 -m pip install --break-system-packages -r tests/http/requirements.txt
637
638      - name: 'run pytest'
639        if: contains(matrix.build.install_steps, 'pytest')
640        env:
641          TFLAGS: "${{ matrix.build.tflags }}"
642          CURL_CI: github
643        run: |
644          if [ -n '${{ matrix.build.generate }}' ]; then
645            cmake --build . --verbose --target curl-pytest-ci
646          else
647            make V=1 pytest-ci
648          fi
649
650      - name: 'build examples'
651        run: |
652          if [ -n '${{ matrix.build.generate }}' ]; then
653            ${{ matrix.build.make-prefix }} cmake --build . --verbose --target curl-examples
654          else
655            ${{ matrix.build.make-prefix }} make V=1 examples
656          fi
657