From de6b308e1ae4ace1f8bf38151ef925f29293bb12 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Wed, 11 Nov 2026 22:01:41 +0100 Subject: [PATCH 1/2] Make the default test build the quick one and pass every option explicitly in CI (#546) The heavy unit tests compile four to a file by default; the MSVC code analysis and the reproducibility proofs are off unless asked for. Every CI job names these options, so each checks what it checked before. No CMake preset is added. --- .github/workflows/BuildAndTest.yml | 8 +++++--- .github/workflows/ReleaseDeveloper.yml | 2 +- AGENTS.md | 1 + cmake/CompilerWarnings.cmake | 5 +++-- docs/BUILD_TIME_STUDY.md | 2 +- docs/CHANGELOG.md | 1 + docs/TEST_TIERS.md | 13 +++++++++++-- test/unit/CMakeLists.txt | 6 +++--- test/web/CMakeLists.txt | 5 +++-- 9 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/BuildAndTest.yml b/.github/workflows/BuildAndTest.yml index 8049ae9c..fcee9aa8 100644 --- a/.github/workflows/BuildAndTest.yml +++ b/.github/workflows/BuildAndTest.yml @@ -141,6 +141,7 @@ jobs: sccache --version # ENABLE_CACHE controls automatic ccache discovery; the explicit sccache launcher stays enabled. # The heavy unit tests are compiled four to a file (docs/BUILD_TIME_STUDY.md); the portability and sanitizer jobs keep one object per test file. + # No job relies on a default of the test options: the defaults are those of a quick local build (docs/TEST_TIERS.md). - name: Configure run: >- cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} @@ -149,7 +150,7 @@ jobs: -DCMAKE_CXX_SCAN_FOR_MODULES=OFF -DWEBFRONT_TEST_UNITY_BATCH=4 -DWEBFRONT_TEST_REPRODUCIBILITY=${{ env.WEBFRONT_REPRODUCIBILITY }} - ${{ env.FULL_TIER == 'true' && '' || '-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF' }} + ${{ env.FULL_TIER == 'true' && '-DWEBFRONT_MSVC_ANALYZE=ON -DWEBFRONT_BUILD_EXAMPLES=ON' || '-DWEBFRONT_MSVC_ANALYZE=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF' }} ${{ matrix.options }} - name: Build run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 4 @@ -355,7 +356,7 @@ jobs: # No compiler cache: a new user compiles everything. - name: Configure shell: bash - run: cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_SCAN_FOR_MODULES=OFF + run: cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_SCAN_FOR_MODULES=OFF -DWEBFRONT_TEST_UNITY_BATCH=0 -DWEBFRONT_MSVC_ANALYZE=ON -DWEBFRONT_TEST_REPRODUCIBILITY=ON - name: Portability tests shell: bash run: ctest --test-dir build -C Release -L portability --output-on-failure --no-tests=error @@ -409,6 +410,7 @@ jobs: cmake -S . -B build-sanitizers -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF + -DWEBFRONT_TEST_UNITY_BATCH=0 -DWEBFRONT_TEST_REPRODUCIBILITY=ON ${{ matrix.sanitizer == 'thread' && '-DCMAKE_CXX_FLAGS=-stdlib=libc++ -DWEBFRONT_ENABLE_SANITIZER_THREAD=ON' || '-DWEBFRONT_ENABLE_SANITIZER_ADDRESS=ON -DWEBFRONT_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON -DWEBFRONT_ENABLE_FUZZING=ON -DWEBFRONT_GZIP_DIFFERENTIAL=ON' }} - name: Build run: cmake --build build-sanitizers --parallel 2 @@ -491,7 +493,7 @@ jobs: # The registry packages and the pinned bootstrap environment are downloaded and verified here; wf then builds the rest. - name: Configure CEF integration build - run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF + run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DWEBFRONT_ENABLE_TESTING=ON -DWEBFRONT_TEST_REPRODUCIBILITY=ON -DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_SCAN_FOR_MODULES=OFF - name: Build browser test run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration webfront-wf --parallel 2 diff --git a/.github/workflows/ReleaseDeveloper.yml b/.github/workflows/ReleaseDeveloper.yml index 1d1cc8b2..6d2a342f 100644 --- a/.github/workflows/ReleaseDeveloper.yml +++ b/.github/workflows/ReleaseDeveloper.yml @@ -104,7 +104,7 @@ jobs: WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS: '1' run: | # The driver was configured before the version was set: CTest read the former version of distribution.json then. - cmake -S . -B build-driver + cmake -S . -B build-driver -DWEBFRONT_TEST_REPRODUCIBILITY=ON cmake --build build-driver --target webtest developer_integration webfront-wf --parallel 2 xvfb-run -a ctest --test-dir build-driver -L web-integration --output-on-failure --no-tests=error --parallel 2 - name: Collect the release files diff --git a/AGENTS.md b/AGENTS.md index 749f14a8..a753bd33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -90,6 +90,7 @@ without network access. - `WEBFRONT_ENABLE_TESTING=ON` (default `OFF`): build Catch2 and Jasmine test targets. CI and contributor commands must pass it explicitly. The test, fuzzing, coverage and sanitizer options (`WEBFRONT_ENABLE_SANITIZER_*`) carry the `WEBFRONT_` prefix so that a parent's own `ENABLE_TESTING` or `ENABLE_SANITIZER_ADDRESS` never builds or instruments WebFront's tests; the former unprefixed names no longer configure WebFront (`cmake/WebFrontTestOptions.cmake` documents the options). - `WEBFRONT_BUILD_EXAMPLES` (default `ON` only for the top-level project): build the examples. As a subproject (`add_subdirectory`), link `WebFront::WebFront`; no examples, tests or global compiler settings are added. - `WEBFRONT_ENABLE_COVERAGE=ON`: add GCC/Clang coverage instrumentation to the C++ tests. +- The project has no CMake presets: the defaults are the quick local build (`WEBFRONT_TEST_UNITY_BATCH=4`, `WEBFRONT_MSVC_ANALYZE=OFF`, `WEBFRONT_TEST_REPRODUCIBILITY=OFF`) and every CI job passes these options explicitly (`docs/TEST_TIERS.md`). If the environment provides a read-only default ccache directory, set `CCACHE_DIR` to a writable temporary directory for local builds. Do not encode machine-specific cache paths in project files. In CI, `ENABLE_CACHE=OFF` disables automatic cache discovery while `CMAKE_CXX_COMPILER_LAUNCHER=sccache` explicitly enables sccache; a PATH/version probe runs on all three platforms. The combined Linux job uses Debug with GCC coverage on every PR; Windows and macOS use Release. The WebKitGTK sandbox opt-out is confined to the Linux test step and trusted fixtures. diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 2657516a..78a0deff 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -4,8 +4,9 @@ function(set_project_warnings project_name) option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON) - # MSVC /analyze roughly doubles the front-end work of every unit (#435): OFF is for measuring that cost, not for CI. - option(WEBFRONT_MSVC_ANALYZE "Run the MSVC code analysis while compiling" ON) + # MSVC /analyze roughly doubles the front-end work of every unit (#435): a local build leaves it out, and the + # advanced CI tier turns it on (docs/TEST_TIERS.md). + option(WEBFRONT_MSVC_ANALYZE "Run the MSVC code analysis while compiling" OFF) set(MSVC_WARNINGS /W4 # Baseline reasonable warnings diff --git a/docs/BUILD_TIME_STUDY.md b/docs/BUILD_TIME_STUDY.md index bec79c66..1fd9cf5e 100644 --- a/docs/BUILD_TIME_STUDY.md +++ b/docs/BUILD_TIME_STUDY.md @@ -15,7 +15,7 @@ runs; Linux runs are steadier. | Change | Effect | |---|---| | `--parallel 4` on the desktop builds | Linux `tests` 280 -> 170 s cold, `all` 520 -> 255-375 s; Windows `tests` 820 -> 640 s, `all` 1240 -> 1080 s. Peak memory stays under 1 GB. | -| The 13 heavy unit tests compile four to a file (`WEBFRONT_TEST_UNITY_BATCH=4` on the desktop jobs) | Windows cold 640 -> 355 s, `WebFront.hpp` changed 298 -> 111 s; Linux 202 -> 143 s and 88 -> 45 s. Less memory. | +| The 13 heavy unit tests compile four to a file (`WEBFRONT_TEST_UNITY_BATCH=4`, the default) | Windows cold 640 -> 355 s, `WebFront.hpp` changed 298 -> 111 s; Linux 202 -> 143 s and 88 -> 45 s. Less memory. | | MSVC `/analyze` and the examples only in the master and weekly tier | `/analyze` is about 22 % of a Windows build (640 -> 497 s cold); the examples about 190 s of compiler time. | | The reproducibility builds only when a pull request changes their inputs | About 45 s of worker time per job (`SelfBuildRepeat`, `SelfBuildRefresh`). | | `JourneyEmbeddedBuild` and `LifeEmbeddedBuild` do not hold `webfront_port_9002` | They only compile; the lock had serialised 175 s (Linux) and 203 s (Windows) of tests. | diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2db31faa..84566908 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -13,6 +13,7 @@ these entries stays in the GitHub releases and the Git history. ### Changed - Open the developer page on the interface, over the whole window, once the project has a preview; the terminal moves to a floating, movable window behind a tab on the right edge that shows the session's state, and keeps its session when collapsed. Its shortcut is F9, or the manifest's new optional `developer.terminalShortcut`. Environment sources 0.9.1, not published yet (#539, `docs/DEVELOPER_ENVIRONMENT.md`). +- Make the default test build the quick one: the heavy unit tests compile four to a file, the MSVC code analysis and the reproducibility proofs are off unless `-DWEBFRONT_MSVC_ANALYZE=ON` or `-DWEBFRONT_TEST_REPRODUCIBILITY=ON` asks for them. The CI passes every option explicitly and checks what it checked before (#546). ### Fixed diff --git a/docs/TEST_TIERS.md b/docs/TEST_TIERS.md index 47fbfb0f..1cd844c8 100644 --- a/docs/TEST_TIERS.md +++ b/docs/TEST_TIERS.md @@ -45,20 +45,29 @@ spec expected the refusal. A wait is labelled `timeout (expected)` only for a ti and `cancelled (expected)` only when the spec pressed Ctrl+C; any other time limit or cancellation appears as `timeout` or `cancelled`. This trace comes from the specs (`test/web/developer-specs.mjs`), not from the published environment. +## A quick local build by default + +The defaults of the test options are those of the quickest useful build, and the project has no CMake preset to choose +between: `-DWEBFRONT_ENABLE_TESTING=ON` alone compiles the heavy unit tests four to a file +(`WEBFRONT_TEST_UNITY_BATCH=4`), leaves the MSVC code analysis out (`WEBFRONT_MSVC_ANALYZE=OFF`) and does not register +the reproducibility proofs (`WEBFRONT_TEST_REPRODUCIBILITY=OFF`). The CI passes every one of these options explicitly, +so a default can change without changing what a job checks. While working, `ctest -L fast` then the cases the change +touches (`ctest -R `) are enough; the complete suite runs before the work is declared complete. + ## What the desktop jobs compile A pull request into `develop` builds the library, the tests and the test applications, with the MSVC code analysis (`/analyze`) off and without the examples (`WEBFRONT_MSVC_ANALYZE=OFF`, `WEBFRONT_BUILD_EXAMPLES=OFF`): about 22 % and 190 s of compiler time on Windows (docs/BUILD_TIME_STUDY.md). The advanced checks below turn both on again, so a warning that only the analysis reports, or an example that no longer compiles, is found by the weekly run, by the pull request into `master` or by a manual -dispatch with `repeat_desktop_tests`, not by a pull request into `develop`. A local build has both by default. +dispatch with `repeat_desktop_tests`, not by a pull request into `develop`. The proofs that the self-built environment is reproducible and equal to the checked-in bundles (`SelfBuildRepeat`, `SelfBuildReproducible`, `SelfBuildRefresh`, `SelfBuildRefreshMatchesSources`) build it twice more, about 45 s on a hosted runner. A pull request into `develop` runs them only when it changes one of their inputs (`js/`, `examples/life/ui/`, `test/developer/`, `test/web/registry/` and `test/web/CMakeLists.txt`, `include/webfront/system/`, the CMake scripts that prepare, compare and assemble the self-build project, `LICENSE` and the workflow itself); a push to `develop` and the advanced -checks always run them. `-DWEBFRONT_TEST_REPRODUCIBILITY=OFF` leaves them out locally; the default is ON. +checks always run them. They are off by default: `-DWEBFRONT_TEST_REPRODUCIBILITY=ON` adds them to a local build. ## Advanced checks diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 236f5564..85970db6 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -55,10 +55,10 @@ add_dependencies(tests host_probe) target_compile_definitions(tests PRIVATE WEBFRONT_HOST_PROBE="$") # The heavy units instantiate a full application, and compile four to a file in about half the time of four apart -# (docs/BUILD_TIME_STUDY.md). The desktop CI jobs set the batch size; the default keeps one object per test file, which -# keeps a rebuild after one edit small. The light units stay apart: grouping every unit does not compile, as their +# (docs/BUILD_TIME_STUDY.md): that is the default. 0 keeps one object per test file, which the portability and +# sanitizer jobs ask for. The light units stay apart: grouping every unit does not compile, as their # helpers share names. -set(WEBFRONT_TEST_UNITY_BATCH 0 CACHE STRING "Compile the heavy unit tests this many to a file; 0 compiles each file alone") +set(WEBFRONT_TEST_UNITY_BATCH 4 CACHE STRING "Compile the heavy unit tests this many to a file; 0 compiles each file alone") if(WEBFRONT_TEST_UNITY_BATCH GREATER 0) set(_heavy WebFrontTests ReadBindingTests ViewAssociationTests BroadcastTests CommandsTests ApplicationTaskTests DeferredCallTests StdnetShutdownTests FrontendContractTests JsFunctionSenderTests AutomationTests ReactStoreTests DeveloperTests CEFMacrosTests JasmineConsumerTests WfDriverTests) diff --git a/test/web/CMakeLists.txt b/test/web/CMakeLists.txt index a73358be..f7180d65 100644 --- a/test/web/CMakeLists.txt +++ b/test/web/CMakeLists.txt @@ -644,8 +644,9 @@ if(_browser_tests_available) webfront_add_self_build_test(DeveloperSpecs 0 "test|--timeout|240" OUTPUT "PASSED: [0-9]+ specs" TIMEOUT 300 REQUIRES SelfBuildInstalled) # The reproducibility proofs build the environment again, the second time from a refreshed bootstrap: about 45 s on a - # hosted runner. A pull request that changes none of their inputs may leave them to the master tier (#435). - option(WEBFRONT_TEST_REPRODUCIBILITY "Build the self-built environment again, to prove it reproducible and equal to the checked-in bundles" ON) + # hosted runner. A pull request that changes none of their inputs may leave them to the master tier (#435), and a + # local build leaves them out unless it asks for them. + option(WEBFRONT_TEST_REPRODUCIBILITY "Build the self-built environment again, to prove it reproducible and equal to the checked-in bundles" OFF) if(WEBFRONT_TEST_REPRODUCIBILITY) webfront_add_self_build_test(SelfBuildRepeat 0 "run|build|build-distribution-repeat" OUTPUT "Script build completed" REQUIRES SelfBuilt PROVIDES SelfBuiltTwice) From 8ae0679dab82d7a3487f049e1809d14862f33208 Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc <6860842+ambroise-leclerc@users.noreply.github.com> Date: Wed, 11 Nov 2026 22:09:51 +0100 Subject: [PATCH 2/2] Ask for the reproducibility proofs where the wf driver is configured (#546) The release workflow check pins the line that configures build-driver again; the option belongs to the first configuration, in the wf-driver action. --- .github/actions/wf-driver/action.yml | 2 +- .github/workflows/ReleaseDeveloper.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/wf-driver/action.yml b/.github/actions/wf-driver/action.yml index 438cd55e..462a2dd2 100644 --- a/.github/actions/wf-driver/action.yml +++ b/.github/actions/wf-driver/action.yml @@ -26,7 +26,7 @@ runs: shell: bash run: | cmake -S . -B build-driver -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON \ - -DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK \ + -DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK -DWEBFRONT_TEST_REPRODUCIBILITY=ON \ -DCMAKE_CXX_SCAN_FOR_MODULES=OFF cmake --build build-driver --target webfront-wf --parallel 2 - name: Install the wf command diff --git a/.github/workflows/ReleaseDeveloper.yml b/.github/workflows/ReleaseDeveloper.yml index 6d2a342f..1d1cc8b2 100644 --- a/.github/workflows/ReleaseDeveloper.yml +++ b/.github/workflows/ReleaseDeveloper.yml @@ -104,7 +104,7 @@ jobs: WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS: '1' run: | # The driver was configured before the version was set: CTest read the former version of distribution.json then. - cmake -S . -B build-driver -DWEBFRONT_TEST_REPRODUCIBILITY=ON + cmake -S . -B build-driver cmake --build build-driver --target webtest developer_integration webfront-wf --parallel 2 xvfb-run -a ctest --test-dir build-driver -L web-integration --output-on-failure --no-tests=error --parallel 2 - name: Collect the release files