Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Merge queue script and docs, CI-aware timing limits, release train v2 design

islandmed797945725c45
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 08693fbc..95df2f52 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,7 +5,6 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled]
- merge_group: # the merge queue (docs/merge-queue.md): every PR is tested on top of main before it lands
workflow_dispatch:
inputs:
full:
@@ -23,7 +22,7 @@ concurrency:
# Compiler cache (ccache). Every job compiles through ccache and starts from the newest cache of the same job; ccache
# hashes the compiler and the preprocessed source with every flag, so a hit is the object file that compiler would
# produce, and anything changed compiles fresh. Caches are saved only by push and workflow_dispatch runs (main, or a
-# maintainer's own branch): pull_request and merge_group runs, forks included, only restore them (actions/cache/restore), so nothing a
+# maintainer's own branch): pull_request runs, forks included, only restore them (actions/cache/restore), so nothing a
# pull request builds can end up in another run. GitHub scopes caches by branch as well: a branch reads its own and
# main's, never another branch's. Release packages (packages.yml) restore main's caches and never save from a tag.
# Keys are ccache-ci-<job>.<commit>: the dot keeps one job's prefix from matching another's (one key may start with another's).
@@ -41,7 +40,7 @@ jobs:
# app), docs no build or test reads (docs/guide and docs/supporters.txt are built in), note fragments or release
# paperwork skip the build and test jobs; their required checks then pass as skipped.
# `full`: the slow platform checks (VFX Reference Platform containers, Blender add-on in Blender) run on main, in the
- # merge queue, on a dispatch with full=true and on a pull request labelled full-ci; other branch runs skip them.
+ # merge queue's batch run (scripts/merge-queue.sh), on a dispatch with full=true and on a pull request labelled full-ci; other branch runs skip them.
changes:
name: Changes
runs-on: ubuntu-24.04
@@ -55,9 +54,9 @@ jobs:
REPO: ${{ github.repository }}
EVENT: ${{ github.event_name }}
BEFORE: ${{ github.event.before }}
- BASE: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
- HEAD: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
- FULL: ${{ github.ref == 'refs/heads/main' || github.event_name == 'merge_group' || inputs.full == true || contains(github.event.pull_request.labels.*.name, 'full-ci') }}
+ BASE: ${{ github.event.pull_request.base.sha }}
+ HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
+ FULL: ${{ github.ref == 'refs/heads/main' || inputs.full == true || contains(github.event.pull_request.labels.*.name, 'full-ci') }}
run: |
echo "full=$FULL" | tee -a "$GITHUB_OUTPUT"
base=$BASE
diff --git a/docs/design/release-train.md b/docs/design/release-train.md
new file mode 100644
index 00000000..c474408f
--- /dev/null
+++ b/docs/design/release-train.md
@@ -0,0 +1,122 @@
+# Release train v2: design
+
+Status: design only (nothing here is built yet). v1 is in place: CI under 10 minutes for branches, note fragments
+(`changes/<branch>.md`), the merge queue (`scripts/merge-queue.sh`, [docs/merge-queue.md](../merge-queue.md)),
+one-command releases (`scripts/release.sh`). v2 is about shipping more often with less risk: users choose how new
+they want it, risky features ship dark, and hardware we can't run in CI is checked by people before a release.
+
+Every item below adds no port, no listener and no code from the network. Where an item touches the network or
+accounts it says so, and needs Tony's OK before it is built.
+
+## 1. Channels: Stable, Preview, Nightly
+
+| channel | what | built by | who |
+|---|---|---|---|
+| Stable | tagged releases (today's) | release.yml | everyone, the default |
+| Preview | the next release while testers check it (`X.Y.Z-rc.N`) | release.yml from a `vX.Y.Z-rc.N` tag, published as a GitHub pre-release | testers, anyone who opts in |
+| Nightly | main, once a day if it changed and CI and Packages were green | a scheduled job promoting that day's Packages artifacts to a rolling `nightly` pre-release | developers, bug reporters asked to confirm a fix |
+
+**Feed.** `website/latest.json` keeps its top-level fields (old apps read them and stay on Stable) and gains:
+
+```json
+"channels": {
+ "preview": { "version": "0.11.0-rc.2", "download": "https://github.com/islandmed/SculptForge/releases/tag/v0.11.0-rc.2",
+ "notes": "https://sculptforge.app/guide/whats-new.html#version-0110", "highlights": ["..."] },
+ "nightly": { "version": "0.11.0-dev.20261110", "commit": "1065d2c", "download": "https://github.com/islandmed/SculptForge/releases/tag/nightly" }
+}
+```
+
+`parseUpdateFeed` (src/core/UpdateCheck.h) reads the channel's entry and falls back to the top level. A channel
+never offers something older than Stable: when Stable passes the Preview, Preview users are offered Stable.
+`compareVersions` must order `0.11.0-rc.2 < 0.11.0` (today it ignores the suffix): rc and dev suffixes sort below the
+plain version.
+
+**App.** Help > Update channel: Stable / Preview / Nightly (radio, saved in the preferences). The title bar and
+About show the channel for anything but Stable ("0.11.0-rc.2 Preview"). The update banner is the same; it still only
+opens the download page (no download or install from the app: that would be new attack surface).
+
+**Release script.** `scripts/release.sh X.Y.Z-rc.N` runs the same steps minus site/AUR/brew/Omarchy, and step
+`status` writes `channels.preview`. The nightly job writes `channels.nightly` through the Pages workflow.
+
+**Insiders.** Insider builds (private sculptforge-insiders repo) stay separate from Preview: the public wording is
+"Insiders will get each release about two weeks early, starting with SculptForge 1.0." Before 1.0, Preview is the
+public release candidate. Open question for Tony: from 1.0 on, is Preview for Insiders only (then the channel shows
+only to signed-in members, which needs an account check: not before Tony decides), or public with Insiders getting
+features two weeks earlier through feature flags (section 2)?
+
+## 2. Feature flags
+
+Risky or unfinished features merge early and ship dark instead of waiting on long-lived branches.
+
+- `src/core/FeatureFlags.h`: a compiled-in table `{id, description, default per channel}`; `flag("quadremesh3")`.
+ Defaults: off on Stable, on on Nightly, chosen per flag on Preview.
+- Preferences > Experimental lists the flags with a switch each (on any channel), saved in the preferences.
+ `SF_FLAGS=+id,-id` and `--flag id=on` for tests and studios (studios can pin them, like `SF_AI=off`).
+- UI tests and ctest run with every flag on (and the Stable defaults in one extra UI pass), so dark code is tested.
+- A flag is deleted within two releases of going on by default; `ctest flags_have_owners` fails on a flag older
+ than that (a date in the table).
+- No remote flags: switching features from the feed would be remote configuration of every install (attack surface,
+ and surprising). If ever wanted, Tony decides.
+
+## 3. Hardware matrix gate
+
+CI has no tablets or GPUs; the Windows Ink and Wacom bugs (#72) came from hardware we didn't have.
+
+- A matrix file `docs/hardware-matrix.md`: classes, not models: Windows + Wacom driver (Ink on / off), Windows +
+ Windows Ink only (Surface, XP-Pen, Huion), macOS + Wacom, Linux Wayland + tablet, Linux X11, low-end iGPU,
+ high-DPI 150-200%.
+- Fragments mark what a branch touches: `hardware: tablet, dpi` in the front matter (a new key for
+ assemble_notes.py). The #testers checklist groups its bullets by class.
+- Testers report on the Preview build with the Test-this panel (section 6); results land as one GitHub issue per
+ release (`Release X.Y.Z hardware check`) with a checkbox per class.
+- `release.sh X.Y.Z` (non-rc), step check: if any fragment of the release names a class, that class needs one
+ pass on the issue, or the release stops with the list of missing classes. `--waive tablet` with a reason in the
+ release notes exists for emergencies.
+
+## 4. Pen flight recorder
+
+For "the pen does something weird" reports that we can't reproduce.
+
+- A ring buffer of the last 30 seconds of raw input in memory: SDL pen/mouse/touch events with timestamps, pressure,
+ tilt, proximity, the device and driver path chosen (Wintab / Windows Ink / Wacom Bridge / libinput), focus changes,
+ plus what the app did with each (stroke start, camera move, Part switch). Fixed size (about 2 MB), no file until
+ asked.
+- Help > Report a pen problem: writes `pen-recording-<time>.sfpen` (JSON lines, gzip) to the logs folder and opens
+ the folder; the bug template asks for it. Nothing is sent anywhere by the app.
+- `sculptforge --replay-pen file.sfpen` feeds it back through the same input code in a UI test, so a report becomes
+ a regression test (`tests/ui/pen_replays/`). The file holds no screen or mesh content; only input.
+- Privacy: on by default, because it holds only input timing and positions, in memory, written only when the user
+ asks. The guide's privacy page says so.
+
+## 5. Screenshot-diff approval
+
+Tony's polish bar: every visible change is looked at before merge.
+
+- The UI tests already save screenshots (`shot` in tests/ui/*.sfui, uploaded as `ui-shots-*` artifacts). Main's
+ Linux x86_64 shots (Mesa llvmpipe, deterministic enough) become the baseline artifact for each main commit.
+- A PR's Linux run compares its shots with its base commit's: `tools/ci/shot_diff.py` (pixel difference above a
+ small threshold after a 1 px blur, so font hinting noise doesn't count) writes a page of before / after / diff for
+ every changed shot, uploaded as an artifact and linked in the job summary.
+- Any changed shot adds a required check `Screenshots` that stays pending until a maintainer labels the PR
+ `shots-approved` (the merge queue skips PRs without it). No changed shots: the check passes by itself.
+- macOS and Windows shots are not compared (fonts and drivers differ); they stay as artifacts.
+
+## 6. Test-this panel
+
+Testers in #testers get a checklist; today they read it in Discord and answer in free text.
+
+- Preview and Nightly builds embed the release's #testers checklist (the `testers` bullets of the fragments,
+ `assemble_notes.py X.Y.Z --testers`, generated at build time into the binary like the guide).
+- Help > Test This Build: the checklist with Pass / Fail / Skip and a note per item, the hardware class detected
+ (OS, tablet driver path, GPU, scale) filled in, and "Copy report" (Markdown for #testers or the release issue).
+ "Open issue" opens a prefilled GitHub new-issue URL in the browser (the user sends it, signed in as themselves).
+ The app itself sends nothing (no new network path, no token).
+- A Fail item offers "Save pen recording" when the item is in the tablet class (section 4).
+
+## Order
+
+1. Feature flags (unblocks merging early; no infrastructure).
+2. Channels: Nightly first (artifacts already exist per main commit), then Preview with rc tags.
+3. Screenshot diff (CI only).
+4. Test-this panel + hardware matrix gate (needs 1 and 2: testers on Preview).
+5. Pen flight recorder.
diff --git a/docs/merge-queue.md b/docs/merge-queue.md
new file mode 100644
index 00000000..df9662a6
--- /dev/null
+++ b/docs/merge-queue.md
@@ -0,0 +1,30 @@
+# Merge queue
+
+Branches land on main through pull requests and `scripts/merge-queue.sh`; nobody pushes main by hand. (GitHub's own
+merge queue exists only for organization-owned repositories; this one belongs to a user, so the script does the
+same job.)
+
+## For a branch (any agent)
+
+1. Branch from `origin/main`, one note fragment `changes/<branch>.md` instead of CHANGELOG / What's New edits
+ ([changes/README.md](../changes/README.md)).
+2. Full ctest green locally (`~/Work/.sf/heavy.sh`), push the branch, `gh pr create --fill`.
+3. The PR's CI runs the fast set (Linux x86_64 and ARM64, macOS, Windows over 4 runners; about 10 minutes). Add the
+ label `full-ci` for the VFX Reference Platform and Blender add-on jobs too (build or packaging changes).
+4. `scripts/merge-queue.sh add <pr>`, write REPORT.md, tell the coordinator.
+
+## For the coordinator
+
+`scripts/merge-queue.sh run` in the background (one at a time). It merges main plus every queued PR whose own checks
+are green into a branch `queue/batch-<time>`, runs the full CI there (everything, as on main), and when that is
+green moves main to exactly that commit; the PRs show as merged. A PR that conflicts or is red is dropped with a
+comment and the `queue-failed` label; its author fixes the branch and queues it again. A red batch falls back to
+`--serial` (update each PR from main, wait for its checks, merge), which isolates the PR that broke it.
+`scripts/merge-queue.sh list` shows the queue.
+
+Cut, don't wait: what is green at cut time lands; the rest rides the next batch.
+
+## Timing checks on CI
+
+Speed checks in tests use `timeLimit(ms)` (tests/TestHarness.h): the given limit on a developer machine, four times it
+on CI runners (shared, loaded VMs), and the strict limit again with `SF_BENCH_LIMITS=1`, as benchmarks are judged.
diff --git a/docs/releasing.md b/docs/releasing.md
index 5185f8fe..477a2b43 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -14,10 +14,14 @@ the gates, what each step does, and how to recover.
1. **Merged tree, tested locally**: on main with the branches for this release merged, `ctest --test-dir build -j3`
all green.
2. **Version and words**:
- - written by people, on main before the release: CHANGELOG entries under `[Unreleased]`; docs/guide/whats-new.md
- `## Version X.Y.Z`, with tests/ui/whats_new.sfui expecting it; its ```features block (date: unreleased, a tagline,
- highlights and cards: the app's What's New window, the guide, and the home page's card and lede come from it); the 3-5 feed highlights (`HIGHLIGHTS=`);
- - set by step `bump`: the version in CMakeLists.txt, CITATION.cff (with date-released), packaging/rez/package.py
+ - written by people, on main before the release: one note fragment per branch, `changes/<branch>.md`
+ (changes/README.md: the What's New bullet, CHANGELOG entry and section, highlight, #testers bullets); in
+ docs/guide/whats-new.md `## Version X.Y.Z`, with tests/ui/whats_new.sfui expecting it, its ```features block
+ (date: unreleased, a tagline, highlights and cards: the app's What's New window, the guide, and the home page's
+ card and lede come from it). The 3-5 feed highlights are the version's `highlight:` lines (What's New and
+ fragments), or `HIGHLIGHTS=file` to override;
+ - set by step `bump`: the fragments go into CHANGELOG `[Unreleased]` and What's New and are deleted
+ (tools/release/assemble_notes.py); the version in CMakeLists.txt, CITATION.cff (with date-released), packaging/rez/package.py
and the metainfo `<release>`; CHANGELOG `[Unreleased]` becomes `## [X.Y.Z] - date` under a new empty
`[Unreleased]`; website/guide is rebuilt. Don't bump version files by hand.
diff --git a/scripts/merge-queue.sh b/scripts/merge-queue.sh
new file mode 100755
index 00000000..b1df6e9f
--- /dev/null
+++ b/scripts/merge-queue.sh
@@ -0,0 +1,158 @@
+#!/usr/bin/env bash
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# The merge queue (docs/merge-queue.md): agents open pull requests and add them to the queue; the release
+# coordinator runs the queue, which lands them on main tested on top of main. Nobody pushes main by hand.
+# (GitHub's own merge queue needs an organization-owned repository; this one belongs to a user.)
+#
+# scripts/merge-queue.sh add <pr>... queue pull requests (label "queue"); any session may do this
+# scripts/merge-queue.sh list the queue, oldest first, with each PR's check state
+# scripts/merge-queue.sh run [--serial] land the queue (the coordinator, in the background)
+#
+# run, batch mode (the default): main plus every queued PR merged in queue order on a branch queue/batch-<time>
+# (a PR that conflicts, or whose own checks are red, is dropped with a comment and the "queue-failed" label), the
+# full CI on that branch (VFX Reference Platform and Blender add-on included), and when it is green main moves to it
+# (a fast-forward, so the tested tree is exactly what lands; GitHub marks the PRs merged). If main moved meanwhile
+# the batch is rebuilt. A red batch falls back to --serial, which finds the PR that broke it.
+# run --serial: one PR at a time: bring it up to date with main (gh pr update-branch), wait for its checks, merge.
+set -euo pipefail
+
+REPO=islandmed/SculptForge
+LABEL=queue
+FAILED=queue-failed
+cd "$(git rev-parse --show-toplevel)"
+
+say() { printf '\033[1m== %s\033[0m\n' "$*"; }
+die() { printf '\033[1;31m%s\033[0m\n' "$*" >&2; exit 1; }
+
+queued() { # PR numbers with the queue label, oldest first
+ gh pr list -R "$REPO" --label "$LABEL" --state open --json number,createdAt -q 'sort_by(.createdAt) | .[].number'
+}
+
+ensure_labels() {
+ gh label create "$LABEL" -R "$REPO" --color 0e8a16 --description "Merge queue: scripts/merge-queue.sh lands it" 2>/dev/null || true
+ gh label create "$FAILED" -R "$REPO" --color d93f0b --description "Merge queue dropped it: see the comment" 2>/dev/null || true
+}
+
+drop() { # drop <pr> <why>
+ gh pr edit "$1" -R "$REPO" --remove-label "$LABEL" --add-label "$FAILED" >/dev/null
+ gh pr comment "$1" -R "$REPO" --body "Merge queue: dropped. $2 Fix it on the branch, then \`scripts/merge-queue.sh add $1\`." >/dev/null
+ echo " dropped #$1: $2"
+}
+
+checks_green() { # the PR's own required checks passed (skipped counts as passed)
+ local bad
+ bad=$(gh pr checks "$1" -R "$REPO" --required --json state -q '[.[] | select(.state != "SUCCESS" and .state != "SKIPPED")] | length' 2>/dev/null || echo x)
+ [ "$bad" = 0 ]
+}
+
+wait_ci() { # wait_ci <branch>: dispatches the full CI on the branch, waits, returns its conclusion
+ local branch=$1 sha id=""
+ sha=$(git rev-parse "origin/$branch")
+ gh workflow run ci.yml -R "$REPO" --ref "$branch" -f full=true >/dev/null
+ for _ in $(seq 60); do
+ id=$(gh run list -R "$REPO" --workflow ci.yml --branch "$branch" --event workflow_dispatch --json databaseId,headSha \
+ -q "[.[] | select(.headSha == \"$sha\")][0].databaseId")
+ [ -n "$id" ] && break
+ sleep 5
+ done
+ [ -n "$id" ] || die "no CI run started for $branch"
+ echo " CI: https://github.com/$REPO/actions/runs/$id" >&2
+ gh run watch "$id" -R "$REPO" --exit-status --interval 30 >/dev/null 2>&1 && echo success || echo failure
+}
+
+run_serial() {
+ local pr
+ for pr in $(queued); do
+ say "#$pr"
+ if ! gh pr update-branch "$pr" -R "$REPO" >/dev/null 2>&1; then
+ drop "$pr" "It conflicts with main."
+ continue
+ fi
+ sleep 10 # the update starts a new check suite
+ if ! gh pr checks "$pr" -R "$REPO" --required --watch --fail-fast --interval 30 >/dev/null 2>&1 || ! checks_green "$pr"; then
+ drop "$pr" "Its checks failed on top of main."
+ continue
+ fi
+ gh pr merge "$pr" -R "$REPO" --merge --delete-branch >/dev/null
+ echo " merged #$pr"
+ done
+}
+
+run_batch() {
+ local prs=() merged=() pr head base branch
+ mapfile -t prs < <(queued)
+ [ ${#prs[@]} -gt 0 ] || { echo "queue is empty"; return 0; }
+ git fetch -q origin main
+ base=$(git rev-parse origin/main)
+ branch="queue/batch-$(date +%Y%m%d-%H%M%S)"
+ say "batch $branch on main ${base:0:7}: ${prs[*]}"
+ local wt
+ wt=$(mktemp -d)
+ git worktree add -q --detach "$wt" "$base"
+ for pr in "${prs[@]}"; do
+ if ! checks_green "$pr"; then
+ drop "$pr" "Its own checks are not green."
+ continue
+ fi
+ head=$(gh pr view "$pr" -R "$REPO" --json headRefName -q .headRefName)
+ git fetch -q origin "$head"
+ if git -C "$wt" merge -q --no-ff --no-edit -m "Merge $head (#$pr)" FETCH_HEAD >/dev/null 2>&1; then
+ merged+=("$pr")
+ else
+ git -C "$wt" merge --abort
+ drop "$pr" "It conflicts with main or with a PR ahead of it in the queue."
+ fi
+ done
+ if [ ${#merged[@]} -eq 0 ]; then
+ git worktree remove --force "$wt"
+ return 0
+ fi
+ git -C "$wt" push -q origin "HEAD:refs/heads/$branch"
+ git worktree remove --force "$wt"
+ if [ "$(wait_ci "$branch")" != success ]; then
+ git push -q origin --delete "$branch"
+ say "batch red: landing one at a time to find the PR that broke it"
+ run_serial
+ return
+ fi
+ git fetch -q origin main
+ if [ "$(git rev-parse origin/main)" != "$base" ]; then
+ git push -q origin --delete "$branch"
+ say "main moved while the batch ran: again on the new main"
+ run_batch
+ return
+ fi
+ git push -q origin "origin/$branch:refs/heads/main" # a fast-forward: exactly the tree CI passed
+ git push -q origin --delete "$branch"
+ for pr in "${merged[@]}"; do
+ gh pr edit "$pr" -R "$REPO" --remove-label "$LABEL" >/dev/null 2>&1 || true
+ echo " landed #$pr"
+ done
+}
+
+case ${1:-} in
+add)
+ shift
+ [ $# -gt 0 ] || die "usage: scripts/merge-queue.sh add <pr>..."
+ ensure_labels
+ for pr in "$@"; do
+ gh pr edit "$pr" -R "$REPO" --add-label "$LABEL" --remove-label "$FAILED" >/dev/null 2>&1 ||
+ gh pr edit "$pr" -R "$REPO" --add-label "$LABEL" >/dev/null
+ echo "queued #$pr"
+ done
+ ;;
+list)
+ gh pr list -R "$REPO" --label "$LABEL" --state open --json number,title,headRefName,createdAt,statusCheckRollup \
+ -q 'sort_by(.createdAt) | .[] | "#\(.number) \(.headRefName) \([.statusCheckRollup[]? | .conclusion // .status] | unique | join(",")) \(.title)"'
+ ;;
+run)
+ ensure_labels
+ if [ "${2:-}" = --serial ]; then run_serial; else run_batch; fi
+ ;;
+*)
+ sed -n '5,18p' "$0" | sed 's/^# \{0,1\}//'
+ exit 2
+ ;;
+esac
diff --git a/scripts/release.sh b/scripts/release.sh
index 57e6674e..8c4552f7 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -7,7 +7,8 @@
# HIGHLIGHTS=notes.txt scripts/release.sh X.Y.Z --yes every step, in order (the normal way: one command)
# scripts/release.sh X.Y.Z --from site resume at a step (after fixing what stopped it)
# scripts/release.sh X.Y.Z --only replies one step
-# HIGHLIGHTS=file the update feed's 3-5 highlight lines, one per line (needed until latest.json says X.Y.Z)
+# HIGHLIGHTS=file the update feed's 3-5 highlight lines, one per line (default: the version's highlight: lines in
+# What's New and the note fragments, tools/release/assemble_notes.py X.Y.Z --highlights)
# (the home page's What's New area is written by tools/guide/build_site.py from docs/guide/whats-new.md: the
# version's ```features block, its tagline and pictures; CARD is no longer used)
#
diff --git a/tests/TestHarness.h b/tests/TestHarness.h
index 2f3498d8..2ca14f9c 100644
--- a/tests/TestHarness.h
+++ b/tests/TestHarness.h
@@ -10,6 +10,7 @@
#include <cstddef>
#include <cstdio>
+#include <cstdlib>
#include <filesystem>
#include <functional>
#include <string>
@@ -44,6 +45,15 @@ inline bool inShard(std::size_t index, int shard, int shards) {
return shards <= 1 || index % static_cast<std::size_t>(shards) == static_cast<std::size_t>(shard);
}
+// A wall-clock limit for a speed check: the value given on a developer machine, four times that on a CI runner
+// (CI or GITHUB_ACTIONS set: shared, often loaded virtual machines, where Windows runners have flaked at 1.1x), and
+// the value itself again with SF_BENCH_LIMITS=1, which is how benchmarks are judged.
+inline double timeLimit(double local) {
+ const char* strict = std::getenv("SF_BENCH_LIMITS");
+ if (strict && std::string(strict) == "1") return local;
+ return std::getenv("CI") || std::getenv("GITHUB_ACTIONS") ? local * 4.0 : local;
+}
+
inline std::string tempPath(const char* name) { return (std::filesystem::temp_directory_path() / name).string(); }
} // namespace sf::test
@@ -64,3 +74,4 @@ inline std::string tempPath(const char* name) { return (std::filesystem::temp_di
using sf::test::makeDoc;
using sf::test::tempPath;
+using sf::test::timeLimit;
diff --git a/tests/test_surface_cursor.cpp b/tests/test_surface_cursor.cpp
index ca411722..b8cc8113 100644
--- a/tests/test_surface_cursor.cpp
+++ b/tests/test_surface_cursor.cpp
@@ -107,5 +107,5 @@ TEST(surface_cursor_cost_is_rays_not_mesh_passes) {
}
const double ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count() / n;
std::printf(" surface cursor on %zu triangles: %.3f ms per update\n", m.triangles.size(), ms);
- CHECK(ms < 5.0);
+ CHECK(ms < timeLimit(5.0));
}
diff --git a/tests/test_texture_transfer.cpp b/tests/test_texture_transfer.cpp
index 168319b4..399002b9 100644
--- a/tests/test_texture_transfer.cpp
+++ b/tests/test_texture_transfer.cpp
@@ -359,8 +359,8 @@ TEST(texture_transfer_speed_at_4k_on_a_million_triangles) {
std::printf(" texture transfer at 4K: new UVs on %zu tris %.0f ms (2 planes); from the surface of %zu tris onto %zu tris "
"%.0f ms (%zu texels)\n",
m.triangleCount(), ms(t0, t1), m.triangleCount(), target.triangleCount(), ms(t2, t3), ss.texels);
- CHECK(ms(t0, t1) < 5000.0);
- CHECK(ms(t2, t3) < 20000.0);
+ CHECK(ms(t0, t1) < timeLimit(5000.0));
+ CHECK(ms(t2, t3) < timeLimit(20000.0));
}
// --- Material channels (core/TextureChannels.h) travel with the texture ---