Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b5c5475
Build the desktop CI jobs with four parallel jobs [#435]
ambroise-leclerc Oct 30, 2026
6c56179
Add the build-time study workflow and its test options [#435]
ambroise-leclerc Oct 30, 2026
b936616
Return from RunWithDeadline.sh when the command ends, not at the dead…
ambroise-leclerc Oct 30, 2026
ada99ee
Compile the heavy unit tests as a unity build and study the variants …
ambroise-leclerc Oct 30, 2026
025a441
Profile where the compile time of a heavy unit goes [#435]
ambroise-leclerc Oct 30, 2026
981452b
Do not hold the port lock while an embedded application is compiled […
ambroise-leclerc Oct 30, 2026
51d3c35
Profile with a flag Git Bash does not rewrite; allow profile-only run…
ambroise-leclerc Oct 30, 2026
e572947
Measure the cost of MSVC /analyze; select study variants from the com…
ambroise-leclerc Oct 30, 2026
49b9c2d
Give the command its own process group when the shell has no job cont…
ambroise-leclerc Oct 30, 2026
08b43dd
Build the study matrix as an include list; no matrix in a job conditi…
ambroise-leclerc Oct 30, 2026
19448b7
Repeat the Windows measurements and report their spread [#435] [windo…
ambroise-leclerc Oct 30, 2026
3f502c0
Change a declaration, not a comment, in the study scenarios; repeat L…
ambroise-leclerc Oct 31, 2026
d349f2c
Compile the heavy unit tests in groups of four on the desktop jobs an…
ambroise-leclerc Oct 31, 2026
bf2e997
Merge develop into 435-ci-build-time [#435]
ambroise-leclerc Oct 31, 2026
6fce707
Add the measured pull-request run to the build-time report [#435]
ambroise-leclerc Oct 31, 2026
e3ee1b7
Record why the remaining items of the build-time study are left [#435]
ambroise-leclerc Oct 31, 2026
61e7976
Run the MSVC analysis and compile the examples in the master and week…
ambroise-leclerc Oct 31, 2026
4a3efcc
Cut DeveloperBrowserIntegration into five parts that run in parallel …
ambroise-leclerc Oct 31, 2026
7475321
Merge develop into 435-ci-build-time [#435]
ambroise-leclerc Oct 31, 2026
6474705
Report what cutting DeveloperBrowserIntegration gained [#435]
ambroise-leclerc Oct 31, 2026
2594d46
Run the reproducibility builds only when their inputs change in a pul…
ambroise-leclerc Oct 31, 2026
80cbb45
Merge develop into 435-ci-build-time [#435]
ambroise-leclerc Oct 31, 2026
3da5704
Separate the unreleased changes from the 0.6.0 section [#435]
ambroise-leclerc Oct 31, 2026
0aaa706
Address review comments: validate study variants, fail the profile on…
ambroise-leclerc Oct 31, 2026
6ca608f
Rename the clashing helper of JsFunctionSenderTests and drop the know…
ambroise-leclerc Oct 31, 2026
adfb8be
Make the build-time study a manual workflow with inputs instead of a …
ambroise-leclerc Oct 31, 2026
6a9f9fc
Merge develop into 435-ci-build-time; remove the build-time study wor…
ambroise-leclerc Oct 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ concurrency:
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cache/CPM
SCCACHE_GHA_ENABLED: 'true'
# The full tier of the desktop jobs (weekly, pull requests into and pushes to master, manual dispatch with repeat_desktop_tests)
# also runs the MSVC code analysis and compiles the examples; a pull request into develop does neither (#435, docs/BUILD_TIME_STUDY.md).
FULL_TIER: ${{ (github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_dispatch' && inputs.repeat_desktop_tests)) && 'true' || 'false' }}

# Third-party actions are pinned to commit SHAs; GitHub-owned actions/* use version tags.
jobs:
Expand Down Expand Up @@ -84,6 +87,23 @@ jobs:
container: ${{ matrix.use_image && fromJSON(format('{{"image":"{0}","credentials":{{"username":"{1}","password":"{2}"}},"options":"--shm-size=1g"}}', needs.linux-image.outputs.image, github.actor, github.token)) || '' }}
steps: &desktop-steps
- uses: actions/checkout@v7
with:
# A pull request is checked out as a merge commit: its first parent is the base, so the changed files are one diff away.
fetch-depth: 2
# The builds that prove the self-built environment reproducible and equal to the checked-in bundles take about 45 s. A
# pull request into develop that changes none of their inputs (what PrepareSelfBuildProject.cmake copies, and the CMake and
# workflow files that drive them) leaves them to the push to develop and to the master tier (#435).
- name: Decide whether the reproducibility builds run
shell: bash
run: |
reproducibility=true
if [ "$FULL_TIER" != true ] && [ "$GITHUB_EVENT_NAME" = pull_request ]; then
if ! git diff --name-only HEAD^1 HEAD | grep -qE '^(js/|examples/life/ui/|test/developer/|test/web/(CMakeLists\.txt|registry/)|test/cmake/(PrepareSelfBuildProject|CompareFiles|CheckSelfBuildRefresh|AssembleDeveloperFixtures)|include/webfront/system/|LICENSE$|\.github/workflows/BuildAndTest\.yml)'; then
reproducibility=false
fi
fi
echo "Reproducibility builds: $reproducibility"
echo "WEBFRONT_REPRODUCIBILITY=$reproducibility" >> "$GITHUB_ENV"
# No step of a build or of its tests needs a JavaScript runtime or package manager: the runner has none from here on.
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/setup-cmake
Expand Down Expand Up @@ -120,15 +140,19 @@ jobs:
command -v sccache
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.
- name: Configure
run: >-
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DWEBFRONT_EMBED_CEF=OFF -DWEBFRONT_ENABLE_TESTING=ON
-DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-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' }}
${{ matrix.options }}
- name: Build
run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 2
run: python3 test/tools/MeasureCommand.py --output build/build-resources.json -- cmake --build build --config ${{ matrix.build_type }} --parallel 4
- name: Ensure WebView2 Evergreen runtime
if: runner.os == 'Windows'
shell: pwsh
Expand Down
6 changes: 6 additions & 0 deletions cmake/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

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)

set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings
Expand Down Expand Up @@ -35,6 +37,10 @@ function(set_project_warnings project_name)
/permissive- # standards conformance mode for MSVC compiler.
)

if(NOT WEBFRONT_MSVC_ANALYZE)
list(FILTER MSVC_WARNINGS EXCLUDE REGEX "^/analyze")
endif()

set(CLANG_WARNINGS
-Wall
-Wextra # reasonable and standard
Expand Down
37 changes: 30 additions & 7 deletions cmake/RunWithDeadline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@
# the command started cannot outlive it. Exits with 124 on a timeout (the command was killed), else with its status.
limit=$1
shift
set -m
expired=$(mktemp -u)
"$@" &
# The command needs its own process group for the deadline to reach everything it started. Job control gives it one; dash
# without a terminal accepts `set -m` yet keeps job control off (and then a group kill reaches nothing), where setsid gives it one instead.
{ set -m; } 2>/dev/null
case $- in
*m*) "$@" & ;;
*)
if command -v setsid >/dev/null 2>&1; then
setsid "$@" &
else
"$@" &
fi
;;
esac
command_pid=$!
# Where the command has no group of its own (a shell without job control, and no setsid), the deadline walks its descendants.
kill_tree() {
for child in $(pgrep -P "$1" 2>/dev/null); do
kill_tree "$child"
done
kill -s KILL "$1" 2>/dev/null
}
(
sleep "$limit"
sleep "$limit" &
sleeper=$!
trap 'kill "$sleeper" 2>/dev/null; exit 0' TERM
wait "$sleeper" || exit 0
: > "$expired"
kill -KILL -- "-$command_pid" 2>/dev/null
) &
kill -s KILL -- "-$command_pid" 2>/dev/null || kill_tree "$command_pid"
# The watchdog must not hold the caller's output pipes: the caller waits for them to close, so a sleeping watchdog would
# delay a command that already finished until the deadline (30 s per Jasmine case under dash, which has no job control here).
) >/dev/null 2>&1 &
watchdog_pid=$!
wait "$command_pid"
status=$?
kill -KILL -- "-$watchdog_pid" 2>/dev/null
kill -TERM "$watchdog_pid" 2>/dev/null
# Whatever the command left behind in its group goes with it.
kill -KILL -- "-$command_pid" 2>/dev/null
kill -s KILL -- "-$command_pid" 2>/dev/null
# Only the watchdog's flag makes a kill a timeout: an unrelated SIGKILL keeps its own status.
if [ -e "$expired" ]; then
rm -f "$expired"
Expand Down
66 changes: 66 additions & 0 deletions docs/BUILD_TIME_STUDY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Pull-request CI time (#435)

Pull-request runs of `BuildAndTest.yml` took about 6 minutes, or 20 when the pull request touched a header that every heavy
unit includes (`WebFront.hpp`: #400, #401, #428). The cause is compile time: about 26 translation units instantiate a full
application and cost 28 to 113 s each on MSVC, and a changed header misses the compiler cache for all of them.

This page keeps what was measured and what was decided. The measurements come from GitHub-hosted runners, with a throwaway
workflow (in the history of pull request #436) that timed clean builds of the `tests` target with an empty compiler cache
(`cold`), a complete one (`warm`) and a complete one but for the files a pull request changes (`header`, `heavy-test`,
`light-test`). Hosted Windows runners vary by up to 1.5x between identical jobs, so Windows figures are the median of three
runs; Linux runs are steadier.

## Decisions

| 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. |
| 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. |
| `RunWithDeadline.sh` returns when its command does | Six Linux `ConsumerJasmine-*` cases waited 30 s each for nothing. |
| `DeveloperBrowserIntegration` in five parts | The dependency chain 186 -> 130 s on Linux; see below. |

On a pull request that touches a core header (this one, after merging `develop`), the build step went from 328 to 85 s on Linux
and from 876 to 213 s on Windows, and the Windows job from about 20 to 7.7 minutes.

## Measured and not adopted

- **Precompiled headers.** sccache cannot cache an MSVC compilation that uses one, so a complete cache still recompiles every
unit (warm 32 -> 231 s on Windows) and the build needs 1.7 GB. On GCC it was slower than no precompiled header.
- **Grouping every test file** does not compile: the light units share helper names. Only the heavy units are grouped, and the
helpers they share were renamed. Groups of 4 beat groups of 6 and 12 in every scenario on both systems: a change to one
heavy test recompiles at most three others, and four groups still spread over four jobs.
- **Sharing instantiations between executables** (`extern template`). `life_journey` and `life_embedded` compile the same file
against different generated headers, and the developer application is instantiated with a different frontend or filesystem
in each executable. Identical function instantiations that occur in more than one unit of `tests` account for at most 9 %
of its compile time (Clang `-ftime-trace`, an upper bound).
- **Merging the small executables** (`jasmine_consumer`, `frontend_lifecycle`, `webview2_*`, 66 to 69 s each on MSVC): each
instantiates its own frontend type, and separate processes are part of what several cases prove.

Where one compile goes (the floor of a heavy unit): `HelloWorld.cpp` costs 11 s with GCC (Debug, coverage: 21 % parsing,
23 % instantiation, 49 % optimisation and code generation), 22 s with Clang, 61 s with MSVC, where `WebFront.hpp` alone takes 8 s
to parse and the front end runs a second time for `/analyze`.

## Run time

The suite took 256 s (Linux) and 271 s (Windows). Its chain of dependent cases is `SelfBuildSession` -> `DeveloperFixtures`
-> `DeveloperBrowserIntegration` -> `LifeEmbeddedBuild` -> `LifeEmbeddedIntegration`: the first builds the environment under test
from the current sources and the later ones run it, so the order cannot be shortened.

`SelfBuildSession` (59 s on a loaded Linux runner, 44 s on a quiet machine) is five `wf` commands in one browser session:
install 0.4 s, build the environment 8.5 s, its 121 JavaScript specs 16.3 s, a second build to prove the bytes equal 11.7 s,
and the refusal of a write outside the permissions 6.4 s. It is a product build and the test suite of the environment, run
by the product itself in WASM, so it cannot be a 3 s test.

`DeveloperBrowserIntegration` was one script in one browser over one project (59 to 113 s). It is five parts
(`--part=app|scripts|typescript|jasmine|terminal`), each from its own project on a port the system picks, so none holds the port
lock. On a quiet Mac each part takes 3 to 6 s. On a four-vCPU runner the chain is shorter and the suite is not faster:
with four workers it is bound by its worker time divided by four (735 s / 4 = 184 s on Linux against a wall time of 195 s),
and the parts add worker time (each repeats the bootstrap, `wf create` and `wf init`, and five browsers contend for four cores).
Shortening the suite further means removing worker time; the largest cases on Linux are `AutomationMcpWindow` (62 s),
`SelfBuildSession` (59 s), `SelfBuildRefresh` (34 s) and `JourneyBuildSession` (31 s).

`FrontendConsumerConfiguration` and `AddSubdirectoryNativeConsumer` (about 65 s each on Windows) configure and build separate
projects on purpose, each proving another option set from a clean state; they are off the chain.
13 changes: 13 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

## Unreleased

- Cut pull-request CI time (#435): the desktop jobs build with `--parallel 4` and compile the 13 heavy unit-test files four
to a file (`WEBFRONT_TEST_UNITY_BATCH`; the default build keeps one object per file, and `JsFunctionSenderTests.cpp`,
`CommandsTests.cpp`, `FrontendContractTests.cpp` and `BroadcastTests.cpp` name their helpers so that they can share one).
A pull request into `develop` no longer builds the examples or runs the MSVC code analysis (`WEBFRONT_MSVC_ANALYZE`,
default ON), nor the builds that prove the self-built environment reproducible unless it changes their inputs
(`WEBFRONT_TEST_REPRODUCIBILITY`, default ON); the weekly run, pull requests into and pushes to `master` do all three.
`JourneyEmbeddedBuild` and `LifeEmbeddedBuild` no longer hold the `webfront_port_9002` lock while they compile.
`DeveloperBrowserIntegration` is cut into five parts (`DeveloperBrowserIntegration`, `-scripts`, `-typescript`,
`-jasmine`, `-terminal`) that run in parallel from their own projects on ephemeral ports. `RunWithDeadline.sh` returns
when its command does instead of at the deadline, which took 30 s from each of the six `ConsumerJasmine-*` cases under
dash, and gives the command its own process group (`setsid`, or a walk of its descendants) where the shell has no job
control. `docs/BUILD_TIME_STUDY.md` holds the measurements and the decisions.

- Prefix WebFront's test options (#412): `WEBFRONT_ENABLE_TESTING`, `WEBFRONT_ENABLE_FUZZING`,
`WEBFRONT_ENABLE_COVERAGE` and `WEBFRONT_ENABLE_SANITIZER_{ADDRESS,LEAK,UNDEFINED_BEHAVIOR,THREAD,MEMORY}` replace
the unprefixed `ENABLE_*` names (still `OFF` by default). A parent project's own generic variables no longer build
Expand Down
2 changes: 1 addition & 1 deletion docs/DEVELOPER_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ WKWebView and all 14 Linux CEF/Xvfb cases with both GCC and Clang in
The packed 0.3.0 version passes WKWebView and all 14 GCC CEF/Xvfb cases in
[run 39490581423](https://github.com/ambroise-leclerc/WebFront/actions/runs/39490581423).
For Linux, select CEF and Xvfb instead; the same developer tests use the selected test frontend.
`DeveloperBrowserIntegration` exercises the real WASM compiler, local registry, `wf test` under the locked jasmine-core (pass, fail, pending, asynchronous failures, pattern, time limit, Ctrl+C, non-interactive report to C++), build without navigation, incremental dev reload/error/recovery/Ctrl+C, the Life preview, C++ generation/animation and repeatable header generation. Its CTest fixtures then build that
`DeveloperBrowserIntegration` (the application part: starter, build, `wf dev`, Life preview, embedding) and `DeveloperBrowserIntegration-scripts`, `-typescript`, `-jasmine` and `-terminal` exercise, in parallel and each from its own project, the real WASM compiler, local registry, `wf test` under the locked jasmine-core (pass, fail, pending, asynchronous failures, pattern, time limit, Ctrl+C, non-interactive report to C++), build without navigation, incremental dev reload/error/recovery/Ctrl+C, the Life preview, C++ generation/animation and repeatable header generation. Its CTest fixtures then build that
**browser-generated** header and run `LifeEmbeddedIntegration` from an empty working directory
with no developer callbacks.
Deadline and grace-period regressions advance a scoped clock instead of sleeping for seconds; Worker startup,
Expand Down
5 changes: 4 additions & 1 deletion docs/TEST_PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ sampled bounds, not precise unique-memory or process-creation counts. Pre-existi
sccache server and its compiler children can fall outside this process family; sccache's own statistics complement the
sampled build report. It preserves the measured command's failure status.

`DeveloperBrowserIntegration` emits begin/end timestamps for each major phase and every actual command, including
`DeveloperBrowserIntegration` and its four sibling parts emit begin/end timestamps for each major phase and every actual command, including
expected failures. `DeveloperSpecs` reports both ends of each spec. The driver reports browser opening/return and shutdown,
and every suite case, so process-exit costs remain distinguishable. `LastTest-<pass>.log` keeps the full transcript of each pass; the suite
runner raises the CTest output cap to 2 MiB per case so JUnit retains these details too. The analyzer ranks the emitted
Expand Down Expand Up @@ -172,3 +172,6 @@ compilation constraints before changing their coverage.

GCC parallel coverage relies on libgcov's filesystem locking; filesystems without locking require
isolated profiles and merging. macOS failures retain WebKit system/crash diagnostics and phase logs.

Build-time measurements (compiler cache scenarios, grouping, precompiled headers, `/analyze`) and the decisions taken are in
[BUILD_TIME_STUDY.md](BUILD_TIME_STUDY.md).
Loading
Loading