cmake: separate target for examples, optimize CI, fix fallouts

- Move `docs/examples` builds under a separate target.

- Make `BUILD_EXAMPLES` default to `ON`. It means to generate the rules
  for `docs/examples` by default, but not build them. To build them,
  an explicit `make curl-examples` (or ninja, etc) command is necessary.
  This syncs behaviour with autotools, and also how both cmake and
  autotools are building tests.

- GHA: update cmake jobs to use the new way of building examples.

- GHA: move examples build step at the end of the job, after building
  and running tests. This allows to have build and test run results
  faster, and leave the seldom-changing examples build to the end.
  Building examples is the slowest build step with no practical way to
  make them fast.

- appveyor: enable building examples in two old-MSVC jobs.

- examples: fix examples to build cleanly with old MSVC versions.

- GHA/non-native: move example build log under a GHA foldable section.

- GHA/windows: move building examples into separate step for Linux cross
  jobs.

Follow-up to dfdd978f7c #13491
Closes #14906
This commit is contained in:
Viktor Szakats 2024-09-14 02:21:33 +02:00
parent caefaecaad
commit 45202cbba4
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
13 changed files with 116 additions and 53 deletions

View file

@ -121,7 +121,7 @@ jobs:
compiler: gcc-12
configure: --enable-debug --with-secure-transport --enable-websockets --with-libssh2=$(brew --prefix libssh2)
macos-version-min: '10.8'
- name: 'LibreSSL'
- name: 'LibreSSL +examples'
compiler: clang
install: libressl
configure: --enable-debug --with-openssl=$(brew --prefix libressl) --enable-websockets
@ -229,9 +229,6 @@ jobs:
- name: 'curl version'
run: bld/src/curl --disable --version
- name: 'make examples'
run: make -C bld V=1 examples
- name: 'make tests'
run: make -C bld V=1 -C tests
@ -264,6 +261,10 @@ jobs:
rm -f $HOME/.curlrc
make -C bld V=1 test-ci
- name: 'make examples'
if: ${{ contains(matrix.build.name, '+examples') }}
run: make -C bld V=1 examples
cmake:
name: 'CM ${{ matrix.compiler }} ${{ matrix.build.name }}'
runs-on: 'macos-latest'
@ -287,9 +288,9 @@ jobs:
- name: 'SecureTransport ws debug+'
generate: -DCURL_USE_SECTRANSP=ON -DENABLE_WEBSOCKETS=ON -DENABLE_DEBUG=ON -DENABLE_CURLDEBUG=ON
macos-version-min: '10.8'
- name: 'LibreSSL !ldap heimdal c-ares'
- name: 'LibreSSL !ldap heimdal c-ares +examples'
install: libressl heimdal
generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON -DBUILD_EXAMPLES=ON
generate: -DOPENSSL_ROOT_DIR=$(brew --prefix libressl) -DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix heimdal) -DCURL_DISABLE_LDAP=ON
macos-version-min: '10.15'
- name: 'wolfSSL !ldap brotli zstd'
install: brotli wolfssl zstd
@ -399,6 +400,10 @@ jobs:
rm -f $HOME/.curlrc
ninja -C bld test-ci
- name: 'cmake build examples'
if: ${{ contains(matrix.name, '+examples') }}
run: make -C bld VERBOSE=1
combinations: # Test buildability with host OS, Xcode / SDK, compiler, target-OS, SecureTransport/not, built tool, combinations
if: true # Set to `true` to enable this test matrix. It runs quickly.
name: "${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} ${{ matrix.image }} ${{ matrix.xcode }} ${{ matrix.config }}"