curl/.github/workflows/non-native.yml
Viktor Szakats e7adf3e837
cmake: add pre-fill for Unix, enable in GHA/macos, verify pre-fills
TL;DR: Save 10 minutes of CI time for GHA/macos jobs using pre-fills and
add pre-fill verification for Apple and Windows. Also restores Xcode job
and saves 1.5-10 minutes configuring iOS jobs.

Pre-filling feature detection results can bring down the CMake configure
step to ~5 seconds on most GHA runners, ~10 seconds in slow envs like
Cygwin/MSYS2.

The potential savings per job are:
- 5-40 (average 19) seconds on GHA/macos (33 jobs)
- ~10 seconds on GHA for iOS GNU Makefile (1 job)
- 1.5-10 minutes on GHA for iOS Xcode generator (1 job)
- 10 seconds on GHA/linux with native Ubuntu (12 jobs)
- 40 seconds for Cygwin/MSYS2 (2 jobs)
- 5-10 seconds for virtualized BSDs, native CPU (3 jobs)
- ~60 seconds for virtualized BSDs, emulated CPU (1 job)

On native Windows pre-filling has been in place for a long time and
saving 8 minutes (VS2019-VS2015) to 1.5-2 minutes (VS2022), 3 minutes
(VS2022 UWP), and 30-60 seconds (MinGW), per CI job.

The downside is that detection results need to be manually collected and
filtered to those that universally apply to all platforms that they are
enabled on. Another downside is that by using a cache, we're not running
the actual detections, and thus won't catch regressions in them. It
means we must make sure that the cache is solid and matches with actual
detections results. An upside is that it gives a rough overview of which
features are available on which platforms. Another upside is pre-filled
values do work for feature detections skipped for cross-builds, e.g.
`HAVE_WRITABLE_ARGV`.

This PR adds a pre-fill cache that supports all Unixes (except OmniOS)
used in CI, and makes it usable with an internal option. It also enables
it for GHA/macos CI jobs, where the maximum savings are. And also for
the two iOS [1] and two Cygwin/MSYS2 jobs. The latters don't have
pre-fill checks and we can drop them if they turn into a hassle.

Saving:
- 10 minutes of CI time per GHA/macos workflow run. [2]
- ~80 seconds per GHA/windows workflow run with Cygwin/MSYS2.
  (offsetting the cost of pre-fill verifications)
- 1.5-10 minutes per GHA/non-native runs with iOS jobs. [3]

You can enable pre-fill locally with `-D_CURL_PREFILL=ON`. It's
experimental, and if you experience a problem, file a PR or an Issue.

This PR also adds a pre-fill checker for macOS and MinGW/MSVC Windows
GHA jobs to catch if the cache diverges from real detections. It also
adds this logic to AppVeyor, but doesn't enable it due to the perf
penalty of 2 minutes mininum.

The pre-fill checker works by configuring out-of-tree with and without
pre-fill, then diffing their `lib/curl_config.h` outputs.

Exceptions are 3 detection results exposed indirectly [4], and missing
to expose 2, of which one is the C89 header `stddef.h`. While we assume
the C99 `stdint.h` available outside iOS. We can expose them in the
future, if necessary.

The pre-fill checks cost in total:
- ~20 seconds for macOS
- ~40 seconds for MinGW on GHA
- ~80 seconds for MSVC on GHA (UWP would be 2x this)

An extra time saving potential is caching type sizes. They are
well-known, and seldom change, esp. in CI. GHA/Windows jobs spend 8-17
seconds per job on these ~12 feature checks. ~5s on Cygwin/MSYS2. Couple
of seconds on other platforms. (This PR doesn't make this optimization.)

Another opportunity is doing the same for autotools, which typically
spends more time in the configuration step than cmake.

[1] Xcode job restored as a
follow-up to be5f20202c #16302

[2] GHA/macos cmake configure times in seconds:
Job                                              |  Bef. | After |  Gain
:----------------------------------------------- | ----: | ----: | ----:
CM clang GnuTLS !ldap krb5                       |  21.2 |   4.5 |  16.7
CM clang LibreSSL !ldap heimdal c-ares +examples |  13.3 |   3.9 |   9.4
CM clang OpenSSL +static libssh +examples        |  20.0 |   4.6 |  15.4
CM clang OpenSSL IDN clang-tidy~ (w/chkprefill)  |  15.7 |  18.6 |  -2.9
CM clang OpenSSL gsasl rtmp AppleIDN             |  25.0 |   4.7 |  20.3
CM clang OpenSSL torture !FTP                    |  15.3 |   4.5 |  10.8
CM clang OpenSSL torture FTP                     |  25.0 |   5.9 |  19.1
CM clang SecureTransport debug                   |  18.0 |   3.8 |  14.2
CM clang macos-13 SecureTransport                |  45.8 |  12.4 |  33.4
CM clang macos-14 SecureTransport                |  15.8 |   4.6 |  11.2
CM clang macos-15 SecureTransport                |  26.8 |   6.1 |  20.7
CM clang mbedTLS openldap brotli zstd            |  15.1 |   6.5 |   8.6
CM clang wolfSSL !ldap brotli zstd               |  27.0 |   4.4 |  22.6
CM gcc-12 GnuTLS !ldap krb5                      |  39.1 |   8.7 |  30.4
CM gcc-12 LibreSSL !ldap heimdal c-ares +examples|  23.8 |   7.2 |  16.6
CM gcc-12 OpenSSL +static libssh +examples       |  20.7 |   8.5 |  12.2
CM gcc-12 OpenSSL gsasl rtmp AppleIDN            |  23.1 |  10.1 |  13.0
CM gcc-12 SecureTransport debug                  |  21.1 |   4.8 |  16.3
CM gcc-12 mbedTLS openldap brotli zstd           |  21.4 |   5.8 |  15.6
CM gcc-12 wolfSSL !ldap brotli zstd              |  21.1 |   6.9 |  14.2
CM gcc-14 macos-13 SecureTransport               |  61.9 |  18.7 |  43.2
CM gcc-14 macos-14 SecureTransport               |  30.5 |   6.4 |  24.1
CM gcc-14 macos-15 SecureTransport               |  32.7 |   8.4 |  24.3
CM llvm@15 GnuTLS !ldap krb5                     |  21.1 |   7.5 |  13.6
CM llvm@15 LibreSSL !ldap heimdal c-ares +exampl~|  24.6 |   6.8 |  17.8
CM llvm@15 OpenSSL +static libssh +examples      |  19.0 |   6.4 |  12.6
CM llvm@15 OpenSSL gsasl rtmp AppleIDN           |  19.0 |   8.2 |  10.8
CM llvm@15 SecureTransport debug                 |  18.0 |   5.4 |  12.6
CM llvm@15 macos-13 SecureTransport              |  66.2 |  25.7 |  40.5
CM llvm@15 macos-14 SecureTransport              |  31.9 |   6.1 |  25.8
CM llvm@15 mbedTLS openldap brotli zstd          |  19.5 |   8.9 |  10.6
CM llvm@15 wolfSSL !ldap brotli zstd             |  24.3 |   5.9 |  18.4
CM llvm@18 macos-15 SecureTransport              |  33.8 |   6.4 |  27.4
Total                                            | 856.8 | 257.3 | 599.5
Before: https://github.com/curl/curl/actions/runs/13311042735/job/37173478424
After: https://github.com/curl/curl/actions/runs/13313927119/job/37183206426?pr=15841

[3] iOS:
Before: https://github.com/curl/curl/actions/runs/13326401704?pr=15841
After: https://github.com/curl/curl/actions/runs/13332177764?pr=15841

[4] detection results exposed indirectly in `curl_config.h`:
- `HAVE_FILE_OFFSET_BITS` via `_FILE_OFFSET_BITS`
- `HAVE_GETHOSTBYNAME_R_*_REENTRANT` via `NEED_REENTRANT`
- `HAVE_SOCKADDR_IN6_SIN6_ADDR` via `USE_IPV6`

Closes #15841
2025-02-16 01:59:59 +01:00

720 lines
30 KiB
YAML

# Copyright (C) Viktor Szakats
#
# SPDX-License-Identifier: curl
name: non-native
'on':
push:
branches:
- master
- '*/ci'
paths-ignore:
- '**/*.md'
- '.circleci/**'
- 'appveyor.*'
- 'packages/**'
- 'plan9/**'
- 'projects/**'
- 'winbuild/**'
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'
- '.circleci/**'
- 'appveyor.*'
- 'packages/**'
- 'plan9/**'
- 'projects/**'
- 'winbuild/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: {}
jobs:
netbsd:
name: 'NetBSD, CM clang openssl ${{ matrix.arch }}'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
arch: ['x86_64']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'cmake'
uses: cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d # v0.27.0
with:
operating_system: 'netbsd'
version: '10.1'
architecture: ${{ matrix.arch }}
run: |
# https://pkgsrc.se/
time sudo pkgin -y install cmake ninja-build pkg-config perl brotli heimdal openldap-client libssh2 libidn2 libpsl nghttp2 py311-impacket
time cmake -B bld -G Ninja \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DCURL_USE_OPENSSL=ON \
-DCURL_USE_GSSAPI=ON \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
bld/src/curl --disable --version
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
export TFLAGS='-j4'
time cmake --build bld --config Debug --target test-ci
fi
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
echo '::endgroup::'
openbsd:
name: 'OpenBSD, CM clang libressl ${{ matrix.arch }}'
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
arch: ['x86_64']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'cmake'
uses: cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d # v0.27.0
with:
operating_system: 'openbsd'
version: '7.5'
architecture: ${{ matrix.arch }}
run: |
# https://openbsd.app/
# https://www.openbsd.org/faq/faq15.html
time sudo pkg_add cmake ninja brotli openldap-client-- libssh2 libidn2 libpsl nghttp2 python3 py3-impacket
time cmake -B bld -G Ninja \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DCURL_USE_OPENSSL=ON \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
bld/src/curl --disable --version
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
export TFLAGS='-j8 ~3017 ~TFTP ~FTP' # FIXME: TFTP requests executed twice? Related: `curl: (69) TFTP: Access Violation`?
time cmake --build bld --config Debug --target test-ci
fi
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
echo '::endgroup::'
freebsd:
name: "FreeBSD, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} openssl${{ matrix.desc }} ${{ matrix.arch }}"
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
include:
- { build: 'autotools', arch: 'x86_64', compiler: 'clang' }
- { build: 'cmake' , arch: 'x86_64', compiler: 'clang', options: '-DCMAKE_UNITY_BUILD=OFF -DCURL_TEST_BUNDLES=OFF', desc: ' !unity !bundle !runtests !examples' }
- { build: 'autotools', arch: 'arm64', compiler: 'clang' }
- { build: 'cmake' , arch: 'arm64', compiler: 'clang' }
fail-fast: false
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'autotools'
if: ${{ matrix.build == 'autotools' }}
uses: cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d # v0.27.0
with:
operating_system: 'freebsd'
version: '14.1'
architecture: ${{ matrix.arch }}
run: |
# https://ports.freebsd.org/
time sudo pkg install -y autoconf automake libtool \
pkgconf brotli openldap26-client libidn2 libnghttp2 stunnel py311-impacket
time autoreconf -fi
export CC='${{ matrix.compiler }}'
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
--prefix="${HOME}"/install \
--with-openssl \
--with-brotli --enable-ldap --enable-ldaps --with-libidn2 --with-libssh2 --with-nghttp2 --with-gssapi \
--disable-dependency-tracking \
${{ matrix.options }} \
|| { tail -n 1000 config.log; false; }
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
time make -j3 install
src/curl --disable --version
desc='${{ matrix.desc }}'
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time make -j3 -C tests
if [ "${desc#*!runtests*}" = "${desc}" ]; then
time make test-ci V=1 TFLAGS='-j4'
fi
fi
if [ "${desc#*!examples*}" = "${desc}" ]; then
echo '::group::build examples'
time make -j3 examples
echo '::endgroup::'
fi
- name: 'cmake'
if: ${{ matrix.build == 'cmake' }}
uses: cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d # v0.27.0
with:
operating_system: 'freebsd'
version: '14.1'
architecture: ${{ matrix.arch }}
run: |
# https://ports.freebsd.org/
time sudo pkg install -y cmake-core ninja perl5 \
pkgconf brotli openldap26-client libidn2 libnghttp2 stunnel py311-impacket
time cmake -B bld -G Ninja \
-DCMAKE_C_COMPILER='${{ matrix.compiler }}' \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DCURL_USE_OPENSSL=ON \
-DCURL_USE_GSSAPI=ON \
${{ matrix.options }} \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
bld/src/curl --disable --version
desc='${{ matrix.desc }}'
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
if [ "${desc#*!runtests*}" = "${desc}" ]; then
time cmake --build bld --config Debug --target test-ci
fi
fi
if [ "${desc#*!examples*}" = "${desc}" ]; then
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
echo '::endgroup::'
fi
omnios:
name: 'OmniOS, AM gcc openssl amd64'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'autotools'
uses: vmactions/omnios-vm@8eba2a9217262f275d4566751a92d6ef2f433d00 # v1
with:
usesh: true
# https://pkg.omnios.org/r151052/core/en/index.shtml
prepare: pkg install build-essential libtool nghttp2
run: |
set -e
ln -s /usr/bin/gcpp /usr/bin/cpp # Some tests expect `cpp`, which is named `gcpp` in this env.
time autoreconf -fi
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
--prefix="${HOME}"/install \
--with-openssl \
--disable-dependency-tracking \
|| { tail -n 1000 config.log; false; }
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
time gmake -j3 install
src/curl --disable --version
time gmake -j3 -C tests
time gmake test-ci V=1
echo '::group::build examples'
time gmake -j3 examples
echo '::endgroup::'
ios:
name: "iOS, ${{ (matrix.build.generator && format('CM-{0}', matrix.build.generator)) || (matrix.build.generate && 'CM' || 'AM' )}} ${{ matrix.build.name }} arm64"
runs-on: 'macos-latest'
timeout-minutes: 10
env:
DEVELOPER_DIR: "/Applications/Xcode${{ matrix.build.xcode && format('_{0}', matrix.build.xcode) || '' }}.app/Contents/Developer"
CC: ${{ matrix.build.compiler || 'clang' }}
MAKEFLAGS: -j 4
# renovate: datasource=github-tags depName=libressl-portable/portable versioning=semver registryUrl=https://github.com
libressl-version: 4.0.0
strategy:
fail-fast: false
matrix:
build:
- name: 'libressl'
install_steps: libressl
configure: --with-openssl="$HOME/libressl" --without-libpsl
- name: 'libressl'
install_steps: libressl
# FIXME: Could not make OPENSSL_ROOT_DIR work. CMake seems to prepend sysroot to it.
generate: >-
-DOPENSSL_INCLUDE_DIR="$HOME/libressl/include"
-DOPENSSL_SSL_LIBRARY="$HOME/libressl/lib/libssl.a"
-DOPENSSL_CRYPTO_LIBRARY="$HOME/libressl/lib/libcrypto.a"
-DCURL_USE_LIBPSL=OFF
- name: 'libressl'
install_steps: libressl
generator: Xcode
generate: >-
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=OFF
-DMACOSX_BUNDLE_GUI_IDENTIFIER=se.curl
-DOPENSSL_INCLUDE_DIR="$HOME/libressl/include"
-DOPENSSL_SSL_LIBRARY="$HOME/libressl/lib/libssl.a"
-DOPENSSL_CRYPTO_LIBRARY="$HOME/libressl/lib/libcrypto.a"
-DCURL_USE_LIBPSL=OFF
steps:
- name: 'brew install'
if: ${{ matrix.build.configure }}
run: |
echo automake libtool | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
- name: 'toolchain versions'
run: |
which "${CC}"; "${CC}" --version || true
xcodebuild -version || true
xcodebuild -sdk -version | grep '^Path:' || true
xcrun --sdk iphoneos --show-sdk-path 2>/dev/null || true
xcrun --sdk iphoneos --show-sdk-version || true
echo '::group::macros predefined'; "${CC}" -dM -E - < /dev/null | sort || true; echo '::endgroup::'
echo '::group::brew packages installed'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
- name: 'cache libressl'
if: contains(matrix.build.install_steps, 'libressl')
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
id: cache-libressl
env:
cache-name: cache-libressl
with:
path: ~/libressl
key: iOS-${{ env.cache-name }}-${{ env.libressl-version }}
- name: 'build libressl'
if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
run: |
curl -LsSf --retry 6 --retry-connrefused --max-time 999 \
https://github.com/libressl/portable/releases/download/v${{ env.libressl-version }}/libressl-${{ env.libressl-version }}.tar.gz | tar -x
cd libressl-${{ env.libressl-version }}
# FIXME: on the 4.0.1 release, delete '-DHAVE_ENDIAN_H=0'
cmake . \
-DHAVE_ENDIAN_H=0 \
-DCMAKE_INSTALL_PREFIX="$HOME/libressl" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DBUILD_SHARED_LIBS=OFF \
-DLIBRESSL_APPS=OFF \
-DLIBRESSL_TESTS=OFF
cmake --build .
cmake --install . --verbose
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'autoreconf'
if: ${{ matrix.build.configure }}
run: autoreconf -fi
- name: 'configure'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-visionos-or-watchos
[ -n '${{ matrix.build.generator }}' ] && options='-G ${{ matrix.build.generator }}'
cmake -B bld -D_CURL_PREFILL=ON \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
-DCMAKE_SYSTEM_NAME=iOS \
-DUSE_APPLE_IDN=ON \
${{ matrix.build.generate }} ${options}
else
mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
--disable-dependency-tracking \
CFLAGS="-isysroot $(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null)" \
--host=aarch64-apple-darwin \
--with-apple-idn \
${{ matrix.build.configure }}
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --verbose
else
make -C bld V=1
fi
- name: 'curl info'
run: find . -type f \( -name curl -o -name '*.dylib' -o -name '*.a' \) -exec file '{}' \;
- name: 'build tests'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --target testdeps --verbose
else
make -C bld V=1 -C tests
fi
- name: 'build examples'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --target curl-examples --verbose
else
make -C bld examples V=1
fi
android:
name: "Android ${{ matrix.platform }}, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.name }} arm64"
runs-on: 'ubuntu-latest'
timeout-minutes: 25
env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
VCPKG_DISABLE_METRICS: '1'
MAKEFLAGS: -j 5
strategy:
matrix:
include:
- { build: 'autotools', platform: '21', name: "openssl", install: 'brotli zstd libpsl nghttp2 openssl libssh2',
options: '--with-openssl --with-brotli' }
- { build: 'cmake' , platform: '21', name: "openssl", install: 'brotli zstd libpsl nghttp2 openssl libssh2',
options: '-DCURL_USE_OPENSSL=ON' }
- { build: 'autotools', platform: '35', name: "openssl", install: 'brotli zstd libpsl nghttp2 openssl libssh2',
options: '--with-openssl --with-brotli' }
- { build: 'cmake' , platform: '35', name: "openssl", install: 'brotli zstd libpsl nghttp2 openssl libssh2',
options: '-DCURL_USE_OPENSSL=ON' }
# FIXME: Must disable zstd explicitly, otherwise cmake/pkg-config finds it in /usr/include
# and the build fails. I had found no option to disable this behavior. Other default
# dependencies not offered via vcpkg may also need this.
- { build: 'cmake' , platform: '35', name: "boringssl !zstd", install: 'libpsl boringssl',
options: '-DCURL_USE_OPENSSL=ON -DOPENSSL_USE_STATIC_LIBS=ON -DCURL_ZSTD=OFF' }
fail-fast: false
steps:
- name: 'vcpkg cache setup'
if: ${{ matrix.install }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: 'vcpkg versions'
if: ${{ matrix.install }}
timeout-minutes: 1
run: |
git -C "$VCPKG_INSTALLATION_ROOT" show --no-patch --format='%H %ai'
vcpkg version
- name: 'install prereqs for vcpkg'
if: contains(matrix.install, 'boringssl')
timeout-minutes: 5
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get -o Dpkg::Use-Pty=0 update
sudo apt-get -o Dpkg::Use-Pty=0 install nasm
- name: 'vcpkg build'
if: ${{ matrix.install }}
timeout-minutes: 20
run: vcpkg x-set-installed ${{ matrix.install }} '--triplet=arm64-android'
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'autoreconf'
if: ${{ matrix.build == 'autotools' }}
run: autoreconf -fi
- name: 'configure'
run: |
export PKG_CONFIG_PATH="$VCPKG_INSTALLATION_ROOT/installed/arm64-android/lib/pkgconfig"
if [ '${{ matrix.build }}' = 'cmake' ]; then # https://developer.android.com/ndk/guides/cmake
cmake -B bld \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM='android-${{ matrix.platform }}' \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake -DCMAKE_WARN_DEPRECATED=OFF \
-DVCPKG_INSTALLED_DIR="$VCPKG_INSTALLATION_ROOT/installed" \
-DVCPKG_TARGET_TRIPLET=arm64-android \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
${{ matrix.options }}
else
TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
CC="$TOOLCHAIN/bin/aarch64-linux-android${{ matrix.platform }}-clang" \
AR="$TOOLCHAIN/bin/llvm-ar" \
RANLIB="$TOOLCHAIN/bin/llvm-ranlib" \
--host=aarch64-linux-android${{ matrix.platform }} \
${{ matrix.options }}
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --verbose
else
make -j5 -C bld V=1
fi
- name: 'curl info'
run: find . -type f \( -name curl -o -name '*.so' -o -name '*.a' \) -exec file '{}' \;
- name: 'build tests'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
fi
- name: 'build examples'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
fi
amiga:
name: "AmigaOS, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} gcc AmiSSL m68k"
runs-on: 'ubuntu-latest'
timeout-minutes: 5
env:
amissl-version: 5.18
strategy:
matrix:
build: [autotools, cmake]
fail-fast: false
steps:
- name: 'install compiler'
if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
run: |
cd "${HOME}" || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location https://github.com/bebbo/amiga-gcc/releases/download/Mechen/amiga-gcc.tgz | tar -xz
cd opt/appveyor || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 \
--location https://github.com/jens-maus/amissl/releases/download/${{ env.amissl-version }}/AmiSSL-${{ env.amissl-version }}-SDK.lha --output bin.lha
7z x -bd -y bin.lha
rm -f bin.lha
mv "$HOME/opt/appveyor" /opt
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'configure'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake -B bld \
-DAMIGA=1 \
-DCMAKE_SYSTEM_NAME=Generic \
-DCMAKE_SYSTEM_PROCESSOR=m68k \
-DCMAKE_C_COMPILER_TARGET=m68k-unknown-amigaos \
-DCMAKE_C_COMPILER=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-gcc \
-DCMAKE_C_FLAGS='-O0 -msoft-float -mcrt=clib2' \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DCURL_USE_LIBPSL=OFF \
-DAMISSL_INCLUDE_DIR=/opt/appveyor/AmiSSL/Developer/include \
-DAMISSL_STUBS_LIBRARY=/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3/libamisslstubs.a \
-DAMISSL_AUTO_LIBRARY=/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3/libamisslauto.a
else
autoreconf -fi
mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
CC=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-gcc \
AR=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-ar \
RANLIB=/opt/appveyor/build-agent/opt/amiga/bin/m68k-amigaos-ranlib \
--host=m68k-amigaos \
--disable-shared \
--without-libpsl \
--with-amissl \
LDFLAGS=-L/opt/appveyor/AmiSSL/Developer/lib/AmigaOS3 \
CPPFLAGS=-I/opt/appveyor/AmiSSL/Developer/include \
CFLAGS='-O0 -msoft-float -mcrt=clib2' \
LIBS='-lnet -lm -latomic'
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5
else
make -j5 -C bld
fi
- name: 'curl info'
run: find . -type f \( -name curl -o -name '*.a' \) -exec file '{}' \;
- name: 'build tests'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target testdeps
else
make -j5 -C bld -C tests
fi
- name: 'build examples'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target curl-examples
else
make -j5 -C bld examples
fi
msdos:
name: "MS-DOS, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} djgpp openssl i586"
runs-on: 'ubuntu-latest'
timeout-minutes: 5
env:
toolchain-version: '3.4'
strategy:
matrix:
build: [autotools, cmake]
fail-fast: false
steps:
- name: 'install packages'
run: sudo apt-get -o Dpkg::Use-Pty=0 install libfl2 ${{ matrix.build == 'cmake' && 'ninja-build' || '' }}
- name: 'cache compiler (djgpp)'
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
id: cache-compiler
with:
path: ~/djgpp
key: ${{ runner.os }}-djgpp-${{ env.toolchain-version }}-amd64
- name: 'install compiler (djgpp)'
if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
run: |
cd "${HOME}" || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 \
--location 'https://github.com/andrewwutw/build-djgpp/releases/download/v${{ env.toolchain-version }}/djgpp-linux64-gcc1220.tar.bz2' | tar -xj
cd djgpp || exit 1
for f in wat3211b.zip zlb13b.zip ssl102ub.zip; do
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 \
"https://www.delorie.com/pub/djgpp/current/v2tk/$f" --output bin.zip
unzip -q bin.zip
rm -f bin.zip
done
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
- name: 'configure'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake -B bld -G Ninja \
-DCMAKE_SYSTEM_NAME=DOS \
-DCMAKE_SYSTEM_PROCESSOR=x86 \
-DCMAKE_C_COMPILER_TARGET=i586-pc-msdosdjgpp \
-DCMAKE_C_COMPILER="$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc" \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DCURL_USE_LIBPSL=OFF \
-DOPENSSL_INCLUDE_DIR="$HOME/djgpp/include" \
-DOPENSSL_SSL_LIBRARY="$HOME/djgpp/lib/libssl.a" \
-DOPENSSL_CRYPTO_LIBRARY="$HOME/djgpp/lib/libcrypto.a" \
-DZLIB_INCLUDE_DIR="$HOME/djgpp/include" \
-DZLIB_LIBRARY="$HOME/djgpp/lib/libz.a" \
-DWATT_ROOT="$HOME/djgpp/net/watt"
else
autoreconf -fi
mkdir bld && cd bld && ../configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
CC="$HOME/djgpp/bin/i586-pc-msdosdjgpp-gcc" \
AR="$HOME/djgpp/bin/i586-pc-msdosdjgpp-ar" \
RANLIB="$HOME/djgpp/bin/i586-pc-msdosdjgpp-ranlib" \
WATT_ROOT="$HOME/djgpp/net/watt" \
--host=i586-pc-msdosdjgpp \
--with-openssl="$HOME/djgpp" \
--with-zlib="$HOME/djgpp" \
--without-libpsl \
--disable-shared
fi
- name: 'configure log'
if: ${{ !cancelled() }}
run: cat bld/config.log bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
run: |
echo '::group::raw'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld
else
make -j5 -C bld
fi
- name: 'curl info'
run: find . \( -name '*.exe' -o -name '*.a' \) -exec file '{}' \;
- name: 'build tests'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
fi
- name: 'build examples'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
fi