Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ include/webfront/system/*Data.hpp text eol=lf

# Browser-powered developer bootstrap sources and generated payloads.
js/developer/environment/* text eol=lf
js/developer/vendor/package-lock.json text eol=lf

# Starter archives and every hashed distribution input must be identical on Windows.
js/developer/tools/starters/pi/* text eol=lf
Expand Down
15 changes: 13 additions & 2 deletions .github/actions/remove-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ runs:
- name: Remove Node.js, npm and npx
shell: bash
run: |
# A hosted Windows runner has no sudo: its user may delete the files itself.
remove() { if [ "$RUNNER_OS" = Windows ]; then rm -f "$1"; else sudo rm -f "$1"; fi; }
for tool in node nodejs npm npx corepack; do
while path=$(command -v "$tool"); do
sudo rm -f "$path" || exit 1
remove "$path" || exit 1
hash -r
done
done
for tool in node nodejs npm npx; do
# On Windows the command shims (npm.cmd, npx.cmd, corepack.cmd) are separate files next to the executables.
if [ "$RUNNER_OS" = Windows ]; then
for tool in npm npx corepack; do
while path=$(command -v "$tool.cmd"); do
rm -f "$path" || exit 1
hash -r
done
done
fi
for tool in node nodejs npm npx corepack; do
if command -v "$tool"; then
echo "::error::$tool is still reachable"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/wf-driver/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build the wf driver
description: >-
Builds webfront-wf (WebKitGTK frontend), the non-interactive driver of the WebFront developer environment, from the
bootstrap environment pinned by cmake/WebFrontBootstrap.cmake, and installs a `wf` command that runs a wf command on the
project at the root of the workspace. Node.js is neither used nor required (WEBFRONT_REQUIRE_NODE=OFF).
project at the root of the workspace. Node.js is neither used nor required.
runs:
using: composite
steps:
Expand All @@ -21,7 +21,7 @@ runs:
shell: bash
run: |
cmake -S . -B build-driver -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=OFF -DENABLE_TESTING=ON \
-DWEBFRONT_REQUIRE_NODE=OFF -DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK \
-DWEBFRONT_EMBED_WEBKITGTK=ON -DWEBFRONT_WEBTEST_FRONTEND=WebKitGTK \
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
cmake --build build-driver --target webfront-wf --parallel 2
- name: Install the wf command
Expand Down
31 changes: 7 additions & 24 deletions .github/workflows/BuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: js/developer/vendor/package-lock.json
# 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
with:
version: '4.4.4'
Expand All @@ -74,7 +71,7 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
# Ubuntu 26.04 ships GCC 16 in its main archive (no flaky toolchain PPA). The image already
# provides CMake, Ninja, Node.js, pkg-config and Xvfb, so install only the missing pieces.
# provides CMake, Ninja, pkg-config and Xvfb, so install only the missing pieces.
- name: Install GCC 16, WebKitGTK and coverage tools
if: runner.os == 'Linux'
run: |
Expand All @@ -93,11 +90,6 @@ jobs:
run: |
command -v sccache
sccache --version
- name: Prepare offline developer fixtures
run: |
npm ci --prefix js/developer/vendor --ignore-scripts
node js/developer/tools/build.mjs build-developer-environment
node js/developer/tools/fixtures.mjs build-developer-environment
# ENABLE_CACHE controls automatic ccache discovery; the explicit sccache launcher stays enabled.
- name: Configure
run: >-
Expand All @@ -106,7 +98,6 @@ jobs:
-DENABLE_CACHE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
${{ matrix.options }}
-DWEBFRONT_DEVELOPER_FIXTURES=${{ github.workspace }}/build-developer-environment
- name: Build
run: cmake --build build --config ${{ matrix.build_type }} --parallel 2
- name: Ensure WebView2 Evergreen runtime
Expand Down Expand Up @@ -182,9 +173,7 @@ jobs:
path: .cache/CPM
key: cpm-extended-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake') }}
restore-keys: cpm-extended-${{ runner.os }}-
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/setup-cmake
with:
version: '4.4.4'
Expand Down Expand Up @@ -253,9 +242,7 @@ jobs:
path: .cache/CPM
key: cpm-extended-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake') }}
restore-keys: cpm-extended-${{ runner.os }}-
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: ./.github/actions/remove-node

- uses: ./.github/actions/setup-cmake
with:
Expand All @@ -271,13 +258,9 @@ jobs:
echo "CC=clang-23" >> "$GITHUB_ENV"
echo "CXX=clang++-23" >> "$GITHUB_ENV"

- name: Prepare offline developer environment and starter fixtures
run: |
npm ci --prefix js/developer/vendor --ignore-scripts
node js/developer/tools/build.mjs build-developer-environment
node js/developer/tools/fixtures.mjs build-developer-environment
# 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 -DENABLE_TESTING=ON -DWEBFRONT_DEVELOPER_FIXTURES=${{github.workspace}}/build-developer-environment
run: cmake . -B ${{github.workspace}}/build-cef -DCMAKE_BUILD_TYPE=Release -DWEBFRONT_EMBED_CEF=ON -DWEBFRONT_BUILD_EXAMPLES=OFF -DENABLE_TESTING=ON

- name: Build browser test
run: cmake --build ${{github.workspace}}/build-cef --target webtest developer_integration webfront-wf --parallel 2
Expand Down
69 changes: 6 additions & 63 deletions .github/workflows/DeveloperDistribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'js/developer/vendor/package*.json'
- 'test/developer/**'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
Expand All @@ -27,7 +27,7 @@ on:
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'js/developer/vendor/package*.json'
- 'test/developer/**'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
Expand All @@ -54,58 +54,9 @@ env:
PUBLISHING: ${{ startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish) }}

jobs:
# The Node.js build and its tests are kept during the transition (#315 to #318): the wf-package job below compares its
# bytes with these, then publishes its own. #318 removes this job with the Node.js tools.
package:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: js/developer/vendor/package-lock.json
- name: Install pinned maintenance dependencies
run: npm ci --prefix js/developer/vendor --ignore-scripts
- name: Build and verify the environment and starter packages
run: |
node js/developer/tools/build.mjs build-distribution
node js/developer/tools/build.mjs build-distribution-repeat
cmp build-distribution/environment.tgz build-distribution-repeat/environment.tgz
cmp build-distribution/pi-starter.tgz build-distribution-repeat/pi-starter.tgz
cmp build-distribution/life-starter.tgz build-distribution-repeat/life-starter.tgz
# The pin names the last published version. Sources at that version must rebuild it; sources ahead of it
# leave the header pinning the published archive, which is checked against the deployed file.
pinned=$(sed -n 's/.*version{"\([^"]*\)"}.*/\1/p' include/webfront/system/DeveloperReleaseData.hpp)
building=$(node -p "require('./js/developer/tools/distribution.json').version")
if [ "$pinned" = "$building" ] || [ "$PUBLISHING" = true ]; then
cmp include/webfront/system/DeveloperReleaseData.hpp build-distribution/DeveloperReleaseData.hpp
else
echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned."
node js/developer/tools/pin-check.mjs
fi
node --test js/developer/tools/check.mjs js/developer/tools/distribution-check.mjs js/developer/tools/manifest-check.mjs js/developer/tools/restore-check.mjs js/developer/tools/scripts-check.mjs js/developer/tools/development-check.mjs js/developer/tools/testing-check.mjs
- name: Check the dedicated release tag
if: startsWith(github.ref, 'refs/tags/developer-v')
env:
RELEASE_TAG: ${{ github.ref_name }}
run: node js/developer/tools/release-check.mjs "$RELEASE_TAG"
- uses: actions/upload-artifact@v4
with:
name: developer-distribution-node
if-no-files-found: error
path: |
build-distribution/environment.tgz
build-distribution/pi-starter.tgz
build-distribution/life-starter.tgz
build-distribution/provision.json
build-distribution/DeveloperReleaseData.hpp

# The environment builds itself: the pinned bootstrap environment runs js/developer/scripts on these sources, with the
# locked build dependencies restored from npm. No Node.js, npm or npx is available to any step.
# locked build dependencies restored from npm. No JavaScript runtime or package manager is available to any step.
wf-package:
needs: package
runs-on: ubuntu-26.04
# The whole job takes about two minutes; a longer one is a stalled step (a package mirror, say): fail early.
timeout-minutes: 15
Expand Down Expand Up @@ -139,17 +90,9 @@ jobs:
echo "::notice::Sources build $building; DeveloperReleaseData.hpp still pins the published $pinned."
wf run pin
fi
# Transition: the Node.js build and the wf build must be the same bytes. #318 removes this comparison with the
# Node.js build.
- uses: actions/download-artifact@v4
with:
name: developer-distribution-node
path: build-distribution-node
- name: Compare with the Node.js build
run: |
for name in environment.tgz pi-starter.tgz life-starter.tgz provision.json DeveloperReleaseData.hpp; do
cmp "build-distribution/$name" "build-distribution-node/$name"
done
# The specs of the environment run by the project's own wf test, under the locked jasmine-core.
- name: Run the specs of the environment
run: wf test --timeout 300
- uses: actions/upload-artifact@v4
with:
name: developer-distribution
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ Thumbs.db
.webfront/

# Maintenance-only npm tooling
/js/developer/vendor/node_modules/
24 changes: 12 additions & 12 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The README introduces WebFront through the Game of Life walkthrough, demonstrati
- `include/webfront/system/`: layered virtual filesystems and the embedded web resources, a closed list guarded by the `MinimalCoreAssets` CTest case (normative list and 150 KiB decoded budget in ADR-016; changing it means amending the ADR and `test/cmake/CheckMinimalCoreAssets.cmake` together).
- `include/webfront/frontend/`: system-browser, CEF, optional Windows WebView2 and macOS WKWebView frontend adapters.
- `examples/`: only Hello World (`hello-world/`) and Game of Life (`life/`, with console, developer and embedded stages).
- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and vendoring tools. The repository is itself a `wf` project (`webfront.project.json` and its lock at the root): the environment builds itself, and `docs/NODE_TOOLS_MIGRATION.md` lists the remaining Node.js tools and their destination. Production C++ remains header-only in `include/webfront/`.
- `js/core/`: readable browser bridge, fallback and bootstrap loader compiled into `include/webfront/`, plus the embedding CMake modules; `js/developer/`: developer environment (its terminal and `wf`), the wf scripts that build it (`scripts/`), build and vendoring tools. The repository is itself a `wf` project (`webfront.project.json` and its lock at the root): the environment builds itself, and its pure JavaScript specs (`test/developer/`) run with `wf test`. `docs/NODE_TOOLS_MIGRATION.md` records where each former Node.js tool went. Production C++ remains header-only in `include/webfront/`.
- `js/developer/tools/starters/pi/`, `test/fixtures/`, `test/web/fixtures/`: retained package and regression fixtures, not public example applications.
- `test/unit/`: Catch2 unit tests; `test/web/`: real-browser integration (`suite/` is the WebFront project of the Jasmine specs, run by `webtest` through `wf test`); `test/driver/`: `webfront-wf`, the non-interactive `wf` driver for tests; `test/fuzz/`, `test/fixtures/`; `test/cmake/`: CMake test scripts and sub-projects. The `RepositoryLayout` CTest case pins the tracked root.
- `cmake/`: build modules (frontends, CEF, CPM, compiler options); `.github/`: workflows, `.github/CONTRIBUTING.md`.
Expand Down Expand Up @@ -51,18 +51,17 @@ ctest --test-dir build --output-on-failure --parallel 4
# Run one Catch2 scenario directly
./build/test/unit/tests "Scenario: JsFunction"

# Linux real-browser integration test (the Jasmine suite needs the offline registry of the fixtures)
node js/developer/tools/build.mjs build-developer-environment
node js/developer/tools/fixtures.mjs build-developer-environment
# Linux real-browser integration test: configure downloads and verifies the pinned bootstrap environment and the packages
# of the local npm registry; the tests build the rest with wf
cmake -S . -B build-cef -DCMAKE_BUILD_TYPE=Release \
-DWEBFRONT_EMBED_CEF=ON -DENABLE_TESTING=ON -DWEBFRONT_DEVELOPER_FIXTURES=$PWD/build-developer-environment
-DWEBFRONT_EMBED_CEF=ON -DENABLE_TESTING=ON
cmake --build build-cef --target webtest webfront-wf --parallel
ctest --test-dir build-cef -L web-integration --output-on-failure --parallel 4

```

Build the developer environment with wf (no Node.js; the driver comes from any build with `ENABLE_TESTING=ON`, here with
`-DWEBFRONT_REQUIRE_NODE=OFF`), as `js/developer/tools/PUBLISHING.md` describes:
Build the developer environment with wf (the driver comes from any build with `ENABLE_TESTING=ON`), as
`js/developer/tools/PUBLISHING.md` describes:

```bash
wf() { build/test/web/webfront-wf --project "$PWD" -- "$@"; }
Expand All @@ -71,16 +70,17 @@ wf restore && wf run build build-distribution

Important CMake options:

Tests and the `webfront-embedded-assets` regeneration target require Node.js for all
assets, including uncompressed ones. Normal C++ builds consume versioned headers
and do not require Node.js.
The headers of the embedded assets are generated, and checked by CTest, in pure CMake (`js/core/EmbedAsset.cmake`; the
`webfront-embedded-assets` target regenerates them). Normal C++ builds consume the versioned headers. Configuring with
`ENABLE_TESTING=ON` downloads the pinned bootstrap environment and the packages of the test registry, each verified
against its SHA-512; `-DWEBFRONT_BOOTSTRAP_DIR` and `-DWEBFRONT_REGISTRY_DIR` replace those downloads on a machine
without network access.

- `WEBFRONT_EMBED_CEF=OFF` (default): CEF is unavailable; this is the normal unit-test build. `ON` downloads/links CEF and enables the automated browser test; it makes `CEFFrontend` available but does not select it: `webfront::WebFront` always uses the system browser.
- `WEBFRONT_EMBED_WEBVIEW2=OFF` (default): Windows-only opt-in SDK and static loader for `WebView2Frontend`; requires the separately installed Evergreen runtime. Select it explicitly with `WebFrontWithFrontend<frontend::WebView2Frontend>`. With tests enabled, `WEBFRONT_WEBTEST_FRONTEND=WebView2` runs the shared Jasmine suite and lifecycle cases.
- `WEBFRONT_EMBED_WKWEBVIEW=OFF` (default): macOS 13.3+ opt-in Cocoa/WebKit frontend, with no engine download. Select `WebFrontWithFrontend<frontend::WKWebViewFrontend>` on the main thread; `WEBFRONT_WEBTEST_FRONTEND=WKWebView` runs Jasmine and lifecycle coverage.

- `ENABLE_TESTING=ON` (default `OFF`): build Catch2 and Jasmine test targets. CI and contributor commands must pass it explicitly.
- `WEBFRONT_REQUIRE_NODE=ON` (default): `ENABLE_TESTING=ON` requires Node.js for the maintenance tests that still use it (until #318). `OFF` configures without it and does not register those tests; only the job that proves a build without Node.js sets it.
- `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.
- `ENABLE_COVERAGE=ON`: add GCC/Clang coverage instrumentation to the C++ tests.

Expand Down Expand Up @@ -108,7 +108,7 @@ Exception: a purely C++ change that reuses an existing encoding, introduces no n
- Keep production implementation header-only under `include/`; `examples/` contains the two public examples; browser resources live in `js/`.
- Prefer standard-library facilities and explicit ownership. Keep public headers ODR-safe (`inline`/templates as appropriate).
- Catch2 tests use `SCENARIO`/`GIVEN`/`WHEN`/`THEN` and deterministic mocks.
- Jasmine specs are the project `test/web/suite/`, built by esbuild-wasm and run by `wf test` under the locked `jasmine-core` (installed from the local registry by `WebSuiteInstall`); `webtest` is the `webfront-wf` driver plus the C++ callbacks of the specs. The specs tell C++ they are done (`specsFinished`), the process status is that of `wf test` (or 1 when C++ did not observe every call), and the CTest case has a timeout. Without `WEBFRONT_DEVELOPER_FIXTURES` the Jasmine case is not registered.
- Jasmine specs are the project `test/web/suite/`, built by esbuild-wasm and run by `wf test` under the locked `jasmine-core` (installed from the local registry by `WebSuiteInstall`); `webtest` is the `webfront-wf` driver plus the C++ callbacks of the specs. The specs tell C++ they are done (`specsFinished`), the process status is that of `wf test` (or 1 when C++ did not observe every call), and the CTest case has a timeout. The registry the suite installs from is built by `wf run test-registry` (the `TestRegistry` case), from the packages that configure downloaded.
- Every bug fix needs a failing regression test at the lowest useful level. Bridge changes also need the browser integration test.
- Tests must not require user input, a fixed pre-existing browser session, or public network access after dependencies are configured.

Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ endif()
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
option(ENABLE_TESTING "Enable Test Builds" OFF)
option(WEBFRONT_BUILD_EXAMPLES "Build the example applications" ${WEBFRONT_IS_TOP_LEVEL})
option(WEBFRONT_REQUIRE_NODE "Require Node.js to register the maintenance tests that still use it (removed by #318)" ON)
option(ENABLE_COVERAGE "Enable test coverage instrumentation" OFF)
option(ENABLE_FUZZING "Enable Fuzzing Builds" OFF)
option(WEBFRONT_USE_MDDLOG "Use the compiled mddlog diagnostic adapter" OFF)
Expand Down
Loading
Loading