Skip to content

Latest commit

 

History

History
489 lines (373 loc) · 19 KB

production-build.md

File metadata and controls

489 lines (373 loc) · 19 KB

Varve — Production Build Commands

Evidence date: 2026-08-04 (CachyOS build measurements) Latest published release: v0.5.0 (2026-10-09) Verified on: CachyOS Linux (kernel 7.1.5, Wayland), Node v26.4.0, pnpm 11.9.0, rustc 1.97.1, tauri-cli 2.11.3, webkit2gtk-4.1 2.52.5, glibc 2.44

Every command below is marked VERIFIED (run on this machine, result recorded) or UNVERIFIED (correct as far as configuration goes, but never executed here — usually because it needs hardware we do not have).

Current release process: use release-candidate-runbook.md. This document preserves command-level build evidence from 2026-08-04; its historical full-suite examples are not a replacement for exact-SHA integration/candidate certification and must not be repeated before every packaging retry.


0. The one thing to know first — MEASURED

Do not ship a Linux package built on this machine. This is no longer an assumption; it was tested.

Installing the locally-built .deb into a clean ubuntu:22.04 container (just verify-packages) gives:

glibc available on Ubuntu 22.04 : 2.35
glibc required by the binary    : GLIBC_2.39

/usr/bin/varve-desktop: /lib/x86_64-linux-gnu/libc.so.6:
    version `GLIBC_2.39' not found (required by /usr/bin/varve-desktop)

The binary refuses to exec. Note the floor is 2.39, not 2.44 — a binary inherits the highest glibc symbol version it actually references, not the host's full version.

This also changed the CI runner. ubuntu-latest is Ubuntu 24.04, which is glibc 2.39 — building there produces exactly the same floor and silently excludes Ubuntu 22.04 LTS, Debian 12 and Fedora 38, while the docs claimed 22.04 support. release.yml now builds Linux artifacts on ubuntu-22.04, which sets the floor at 2.35.

Distro glibc Built on CachyOS / ubuntu-latest Built on ubuntu-22.04
Ubuntu 22.04 LTS 2.35 ✗ ✓
Debian 12 2.36 ✗ ✓
Fedora 38 2.37 ✗ ✓
Ubuntu 24.04 LTS 2.39 ✓ ✓

Local packages are for smoke-testing only.


1. Clean dependency install — VERIFIED

pnpm install --frozen-lockfile

Result: exit 0, "Already up to date", no lockfile drift.

postinstall runs two scripts: copy-onnx-wasm.mjs (local copy from node_modules) and fetch-onnxruntime.mjs (downloads ~25 MB of ONNX Runtime from GitHub, pinned to 1.27.1 and checksum-verified before extraction).

For a genuinely cold checkout, verify that the bundled AI model weights are present before building. Bundled weights are committed directly; this repository no longer uses Git LFS for models:

node scripts/release/check-bundled-assets.mjs   # fails loudly if you skipped it

The current manifest declares five bundled models (u2netp, u2netp-int8, yunet-face-detect, realesr-general-x4v3, and realesr-general-x4v3-int8). Other models, including font-classify.onnx, are not bundled and are downloaded on demand when a feature requests them (see packages/engine/src/inference/modelCatalog.ts).


2. Historical quality-gate evidence — VERIFIED on 2026-08-04

pnpm lint          # exit 0 (48 warnings, no errors)
pnpm typecheck     # exit 0
pnpm test          # exit 0
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --all-targets

Note: one perf-budget unit test (computes diff for 10,000 nodes quickly (<50ms)) failed at 114 ms when run concurrently with a cargo build saturating the CPU, and passed cleanly when run alone. It is a wall-clock assertion with no isolation — treat a failure under load as contention, not regression.


3. Frontend production build — VERIFIED

pnpm --dir apps/desktop build      # tsc --noEmit && vite build

Result: exit 0, ~2m 25s, 7,370 modules.

Output is 147 MB in apps/desktop/dist, and all of it is embedded in the desktop binary:

Part Size Note
ort-wasm/ 93 MB Every onnxruntime-web variant (ort.all.*, ort.jspi.*, minified and not)
assets/ 42 MB Includes a single 10.1 MB JS chunk (2.66 MB gzipped)
models/ 13 MB Bundled ONNX models

Both the 93 MB of unused ORT variants and the 10 MB monolithic chunk are the obvious size wins, and both matter for the 4 GB RAM target.


4. Rust release build — VERIFIED

cargo build --release --manifest-path apps/desktop/src-tauri/Cargo.toml

Result: exit 0. 38m 47s from a cold cache. Produces a 71 MB apps/desktop/src-tauri/target/release/varve-desktop.

Profile (Cargo.toml [profile.release]): opt-level = 3, lto = "thin", codegen-units = 1, strip = true. Good for size and speed; strip = true means no symbols are retained for crash triage — see §9.


5. Linux packages

deb and rpm — VERIFIED

just package-deb          # or: package-rpm
# equivalently:
cd apps/desktop && pnpm tauri build --bundles deb,rpm --ci

AppImage — VERIFIED, with a required workaround

just package-appimage     # sets NO_STRIP=1 for you

NO_STRIP=1 is mandatory on Arch/CachyOS. Without it the build fails with only:

failed to bundle project: `failed to run linuxdeploy`

The real error is visible only by invoking linuxdeploy directly:

ERROR: Strip call failed: strip: libzstd.so.1: unknown type [0x13] section `.relr.dyn'

linuxdeploy 1-alpha (built 2024-07-26) bundles a binutils strip that predates SHT_RELR. Every system library on a current Arch host has a .relr.dyn section, so stripping fails for all of them and linuxdeploy aborts. NO_STRIP=1 skips that step, which costs essentially nothing: the Varve binary is already stripped by the release profile, and distro libraries ship stripped.

This is set in justfile (package-linux, package-appimage) and in release.yml's Tauri build step.

WebKit EGL vs AppImageHub (AppImage only). linuxdeploy-plugin-gtk bundles the GTK/WebKit closure from the ubuntu-22.04 baseline, including Mesa/EGL when the host has them. bundleMediaFramework stays false, so GStreamer plugins and gst-plugin-scanner are not shipped. On distros with a newer Mesa stack the bundled libEGL fails display creation (EGL_BAD_PARAMETER) and the window stays white. v0.1.1 through v0.5.1 deleted the entire usr/lib toolkit so the AppImage used host WebKit like the .deb. That fixed the white screen and failed AppImageHub: a clean offline VM has no libwebkit2gtk-4.1.so.0.

The next pack keeps WebKitGTK/GTK and deletes host GPU/EGL/Mesa/DRI/Vulkan libraries plus system-sensitive copies (libstdc++, libgcc_s, libwayland-*). It then re-assembles with --exclude-library '*' so linuxdeploy cannot copy Mesa back in. Bundled WebKit talks to host libEGL. WEBKIT_DISABLE_DMABUF_RENDERER=1 (APPIMAGE-gated in apps/desktop/src-tauri/src/lib.rs) remains the compositor fallback. libc is unbundled (glibc 2.35 floor). The release smoke launches the AppImage in ubuntu:22.04 and fedora:latest containers without libwebkit2gtk and with --network none.

The just package-linux, just package-appimage, and just package-linux-dev recipes run this prune step automatically after Tauri bundling. The cleanup preserves Varve-owned resources, including the native ONNX Runtime and generative helper, and removes stale foreign-platform runtime directories from a reused AppDir. The release workflow performs the same post-bundle verification before signing and collection.

Local bundles never require the updater signing key. tauri.conf.json sets createUpdaterArtifacts: true for the release pipeline, which signs the AppImage with TAURI_SIGNING_PRIVATE_KEY. That key is release-only, so an un-overridden local build bundles the AppImage and then aborts with "A public key has been found, but no private key" — before the prune step runs. The three Linux packaging recipes merge createUpdaterArtifacts: false for their own invocation; release.yml still signs with the real key. Nothing committed changes, and local bundles simply have no .sig (the updater is not part of manual test installs).

Testing a local AppImage on another machine

just package-appimage is the supported way to produce a production-profile AppImage for hands-on testing on other machines (release profile, --features ai, native ONNX Runtime). Two properties are inherited from this host and travel with the file:

  1. glibc floor. Only the release workflow pins the Ubuntu 22.04 (glibc 2.35) floor; a build on a current rolling host references the host's newest libc symbols. Measured floor for the 2026-09-20 local build: GLIBC_2.43 (acosf, asinf, …) and GLIBC_2.44 (cosh, sinh). The AppImage starts on distros at or above that glibc (current Arch/CachyOS) and fails on older ones with version 'GLIBC_2.44' not found (Ubuntu 24.04 is 2.39). For a build that runs on the release compatibility baseline, use the ubuntu-22.04 runner in release.yml.
  2. Bundled WebKit, host Mesa. The pack keeps WebKitGTK/GTK and drops bundled Mesa/EGL, so a machine without libwebkit2gtk-4.1 can still launch, and a newer host GPU stack is not shadowed. On a FUSE-less machine, run with --appimage-extract-and-run.

Both machines can verify a published transfer with sha256sum on the AppImage name from that release (Varve-0.5.0-linux-x86_64.AppImage for v0.5.0; Varve-<version>-x86_64.AppImage from the next release). The build measurements above remain the historical 2026-08-04 host snapshot.

All Linux formats at once

just package-linux

6. Target-specific desktop builds

# macOS, Apple Silicon — on a Mac or a macos-latest runner
rustup target add aarch64-apple-darwin
cd apps/desktop && pnpm tauri build --target aarch64-apple-darwin --bundles dmg --ci

# Linux ARM64 — use a native ubuntu-22.04-arm runner. Do not use QEMU for
# AppImage release validation: Tauri's current linuxdeploy path cannot
# cross-compile ARM AppImages.
rustup target add aarch64-unknown-linux-gnu
cd apps/desktop && pnpm tauri build --target aarch64-unknown-linux-gnu --bundles appimage,deb,rpm --ci

Local ARM64 AppImage on an x86_64 host — emulated, test artifact only

For a local test artifact (never release validation) the only route is an emulated aarch64 userland, because Tauri cannot cross-bundle an AppImage: its linuxdeploy/appimagetool toolchain runs on the target architecture.

# one-time: register qemu-user binfmt through Docker (no sudo needed)
docker run --privileged --rm tonistiigi/binfmt --install arm64

# arm64 Ubuntu 22.04 container (glibc 2.35 floor). FUSE is required: Tauri
# spawns linuxdeploy's appimage output plugin as a nested AppImage and that
# plugin does not inherit APPIMAGE_EXTRACT_AND_RUN.
docker run -d --name varve-arm64 --platform linux/arm64 \
  --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
  -v <tree>:/work -v <cargo-cache>:/root/.cargo -v <rustup-cache>:/root/.rustup \
  -w /work ubuntu:22.04 sleep infinity

Build the tree on real disk, not /tmp — on this host /tmp is a 12 GB tmpfs; a Rust target directory there fails with ENOSPC and consumes RAM.

Container packages beyond the usual Tauri set — each missing one was a distinct build failure: libclang-dev clang (bindgen for diffusion-rs-sys), cmake (stable-diffusion.cpp/ggml), xdg-utils (the AppImage bundler requires xdg-open), squashfs-tools (appimagetool shells out to mksquashfs).

Emulation gotchas:

  • vite build (rolldown) can deadlock in its thread pool under qemu. Run it separately with RAYON_NUM_THREADS=1 UV_THREADPOOL_SIZE=1 and then build with --config '{"build":{"beforeBuildCommand":"true"}}' so Tauri does not re-run it.
  • linuxdeploy aborting with std::logic_error: subprocess failed (exit code 2) means the nested plugin AppImage could not mount (no FUSE) or mksquashfs is absent.
  • If the nested AppImage still cannot exec, package directly with the native x86_64 appimagetool — it is architecture-independent and ARCH selects the runtime it embeds: ARCH=aarch64 appimagetool-x86_64.AppImage --no-appstream <AppDir> after copying the icon named by the desktop file's Icon= entry to the AppDir root.
  • NO_STRIP=1, as on the host.

The result bundles no GTK/WebKit (the AppDir only carries the app and its own usr/lib/Varve resources), so the prune step has nothing to remove, and being built on Ubuntu 22.04 it has the release glibc floor rather than the rolling host floor of a local x86_64 build.

# Windows ARM64 — use Windows with the C++ ARM64 MSVC build tools installed.
rustup target add aarch64-pc-windows-msvc
cd apps/desktop && pnpm tauri build --target aarch64-pc-windows-msvc --bundles nsis --ci

# Windows x86-64 — on Windows or a windows-latest runner
cd apps/desktop && pnpm tauri build --target x86_64-pc-windows-msvc --bundles nsis --ci

Note the macOS build deliberately targets aarch64, not universal: the bundled ONNX Runtime has no macOS Intel library — upstream discontinued macOS x86_64 binaries at v1.24.1 (last line 1.23.0) — so a "universal" binary would be half-degraded (audit H-3; full dependency audit in docs/plans/macos-intel-feasibility.md).

For Windows ARM64, Tauri documents that the NSIS bootstrapper may remain an x86 process under emulation while the installed varve-desktop.exe is native ARM64. Verify the installed executable header; never infer application architecture from the installer filename.

The release workflow uses the canonical entries in scripts/release/targets.mjs, passes each Rust target explicitly, verifies the native executable header, and runs Linux package/AppImage smoke tests on both native Linux architectures. These checks are necessary but do not replace a real editor workflow and native ONNX inference on ARM hardware.

The honest way to get a first result for either is to run .github/workflows/release.yml via workflow_dispatch with platforms: linux-windows or all and read the logs.


6b. Versioning between releases: push gate + dev snapshot builds

Releases are versioned by tag (vX.Y.Z stable, vX.Y.Z-alpha.1 prerelease; channel policy — latest published STABLE, else latest published PRERELEASE — lives in fetch-website-release.mjs). Between releases, the committed version is the last released one, and three things keep that from becoming a lie:

  1. Push-time drift gate. ci.yml pipeline-validate runs node scripts/release/version.mjs verify on every push/PR, and the pre-push hook prints a warning on drift. Version changes among the five manifests (root + app package.json, tauri.conf.json, workspace + desktop Cargo.toml) can no longer land on master silently and surface only at tag time.

  2. Post-release bump. After a release publishes, bump the committed version so the tree always carries the NEXT number:

    just release-bump patch        # 0.1.0 -> 0.1.1 (major|minor|patch)
    cargo check --workspace && cargo check --manifest-path apps/desktop/src-tauri/Cargo.toml
    # commit manifests + both lockfiles + CHANGELOG

    bump drops any prerelease suffix (0.1.0-beta.2 -> bump patch -> 0.1.1); use release-set-version for explicit numbers.

  3. Dev/test builds get snapshot versions. just package-linux-dev builds AppImage + deb with version <release>-dev.<short-sha> (from version.mjs snapshot, deterministic per HEAD, read-only — nothing committed changes):

    just package-linux-dev
    # -> Varve_0.1.0-dev.c5920958b894_amd64.AppImage etc.

    A dev bundle is therefore distinguishable from the last release and from every other dev bundle — no ambiguous same-version reinstall of different content, and no testing an artifact you cannot name.


7. Collect, checksum, verify — VERIFIED

Verified end-to-end against synthetic bundles (collect → merge → verify → notes). The version guard refuses to run at 0.0.0, so set a version first:

node scripts/release/version.mjs set 0.1.0
cargo check --workspace                                              # refresh Cargo.lock
cargo check --manifest-path apps/desktop/src-tauri/Cargo.toml        # and the app's
node scripts/release/version.mjs verify v0.1.0

node scripts/release/collect-artifacts.mjs \
  --bundle-dir apps/desktop/src-tauri/target/release/bundle \
  --out dist/release --os linux --arch x86_64

node scripts/release/verify-artifacts.mjs --dir dist/release --expect-version 0.1.0

Artifacts are renamed to <Product>-<version>-<os>-<arch>.<ext> (the product name is read from tauri.conf.json, so it follows a rename), hashed, and described in dist/release/release-manifest.json + SHA256SUMS.txt.

Independent check (this is what a user runs):

cd dist/release && sha256sum -c SHA256SUMS.txt

8. SBOM — VERIFIED

node scripts/release/generate-sbom.mjs --out dist/release/varve-0.1.0-sbom.cdx.json

Result: CycloneDX 1.5, 1,324 components — 715 cargo, 603 npm, 1 vendored binary (ONNX Runtime), 4 bundled models (u2netp, u2netp-int8, realesr-general-x4v3, realesr-general-x4v3-int8; font-classify is no longer bundled).

No external tooling required (no syft, no cargo-cyclonedx). Uses cargo metadata --locked across both Cargo workspaces — the Tauri app is a separate workspace, so a root-only scan would miss tauri, wry and everything else that actually ships.

If it fails with a --locked error, the lockfile is stale relative to a version bump; run the two cargo check commands in §7.


9. Debug symbols — KNOWN GAP

[profile.release] strip = true discards symbols, so the "unstripped binary" artifact release.yml uploads for crash triage is not actually unstripped.

To retain symbols without shipping them, add a profile that inherits release but keeps debug info, build releases with it, and upload the symbols as a private workflow artifact rather than a release asset:

[profile.release-symbols]
inherits = "release"
strip = "none"
debug = 1

Deferred: it roughly doubles build time and there is no crash-reporting pipeline to consume the symbols yet.


10. Release dry run — VERIFIED

Everything except tagging and publishing:

node scripts/release/check-bundled-assets.mjs
node scripts/release/version.mjs verify
pnpm lint && pnpm typecheck && pnpm test
cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings

just package-linux
node scripts/release/collect-artifacts.mjs --out dist/release --os linux --arch x86_64
node scripts/release/generate-sbom.mjs --out dist/release/varve-sbom.cdx.json
node scripts/release/verify-artifacts.mjs --dir dist/release
cd dist/release && sha256sum -c SHA256SUMS.txt

Nothing here contacts GitHub or publishes anything.


11. Website — VERIFIED

pnpm --filter @varve/website build      # exit 0, 69 routes, 0 errors

# with a custom domain later:
SITE_URL=https://example.com SITE_BASE=/ pnpm --filter @varve/website build

After a release, point the download page at it:

node scripts/release/fetch-website-release.mjs \
  --repo K-Arthur/varve --tag vX.Y.Z