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
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,8 @@ js/developer/vendor/package-lock.json text eol=lf
js/developer/tools/starters/pi/* text eol=lf
examples/life/ui/* text eol=lf
js/developer/tools/* text eol=lf

# The wf project of the repository: its scripts, manifest and lock are hashed inputs of the self-build.
js/developer/scripts/* text eol=lf
webfront.project.json text eol=lf
webfront-packages.lock.json text eol=lf
22 changes: 22 additions & 0 deletions .github/actions/remove-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Remove Node.js
description: >-
Deletes node, nodejs, npm, npx and corepack from the runner (an ephemeral machine), then checks that none is reachable:
the steps that follow are the proof that a path needs no Node.js.
runs:
using: composite
steps:
- name: Remove Node.js, npm and npx
shell: bash
run: |
for tool in node nodejs npm npx corepack; do
while path=$(command -v "$tool"); do
sudo rm -f "$path" || exit 1
hash -r
done
done
for tool in node nodejs npm npx; do
if command -v "$tool"; then
echo "::error::$tool is still reachable"
exit 1
fi
done
42 changes: 42 additions & 0 deletions .github/actions/wf-driver/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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).
runs:
using: composite
steps:
- uses: ./.github/actions/setup-cmake
with:
version: '4.4.4'
# Ubuntu 26.04 ships GCC 16 in its main archive. The image already provides Ninja, pkg-config and Xvfb.
- name: Install GCC 16 and WebKitGTK
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 gcc-16 g++-16 libwebkitgtk-6.0-dev
echo "CC=gcc-16" >> "$GITHUB_ENV"
echo "CXX=g++-16" >> "$GITHUB_ENV"
- name: Build webfront-wf
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 \
-DCMAKE_CXX_SCAN_FOR_MODULES=OFF
cmake --build build-driver --target webfront-wf --parallel 2
- name: Install the wf command
shell: bash
run: |
bin="$RUNNER_TEMP/wf-bin"
mkdir -p "$bin"
# The sandbox opt-out is confined to this driver, which runs trusted sources and a verified environment.
cat > "$bin/wf" <<SCRIPT
#!/usr/bin/env bash
# Messages.hpp prints its encoding trace to the standard output: it is not part of a command's result.
export WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1
xvfb-run -a "$GITHUB_WORKSPACE/build-driver/test/web/webfront-wf" --project "$GITHUB_WORKSPACE" "\$@" 2>&1 \\
| grep --line-buffered -v -e '^-> encoded to string of size' -e '^bufferIndex = '
exit "\${PIPESTATUS[0]}"
SCRIPT
chmod +x "$bin/wf"
echo "$bin" >> "$GITHUB_PATH"
106 changes: 93 additions & 13 deletions .github/workflows/DeveloperDistribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,34 @@ on:
paths:
- 'js/developer/environment/**'
- 'js/developer/tools/starters/pi/**'
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'js/developer/vendor/package*.json'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
- '.github/actions/remove-node/**'
- '.github/actions/setup-cmake/**'
- '.github/workflows/DeveloperDistribution.yml'
pull_request:
branches: [develop, master]
paths:
- 'js/developer/environment/**'
- 'js/developer/tools/starters/pi/**'
- 'js/developer/scripts/**'
- 'examples/life/ui/**'
- 'js/developer/tools/**'
- 'js/developer/vendor/package*.json'
- 'webfront.project.json'
- 'webfront-packages.lock.json'
- 'cmake/WebFrontBootstrap.cmake'
- 'include/webfront/system/DeveloperReleaseData.hpp'
- '.github/actions/wf-driver/**'
- '.github/actions/remove-node/**'
- '.github/actions/setup-cmake/**'
- '.github/workflows/DeveloperDistribution.yml'
workflow_dispatch:
inputs:
Expand All @@ -36,9 +50,15 @@ concurrency:
group: developer-packages-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}

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
Expand All @@ -49,8 +69,6 @@ jobs:
- name: Install pinned maintenance dependencies
run: npm ci --prefix js/developer/vendor --ignore-scripts
- name: Build and verify the environment and starter packages
env:
PUBLISHING: ${{ startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish) }}
run: |
node js/developer/tools/build.mjs build-distribution
node js/developer/tools/build.mjs build-distribution-repeat
Expand All @@ -73,6 +91,65 @@ jobs:
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.
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
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/wf-driver
- name: Restore the locked build dependencies
run: wf restore
- name: Build the environment and starter packages twice
run: |
wf run build build-distribution
wf run build build-distribution-repeat
for name in environment.tgz pi-starter.tgz life-starter.tgz provision.json DeveloperReleaseData.hpp; do
cmp "build-distribution/$name" "build-distribution-repeat/$name"
done
echo "environment.tgz sha512-$(openssl dgst -sha512 -binary build-distribution/environment.tgz | base64 -w0)"
- name: Check the release tag and the pinned header
run: |
building=$(jq -r .version js/developer/tools/distribution.json)
if [[ "$GITHUB_REF" == refs/tags/developer-v* ]] && [ "$GITHUB_REF_NAME" != "developer-v$building" ]; then
echo "::error::Expected the dedicated tag developer-v$building"
exit 1
fi
# 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)
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."
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
- uses: actions/upload-artifact@v4
with:
name: developer-distribution
Expand All @@ -86,8 +163,9 @@ jobs:

publish:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/developer-v') || (github.event_name == 'workflow_dispatch' && inputs.publish))
needs: package
runs-on: ubuntu-24.04
needs: wf-package
runs-on: ubuntu-26.04
timeout-minutes: 15
permissions:
contents: write
pages: write
Expand All @@ -98,21 +176,23 @@ jobs:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: ./.github/actions/remove-node
- uses: ./.github/actions/wf-driver
- name: Restore the locked build dependencies
run: wf restore
- uses: actions/download-artifact@v4
with:
name: developer-distribution
path: build-distribution
- name: Check the configured Pages source before pushing
run: node js/developer/tools/pages.mjs --check
run: bash js/developer/tools/pages.sh --check
- name: Preserve existing versions and publish the static branch
shell: bash
run: |
set -euo pipefail
gh auth setup-git
site="$RUNNER_TEMP/developer-pages"
# In the workspace, since the wf script writes inside the project (permissions.publish of webfront.project.json).
site=build-site
git init --initial-branch=gh-pages "$site"
git -C "$site" remote add origin "https://github.com/$GITHUB_REPOSITORY.git"
result=0
Expand All @@ -123,19 +203,19 @@ jobs:
elif [ "$result" != 2 ]; then
exit "$result"
fi
node js/developer/tools/site.mjs build-distribution "$site"
wf run site build-distribution "$site"
git -C "$site" config user.name "$GITHUB_ACTOR"
git -C "$site" config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git -C "$site" add .nojekyll index.html developer
if ! git -C "$site" diff --cached --quiet; then
version=$(node -p "require('./js/developer/tools/distribution.json').version")
version=$(jq -r .version js/developer/tools/distribution.json)
git -C "$site" commit -m "Publish developer packages $version [#288]"
git -C "$site" push origin HEAD:refs/heads/gh-pages
fi
- name: Request the configured Pages build
run: node js/developer/tools/pages.mjs
run: bash js/developer/tools/pages.sh
- name: Archive tagged packages in a dedicated prerelease
if: startsWith(github.ref, 'refs/tags/developer-v')
env:
RELEASE_TAG: ${{ github.ref_name }}
run: node js/developer/tools/archive-release.mjs "$RELEASE_TAG" build-distribution
run: bash js/developer/tools/archive-release.sh "$RELEASE_TAG" build-distribution
11 changes: 10 additions & 1 deletion 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`), build and vendoring tools. 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 `docs/NODE_TOOLS_MIGRATION.md` lists the remaining Node.js tools and their destination. 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 @@ -61,6 +61,14 @@ 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:

```bash
wf() { build/test/web/webfront-wf --project "$PWD" -- "$@"; }
wf restore && wf run build build-distribution
```

Important CMake options:

Tests and the `webfront-embedded-assets` regeneration target require Node.js for all
Expand All @@ -72,6 +80,7 @@ and do not require Node.js.
- `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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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
15 changes: 15 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

### Added

- The developer environment builds itself (#315, sources of distribution 0.6.1, release pin unchanged at 0.6.0): the
repository is a `wf` project (`webfront.project.json`, `webfront-packages.lock.json`) and the scripts of
`js/developer/scripts/` run in the pinned bootstrap environment with `webfront-wf`. `build.mjs` bundles the environment
with the locked esbuild-wasm and writes `environment.tgz`, the starters, `provision.json` and the pinned header (with
`--refresh-bootstrap`, the bootstrap bundles, their checksums and the core headers); `site.mjs` stages the Pages site
and refuses to change a published version; `pin.mjs` checks the pinned header against the published archive; `embed-core.mjs` regenerates the core headers. The bytes
are those of the Node.js build, twice in a row (CTest `SelfBuild*`, job `wf-package` of *Developer packages*). The
publication runs without Node.js (`pages.sh`, `archive-release.sh`, a shell tag check); `-DWEBFRONT_REQUIRE_NODE=OFF`
configures a test build without it. The inventory of the Node.js tools and their destination is
`docs/NODE_TOOLS_MIGRATION.md`; the maintainer procedure is `js/developer/tools/PUBLISHING.md`.

- `webfront-wf` test driver and bootstrap provisioning (#321, developer distribution 0.6.0 published as `developer-v0.6.0`, pinned by `DeveloperReleaseData.hpp` and by the bootstrap): runs one `wf` command without interaction on a project
and exits with its status (64 usage, 70 bootstrap failure, 71 time limit, 72 no result), with an optional JSON report.
`cmake/WebFrontBootstrap.cmake` pins the bootstrap environment (0.6.0) and, with `ENABLE_TESTING=ON`, downloads
Expand Down Expand Up @@ -119,6 +130,10 @@

### Fixed

- `runNonInteractive` (developer environment 0.6.1) kept only the summary of a command: `output += await execute(...)` read
`output` before the command ran, so what it wrote meanwhile (a script's console output, install progress) was lost on
success. Regression test `WfDriverScriptOutput`.

- A browser's disconnection is now reported and its connection released: `WebLink` emits its `closed` event once when
the browser closes the connection or it fails. The event was never emitted before, so nothing observed
disconnections and every closed connection (socket, buffers) stayed until the application was destroyed. `BasicWF`
Expand Down
Loading
Loading