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