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.

T0 on GitHub Actions: t0.yml + tools/ci/t0.sh (always green; verdict in the run summary and artifact t0-result)

islandmedbd6c64a9f061
diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml
index c9529ec1..4b4462bd 100644
--- a/.github/workflows/arch.yml
+++ b/.github/workflows/arch.yml
@@ -8,6 +8,7 @@ name: Arch package
on:
push:
+ branches-ignore: ['t0/**'] # T0 runs (t0.yml)
paths:
- packaging/arch/**
- .github/workflows/arch.yml
diff --git a/.github/workflows/prune-caches.yml b/.github/workflows/prune-caches.yml
index ed4217c6..35a8360b 100644
--- a/.github/workflows/prune-caches.yml
+++ b/.github/workflows/prune-caches.yml
@@ -7,7 +7,7 @@ name: Prune caches
on:
workflow_run:
- workflows: [CI, Packages]
+ workflows: [CI, Packages, T0]
types: [completed]
workflow_dispatch:
@@ -29,4 +29,4 @@ jobs:
sparse-checkout: tools/ci
- env:
GH_TOKEN: ${{ github.token }}
- run: python3 tools/ci/prune_caches.py ccache-ci- cmake-ci- ccache-pkg-
+ run: python3 tools/ci/prune_caches.py ccache-ci- cmake-ci- ccache-pkg- ccache-t0-
diff --git a/.github/workflows/repos.yml b/.github/workflows/repos.yml
index 4d97f715..269f159d 100644
--- a/.github/workflows/repos.yml
+++ b/.github/workflows/repos.yml
@@ -7,6 +7,7 @@ name: Package repositories
on:
push:
+ branches-ignore: ['t0/**'] # T0 runs (t0.yml)
paths:
- tools/publish/package_repos*.sh
- .github/workflows/repos.yml
diff --git a/.github/workflows/t0.yml b/.github/workflows/t0.yml
new file mode 100644
index 00000000..3a3a05c2
--- /dev/null
+++ b/.github/workflows/t0.yml
@@ -0,0 +1,83 @@
+name: T0
+
+# T0 of the test flow (docs/testing-flow.md) on GitHub's free runners, so branches don't queue for the PC: an agent
+# pushes its branch to refs/heads/t0/<branch> (~/Work/.sf/t0-ci.sh does, and deletes the ref after), this builds it
+# and runs tools/ci/t0.sh: check_marks, the build, the tests tools/test/impacted.py picks (CPU: Mesa llvmpipe, SDL
+# offscreen; GITHUB_ACTIONS gives the time limits their CI slack). The verdict is the run summary and the artifact
+# t0-result (result.json): the job itself always ends green, so a red T0 emails nobody.
+# On main (every push) it only builds, and saves the compiler cache ccache-t0-linux.<commit> every T0 starts from
+# (caches are per branch: a t0/ ref reads its own and main's; main's ci.yml runs mostly reuse staging's and build nothing).
+# Locked down (tools/release/check_workflows.py): pushes to main and t0/** only, contents: read, no secrets, pinned
+# actions, no shell tracing; caches are saved from main only, t0/ runs only restore them.
+
+on:
+ push:
+ branches: [main, 't0/**']
+
+permissions:
+ contents: read
+
+concurrency:
+ group: t0-${{ github.ref }}
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} # main's cache build always finishes
+
+jobs:
+ t0:
+ name: T0
+ runs-on: ubuntu-24.04
+ timeout-minutes: 60
+ continue-on-error: true # the verdict is the summary and t0-result: a red T0 (or a broken runner) emails nobody
+ env:
+ CCACHE_DIR: ${{ github.workspace }}/.ccache
+ CCACHE_BASEDIR: ${{ github.workspace }}
+ CCACHE_MAXSIZE: 500M
+ CCACHE_DEPEND: 'true'
+ SF_TEST_BUDGET: 150 # seconds per test, as ci.yml: software OpenGL on 4 cores
+ SF_DEPS_CACHE: .deps
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ fetch-depth: 0 # impacted.py: the merge base with origin/main and the last 600 commits' file lists
+ filter: blob:none
+ - name: Downloads (ci.yml's, restored only)
+ uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
+ with:
+ path: .deps
+ key: deps-build-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('cmake/Fetch.cmake', '.github/workflows/ci.yml') }}
+ restore-keys: deps-build-${{ runner.os }}-${{ runner.arch }}-
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
+ with:
+ python-version: '3.13' # as ci.yml: the same compile lines, so main's compiler cache hits
+ - name: Install dependencies
+ run: |
+ sudo ./packaging/linux/install-build-deps.sh >/dev/null
+ sudo apt-get install -y -qq --no-install-recommends ccache ninja-build libgl1-mesa-dri libegl1 mold >/dev/null
+ python -m pip install -q numpy
+ - name: Compiler cache (restore main's)
+ uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
+ with:
+ path: .ccache
+ key: ccache-t0-linux.${{ github.sha }}
+ restore-keys: |
+ ccache-t0-linux.
+ ccache-ci-linux-x86_64.
+ - name: Build (main; the cache for the T0 runs)
+ if: github.ref == 'refs/heads/main'
+ run: bash tools/ci/t0.sh --warm t0-result
+ - name: Compiler cache (save; main only)
+ if: github.ref == 'refs/heads/main'
+ uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
+ with:
+ path: .ccache
+ key: ccache-t0-linux.${{ github.sha }}
+ - name: T0 (never fails; the verdict is the summary and t0-result)
+ if: github.ref != 'refs/heads/main'
+ run: |
+ bash tools/ci/t0.sh t0-result
+ cat t0-result/summary.md >> "$GITHUB_STEP_SUMMARY"
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ if: always() && github.ref != 'refs/heads/main'
+ with:
+ name: t0-result
+ path: t0-result
+ retention-days: 7
diff --git a/docs/testing-flow.md b/docs/testing-flow.md
index dcd24459..81848beb 100644
--- a/docs/testing-flow.md
+++ b/docs/testing-flow.md
@@ -5,7 +5,7 @@ four times: by the agent, by the merger's full local ctest, by CI on main, and b
| tier | when | where | what | target |
|---|---|---|---|---|
-| **T0 impact** | every agent commit | the PC (laptop if the PC sleeps) | build + the tests the change can break | < 1 min |
+| **T0 impact** | every agent commit | the PC (laptop if the PC sleeps), or GitHub Actions while the PC queue is long | build + the tests the change can break | < 1 min |
| **T1 batch** | once per merge batch | the PC, while T2 runs | the whole suite, -j10 on the GPU, test cache on | < 5 min |
| **T2 platforms** | once per merge batch | CI on the branch `staging` | every platform, VFX Reference Platform, Blender | the gate for main |
| **T3 nightly** | once a day | CI (scheduled) + the PC | label `nightly`: benchmarks, stress, heavy meshes, floor-tier perf | |
@@ -29,6 +29,29 @@ four times: by the agent, by the merger's full local ctest, by CI on main, and b
Run it with `~/Work/.sf/t0.sh`: `pc.sh` builds on the PC, runs impacted.py there against the PC's build graph, then
runs the tests through `tools/test/run.py`.
+### T0 on GitHub Actions
+
+`SF_T0_CI=1 ~/Work/.sf/t0.sh` (automatic while more than 3 jobs wait for the PC, never with `SF_PC_PRIO=1`;
+`SF_T0_CI=0` turns it off) runs the same T0 on GitHub's free runners, so branches test in parallel instead of
+queueing for the PC. `~/Work/.sf/t0-ci.sh <worktree>` pushes the worktree's state to `t0/<branch>` (uncommitted work
+as a temporary commit; the worktree is not touched), waits for `.github/workflows/t0.yml`, prints the same lines as
+`t0.sh` and exits 0 green, 1 red, 3 unavailable (t0.sh then uses the PC); it deletes the `t0/` ref after. Results
+stay in `~/Work/.sf/t0-ci/<worktree>/`.
+
+- The run (`tools/ci/t0.sh`): `check_marks`, a Ninja build, impacted.py against the merge base with `origin/main`,
+ the picked tests through `run.py` on the CPU (Mesa llvmpipe, `SDL_VIDEO_DRIVER=offscreen`, `SF_TEST_BUDGET=150`;
+ `GITHUB_ACTIONS` gives the in-test time limits their CI slack).
+- **Always green**: the job is `continue-on-error` and the script never fails, so a red T0 emails nobody. The verdict
+ is the run summary and the artifact `t0-result` (`result.json`: green/red, stage, failed tests; `failed.txt`:
+ LastTestsFailed + FAILED lines; `output.txt`: `ctest --output-on-failure` on the failed tests).
+- **Cache**: every push to main builds once and saves `ccache-t0-linux.<commit>` (main's own CI mostly reuses
+ staging's run and builds nothing, and a `t0/` ref can only read its own and main's caches). `t0/` runs only restore.
+- **Locked down** (`tools/release/check_workflows.py`): pushes to main and `t0/**` only, `contents: read`, no
+ secrets, pinned actions; other branch-push workflows ignore `t0/**`.
+- A branch older than t0.yml gets it (and `tools/ci/t0.sh`) from origin/main in one extra commit, "t0-ci overlay";
+ the tests are still picked from the branch's own files.
+- The PC stays for GPU-specific checks (it runs the D3D12 GPU path), T1 and release staging.
+
## T1 and T2: one batch, two machines at once
The merger (`~/Work/.sf/merge-batch.sh`) merges the green branches, then calls
diff --git a/tools/ci/t0.sh b/tools/ci/t0.sh
new file mode 100755
index 00000000..9aec5a2d
--- /dev/null
+++ b/tools/ci/t0.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+# T0 on GitHub Actions (.github/workflows/t0.yml, docs/testing-flow.md): the same checks as ~/Work/.sf/t0.sh on the PC:
+# check_marks, then a build and only the tests this branch's changes can break (tools/test/impacted.py, against its
+# merge base with origin/main), CPU only (Mesa llvmpipe, SDL offscreen).
+# tools/ci/t0.sh [out dir, default t0-result]
+# tools/ci/t0.sh --warm the build only (t0.yml on main: saves the compiler cache every T0 starts from)
+# Never fails: the verdict goes to <out>/result.json ({"result": "green"|"red", "stage", "failed", "regex", ...}),
+# <out>/summary.md (the run summary) and <out>/output.txt (ctest --output-on-failure on the failed tests), so a red T0
+# sends nobody a failure email. ~/Work/.sf/t0-ci.sh pushes a branch to t0/<branch> and reads result.json back.
+warm=""; [ "$1" = --warm ] && { warm=1; shift; }
+out=${1:-t0-result}
+mkdir -p "$out"
+start=$(date +%s); build_s=0; test_s=0; stage=marks; regex=""; failed=""; result=red; base=""
+finish() {
+ python3 - "$out" "$result" "$stage" "$regex" "$build_s" "$test_s" "$(($(date +%s) - start))" "$base" "$failed" <<'EOF'
+import json, os, sys
+out, result, stage, regex, b, t, total, base, failed = sys.argv[1:]
+r = {"result": result, "stage": stage, "sha": os.environ.get("GITHUB_SHA", ""), "base": base, "regex": regex,
+ "failed": failed.split(), "build_s": int(b), "test_s": int(t), "total_s": int(total)}
+json.dump(r, open(f"{out}/result.json", "w"), indent=1)
+lines = [f"## T0 {result}" + ("" if result == "green" else f" ({stage})"), "",
+ f"- commit `{r['sha'][:8]}`, base `{base[:8]}`; build {b} s, tests {t} s, {total} s in all",
+ f"- tests: `{regex or 'none'}`"]
+if r["failed"]:
+ lines += ["- failed: " + " ".join(f"`{n}`" for n in r["failed"])]
+for name, title in (("failed.txt", "LastTestsFailed + FAILED lines"), ("output.txt", "output on failure (last 300 lines)")):
+ p = f"{out}/{name}"
+ if os.path.exists(p) and os.path.getsize(p):
+ lines += ["", f"### {title}", "", "```", open(p, errors="replace").read()[-60000:].rstrip(), "```"]
+open(f"{out}/summary.md", "w").write("\n".join(lines) + "\n")
+EOF
+ echo "T0 $result${failed:+: $failed}"
+ exit 0
+}
+
+# Marks first (as t0.sh): another app's name in a comment is red before anything is built.
+if [ -z "$warm" ] && ! python3 -I tools/check_marks.py > "$out/output.txt" 2>&1; then failed=check_marks; finish; fi
+: > "$out/output.txt"
+
+base=$(git merge-base origin/main HEAD 2>/dev/null || echo origin/main)
+# t0-ci.sh adds t0.yml to a branch based before it in one commit "t0-ci overlay: ...": tests come from the branch's own files.
+tip=HEAD; git log -1 --format=%s | grep -q '^t0-ci overlay' && tip=HEAD^
+stage=configure
+cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DSCULPTFORGE_USE_SYSTEM_SDL=OFF \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+ -DSCULPTFORGE_BUILD_PYTHON=ON ${pythonLocation:+-DPython_EXECUTABLE="$pythonLocation/bin/python3"} > "$out/configure.log" 2>&1 ||
+ { tail -60 "$out/configure.log" > "$out/output.txt"; finish; }
+
+# The whole build (a fresh build folder has no .ninja_deps, so headers can't map to tests before it; ccache makes the
+# rest cheap), then the impacted tests.
+stage=build
+t=$(date +%s)
+ccache -z >/dev/null 2>&1
+cmake --build build --parallel 4 > "$out/build.log" 2>&1; rc=$?
+build_s=$(($(date +%s) - t))
+ccache -s 2>/dev/null | tail -12
+[ -n "$warm" ] && { echo "warm build: exit $rc, $build_s s"; exit 0; }
+if [ $rc -ne 0 ]; then grep -E -A3 'error|FAILED' "$out/build.log" | head -150 > "$out/output.txt"; finish; fi
+
+stage=test
+mapfile -t files < <(git diff --name-only "$base" "$tip")
+git diff -U0 "$base" "$tip" -- CMakeLists.txt > "$out/cmake.diff" # (test-only CMake edits run just those tests)
+regex=""; [ ${#files[@]} -gt 0 ] && regex=$(python3 tools/test/impacted.py --build build --base "$base" -v --cmake-diff "$out/cmake.diff" \
+ --files "${files[@]}" 2> "$out/impacted.log")
+echo "T0: ${#files[@]} changed file(s) -> ${regex:-no tests}"
+if [ -z "$regex" ]; then result=green; finish; fi
+args=(-j 4); [ "$regex" != . ] && args+=(-R "$regex")
+t=$(date +%s)
+SDL_VIDEO_DRIVER=offscreen LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe \
+ python3 tools/test/run.py --build build --junit build/ctest.xml -- "${args[@]}" > "$out/ctest.log" 2>&1; rc=$?
+test_s=$(($(date +%s) - t))
+tail -40 "$out/ctest.log"
+if [ $rc -eq 0 ] && grep -q '^== [0-9]* run' "$out/ctest.log"; then result=green; finish; fi
+# Red: what failed (ctest's list from the first run, run.py's FAILED / over-budget lines), then their output.
+{ echo "LastTestsFailed.log:"; cat build/Testing/Temporary/LastTestsFailed.log 2>/dev/null
+ grep -E '^(FAILED|over budget|GPU lost): ' "$out/ctest.log"; } > "$out/failed.txt"
+failed=$( { sed -n 's/^FAILED: \([^ ]*\)$/\1/p; s/^over budget: \([^ ]*\).*/\1/p' "$out/ctest.log"; } | sort -u | tr '\n' ' ')
+[ -z "$failed" ] && failed=$(sed -n 's/^[0-9]*://p' build/Testing/Temporary/LastTestsFailed.log 2>/dev/null | sort -u | tr '\n' ' ')
+if [ -n "$failed" ]; then
+ SDL_VIDEO_DRIVER=offscreen LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe timeout 900 \
+ ctest --test-dir build --output-on-failure -R "^($(echo $failed | tr ' ' '|'))\$" 2>&1 | grep -vF '[ OK ]' | tail -300 > "$out/output.txt"
+else
+ tail -300 "$out/ctest.log" > "$out/output.txt"
+fi
+finish
diff --git a/tools/release/check_workflows.py b/tools/release/check_workflows.py
index fc911a2e..1ba84e0c 100755
--- a/tools/release/check_workflows.py
+++ b/tools/release/check_workflows.py
@@ -18,6 +18,10 @@
- integrations.yml (the Blender/Maya lanes) runs on anything but tag pushes, has an unpinned `uses:` or shell
tracing, reads a secret other than UPDATE_SIGNING_KEY (in `environment: release`, by a job that can't write), or
publishes without re-checking SHA256SUMS.txt.sig against the app's key (openssl pkeyutl -verify).
+ - t0.yml (T0 on GitHub's runners, ~/Work/.sf/t0-ci.sh) runs on anything but pushes to main and t0/**, can write,
+ reads a secret, has an unpinned `uses:` or shell tracing, saves a cache in a step not limited to main (t0/ runs
+ only restore), or can end red (its job must be continue-on-error: the verdict is the summary, a red T0 emails nobody).
+ - another workflow that runs on branch pushes would also run for t0/** refs (branches-ignore them).
Plain text parsing (no PyYAML): workflows here keep jobs at two spaces and their keys at four.
"""
@@ -124,6 +128,33 @@ def check(files):
errs.append(f"integrations.yml:{n}: `uses: {m.group(1)}` is not pinned to a full commit SHA")
if re.search(r"(^|[\s;])set\s+-[a-wyz]*x", line):
errs.append(f"integrations.yml:{n}: shell tracing (set -x)")
+ t0 = files.get("t0.yml")
+ if t0 is not None:
+ on = t0.split("\njobs:")[0]
+ if not re.search(r"^on:\s*\n\s+push:\s*\n\s+branches:\s*\[\s*main,\s*'t0/\*\*'\s*\]\s*$", on, re.M) or re.search(
+ r"\b(tags|pull_request|workflow_dispatch|schedule|workflow_run|issue_comment)\b", on):
+ errs.append("t0.yml: must run on pushes to main and t0/** only")
+ if "secrets." in t0:
+ errs.append("t0.yml: reads a secret")
+ if re.search(r":\s*write\b", t0) or not re.search(r"^permissions:\s*\n\s+contents:\s*read\s*$", t0, re.M):
+ errs.append("t0.yml: permissions must be contents: read only")
+ for step in re.split(r"\n(?= - )", t0):
+ if re.search(r"actions/cache(/save)?@", step) and "if: github.ref == 'refs/heads/main'" not in step:
+ errs.append("t0.yml: saves a cache in a step not limited to main (if: github.ref == 'refs/heads/main')")
+ for job, lines in jobs(t0).items():
+ if not any(re.match(r"^ continue-on-error:\s*true\b", l) for l in lines):
+ errs.append(f"t0.yml: job {job} isn't continue-on-error: true (a red T0 must not fail the run)")
+ for n, line in enumerate(t0.splitlines(), 1):
+ m = re.match(r"^\s*(?:-\s+)?uses:\s*(\S.*?)\s*$", line)
+ if m and not PINNED.match(m.group(1)):
+ errs.append(f"t0.yml:{n}: `uses: {m.group(1)}` is not pinned to a full commit SHA")
+ if re.search(r"(^|[\s;])set\s+-[a-wyz]*x", line):
+ errs.append(f"t0.yml:{n}: shell tracing (set -x)")
+ for name, text in files.items():
+ on = text.split("\njobs:")[0]
+ if name != "t0.yml" and re.search(r"^ push:\s*$", on, re.M) and not re.search(r"^ (branches|tags):", on, re.M) \
+ and "t0/**" not in on:
+ errs.append(f"{name}: runs on every branch push, t0/** too (add branches-ignore: ['t0/**'])")
rel = files.get("release.yml")
if rel is None:
return errs + ["release.yml: missing"]
@@ -249,6 +280,24 @@ jobs:
"""
+T0 = """on:
+ push:
+ branches: [main, 't0/**']
+permissions:
+ contents: read
+jobs:
+ t0:
+ runs-on: ubuntu-24.04
+ continue-on-error: true
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
+ - if: github.ref == 'refs/heads/main'
+ uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
+ - run: bash tools/ci/t0.sh
+"""
+
+
def self_test():
cases = {
"good": ({"release.yml": GOOD}, 0),
@@ -291,6 +340,19 @@ def self_test():
"integrations dispatch": ({"release.yml": GOOD, "integrations.yml": INTEGRATIONS.replace(
"jobs:", " workflow_dispatch:\njobs:", 1)}, 1),
"integrations set -x": ({"release.yml": GOOD, "integrations.yml": INTEGRATIONS.replace("run: gh release", "run: set -x; gh release")}, 1),
+ "t0 good": ({"release.yml": GOOD, "t0.yml": T0}, 0),
+ "t0 on all branches": ({"release.yml": GOOD, "t0.yml": T0.replace("[main, 't0/**']", "['**']")}, 1),
+ "t0 dispatch": ({"release.yml": GOOD, "t0.yml": T0.replace("permissions:", " workflow_dispatch:\npermissions:")}, 1),
+ "t0 write": ({"release.yml": GOOD, "t0.yml": T0.replace("contents: read", "contents: write")}, 1),
+ "t0 secret": ({"release.yml": GOOD, "t0.yml": T0 + " env: { K: '${{ secrets.X }}' }\n"}, 1),
+ "t0 unpinned": ({"release.yml": GOOD, "t0.yml": T0.replace("@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1", "@v7")}, 1),
+ "t0 cache save": ({"release.yml": GOOD, "t0.yml": T0.replace("cache/restore@", "cache/save@")}, 1),
+ "t0 cache save any ref": ({"release.yml": GOOD, "t0.yml": T0.replace(" - if: github.ref == 'refs/heads/main'\n uses", " - uses")}, 1),
+ "t0 can go red": ({"release.yml": GOOD, "t0.yml": T0.replace(" continue-on-error: true\n", "")}, 1),
+ "t0 set -x": ({"release.yml": GOOD, "t0.yml": T0.replace("run: bash", "run: set -x; bash")}, 1),
+ "t0 other on all branches": ({"release.yml": GOOD, "t0.yml": T0, "a.yml": "on:\n push:\n paths: [x]\njobs:\n a:\n"}, 1),
+ "t0 other ignores t0": ({"release.yml": GOOD, "t0.yml": T0,
+ "a.yml": "on:\n push:\n branches-ignore: ['t0/**']\n paths: [x]\njobs:\n a:\n"}, 0),
"env reader ok": ({"release.yml": GOOD, "x.yml": f"jobs:\n a:\n environment: other-env\n env:\n T: ${{{{ {TOKEN} }}}}\n"}, 0),
}
bad = [f"{k}: {check(f)}" for k, (f, n) in cases.items() if bool(check(f)) != bool(n)]