curl/.github/workflows/cygwin.yml
Viktor Szakats 60c3d04465
autotools: add support for 'unity' builds, enable in CI
Implement the "unity" builds as known from CMake, but for autotools.
It's limited to `lib` and `src` (CMake also supports it in `tests`).

Enable with: `--enable-unity` (disabled by default)

Unity builds speed up builds significantly. Cygwin and Windows builds in
particular, but the effect is noticeable on most systems. It also allows
discovering unity issues with autotools, benefitting also CMake when
building the same combination. In CI it makes turnaround times quicker.

This closes build performance with CMake. autotools still lags behind
because it builds shared and static libcurl in two, separate passes.
CMake does it in one. Manpage compilation isn't batched, it is in CMake.
After unity and test bundle support the slowest parts of the build are
the configuration phase (which is effectively a tedious, non-parallel,
compilation and/or linking of 300+ tiny programs. The next bottleneck
is compiling individual examples and finally test servers (only slow
with autotools).

The autotools implementation is slightly less efficient than CMake,
because 3 sources are permanently excluded while in CMake this isn't
necessary and solved more efficiently while building libtests. There is
also no 'unity' support for tests, making them a less efficient also.

Enable it in CI for most `configure` jobs. Except in GHA/dist (though
it works fine there too), to use the default config there. Also skip for
the Linux AWC-LC job where it made builds time a few seconds longer
(reason undiscovered.)

Autotools test suite builds compared between master -> `--enable-unity`:
- GHA/Linux: 32s -> 12s
  https://github.com/curl/curl/actions/runs/10705668823/job/29681617374
  https://github.com/curl/curl/actions/runs/10742978889/job/29796766297
- GHA/macOS: 37s -> 10s
  https://github.com/curl/curl/actions/runs/10705668813/job/29681632885
  https://github.com/curl/curl/actions/runs/10742978699/job/29796768875
- GHA/FreeBSD: 15m25 -> 10m58 (full workflow time, ~qemu)
  https://github.com/curl/curl/actions/runs/10705668811/job/29681607915
  https://github.com/curl/curl/actions/runs/10742978937/job/29796766115
- GHA/Cygwin: 3m32 -> 1m21
  https://github.com/curl/curl/actions/runs/10705668809/job/29681609965
  https://github.com/curl/curl/actions/runs/10742978645/job/29796756933
- GHA/MSYS2: 2m42 -> 50s
  https://github.com/curl/curl/actions/runs/10705668808/job/29681621166
  https://github.com/curl/curl/actions/runs/10742978662/job/29799739289
- GHA/mingw-w64: 5m32 -> 1m23
  https://github.com/curl/curl/actions/runs/10705668808/job/29681628787
  https://github.com/curl/curl/actions/runs/10742978662/job/29799741568

Closes #14815
2024-09-20 23:53:33 +02:00

193 lines
6.3 KiB
YAML

# Copyright (C) Viktor Szakats
#
# SPDX-License-Identifier: curl
name: Cygwin
'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:
cygwin:
name: "cygwin, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.platform }} ${{ matrix.name }}"
runs-on: windows-latest
timeout-minutes: 45
defaults:
run:
shell: C:\cygwin\bin\bash.exe '{0}'
env:
SHELLOPTS: 'igncr'
strategy:
matrix:
include:
- { build: 'automake', platform: 'x86_64', tflags: '' , config: '--enable-debug --disable-threaded-resolver', name: 'openssl' }
- { build: 'cmake' , platform: 'x86_64', tflags: 'skiprun', config: '-DCURL_USE_OPENSSL=ON', name: 'openssl R' }
fail-fast: false
steps:
- run: git config --global core.autocrlf input
shell: pwsh
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4
with:
platform: ${{ matrix.platform }}
site: https://mirrors.kernel.org/sourceware/cygwin/
# https://cygwin.com/cgi-bin2/package-grep.cgi
packages: >-
autoconf libtool gcc-core gcc-g++ binutils
${{ matrix.build }} make ninja
openssh
libssl-devel
libssh2-devel
libpsl-devel
zlib-devel
libbrotli-devel
libnghttp2-devel
- name: 'autotools autoreconf'
if: ${{ matrix.build == 'automake' }}
timeout-minutes: 2
run: autoreconf -fi
- name: 'autotools configure'
if: ${{ matrix.build == 'automake' }}
timeout-minutes: 5
run: |
PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
mkdir bld && cd bld && ../configure --enable-unity --enable-warnings --enable-werror \
--prefix="${HOME}"/install \
--enable-websockets \
--with-openssl \
--with-libssh2 \
--disable-dependency-tracking \
${{ matrix.config }}
- name: 'autotools configure log'
if: ${{ matrix.build == 'automake' && !cancelled() }}
run: cat bld/config.log 2>/dev/null || true
- name: 'curl_config.h'
if: ${{ matrix.build == 'automake' }}
run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
- name: 'curl_config.h (full)'
if: ${{ matrix.build == 'automake' }}
run: cat bld/lib/curl_config.h || true
- name: 'autotools build'
if: ${{ matrix.build == 'automake' }}
timeout-minutes: 10
run: make -C bld -j5 V=1 install
- name: 'curl version'
if: ${{ matrix.build == 'automake' }}
timeout-minutes: 1
run: |
find . -name '*.exe' -o -name '*.dll'
bld/src/curl.exe --disable --version
- name: 'autotools build tests'
if: ${{ matrix.build == 'automake' && matrix.tflags != 'skipall' }}
timeout-minutes: 15
run: make -C bld -j5 V=1 -C tests
- name: 'autotools run tests'
if: ${{ matrix.build == 'automake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 15
run: |
export TFLAGS='-j8 ${{ matrix.tflags }} ~615'
if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
fi
make -C bld -j5 V=1 test-ci
- name: 'autotools build examples'
if: ${{ matrix.build == 'automake' }}
timeout-minutes: 5
run: make -C bld -j5 V=1 examples
- name: 'cmake configure'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 5
run: |
PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
cmake -B bld -G Ninja ${options} \
-DCMAKE_UNITY_BUILD=ON \
-DCURL_WERROR=ON \
-DENABLE_WEBSOCKETS=ON \
-DCURL_BROTLI=ON \
${{ matrix.config }}
- name: 'cmake configure log'
if: ${{ matrix.build == 'cmake' && !cancelled() }}
run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
- name: 'curl_config.h'
if: ${{ matrix.build == 'cmake' }}
run: cat bld/lib/curl_config.h | grep -F '#define' | sort || true
- name: 'curl_config.h (full)'
if: ${{ matrix.build == 'cmake' }}
run: cat bld/lib/curl_config.h || true
- name: 'cmake build'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 10
run: cmake --build bld --config '${{ matrix.type }}' --parallel 5
- name: 'curl version'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 1
run: |
find . -name '*.exe' -o -name '*.dll' | grep -v '/examples/'
PATH="$PWD/bld/lib:$PATH"
bld/src/curl.exe --disable --version
- name: 'cmake build tests'
if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' }}
timeout-minutes: 15
run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
- name: 'cmake run tests'
if: ${{ matrix.build == 'cmake' && matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 15
run: |
export TFLAGS='-j8 ${{ matrix.tflags }} ~615'
if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
fi
PATH="$PWD/bld/lib:$PATH"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
- name: 'cmake build examples'
if: ${{ matrix.build == 'cmake' }}
timeout-minutes: 5
run: cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples