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

@ -504,7 +504,6 @@ jobs:
cmake . \
-DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
-DCMAKE_UNITY_BUILD=ON -DCURL_WERROR=ON \
-DBUILD_EXAMPLES=ON \
-DCURL_BROTLI=ON -DCURL_ZSTD=ON \
${{ matrix.build.generate }}
if: ${{ matrix.build.generate }}
@ -535,10 +534,6 @@ jobs:
- run: ./src/curl -V
name: 'check curl -V output'
- run: ${{ matrix.build.make-prefix }} make V=1 examples
if: ${{ matrix.build.configure }}
name: 'make examples'
- run: make V=1 -C tests
if: ${{ matrix.build.configure && matrix.build.install_steps != 'skipall' }}
name: 'make tests (autotools)'
@ -566,3 +561,11 @@ jobs:
env:
TFLAGS: "${{ matrix.build.tflags }}"
CURL_CI: github
- run: ${{ matrix.build.make-prefix }} make V=1 examples
if: ${{ matrix.build.configure }}
name: 'make examples (autotools)'
- run: ${{ matrix.build.make-prefix }} make VERBOSE=1 curl-examples
if: ${{ matrix.build.generate }}
name: 'make examples (cmake)'