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.

Release packages on staging: merge-queue dispatches Packages there, main's run reuses it, release.yml promotes it; release.sh --staged puts the bump in the release batch

islandmed1b6654f14ce0
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index 8508b041..b2279443 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -5,8 +5,9 @@ name: Packages
# changes the app, so a tagged release can promote the packages of the commit it tags instead of building them again
# (.github/workflows/release.yml); the release workflow also calls it to build from scratch when there are none.
#
-# Integrity: the release promotes only artifacts of a successful run of THIS workflow on a push to main for exactly
-# the tagged commit (checked in release.yml). Compiler caches are restored here but saved only by branch runs (pushes
+# Integrity: the release promotes only artifacts of a successful run of THIS workflow for exactly the tagged commit,
+# either on a push to main or dispatched on `staging` by scripts/merge-queue.sh (checked in release.yml); main's push
+# then reuses the staging run (job reuse). Compiler caches are restored here but saved only by branch runs (pushes
# to main, maintainers' own dispatches): never from a tag (a release that calls this builds from main's cache and
# writes nothing) and never from a pull request (this workflow doesn't run on pull requests). See ci.yml for ccache.
# Runners: repository variables SF_RUNNER_* (Settings > Secrets and variables > Actions > Variables) name other
@@ -55,8 +56,43 @@ env:
SF_TEST_NO_NETWORK: '1'
jobs:
+ reuse:
+ # A batch that went through `staging` (scripts/merge-queue.sh staging) had this workflow dispatched there for the
+ # same commit; main's push then reuses that run instead of building it all again, and the release promotes the
+ # staging run's packages (release.yml, job locate). In progress: wait for it. Failed, cancelled or none: build.
+ name: Reuse the staging run
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ runs-on: ubuntu-24.04
+ timeout-minutes: 50
+ permissions:
+ contents: read
+ actions: read
+ outputs:
+ run-id: ${{ steps.find.outputs.run-id }}
+ steps:
+ - id: find
+ env:
+ GH_TOKEN: ${{ github.token }}
+ REPO: ${{ github.repository }}
+ SHA: ${{ github.sha }}
+ run: |
+ id=$(gh api "repos/$REPO/actions/workflows/packages.yml/runs?head_sha=$SHA&event=workflow_dispatch&branch=staging&per_page=5" \
+ --jq '[.workflow_runs[] | select(.head_sha == "'"$SHA"'" and .head_branch == "staging"
+ and .path == ".github/workflows/packages.yml" and .head_repository.full_name == "'"$REPO"'")][0].id // empty')
+ [ -n "$id" ] || { echo "No Packages run on staging for $SHA: building here"; exit 0; }
+ while [ "$(gh api "repos/$REPO/actions/runs/$id" --jq .status)" != completed ]; do sleep 30; done
+ conclusion=$(gh api "repos/$REPO/actions/runs/$id" --jq .conclusion)
+ if [ "$conclusion" = success ]; then
+ echo "::notice::$SHA's packages were built and tested on staging (run $id, https://github.com/$REPO/actions/runs/$id): reused, not rebuilt"
+ echo "run-id=$id" >> "$GITHUB_OUTPUT"
+ else
+ echo "Packages run $id on staging: $conclusion: building here"
+ fi
+
linux:
name: Linux ${{ matrix.arch }} (.deb, AppImage, .tar.gz)
+ needs: reuse
+ if: ${{ !cancelled() && needs.reuse.outputs.run-id == '' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -116,6 +152,8 @@ jobs:
# Built in the freedesktop SDK (packaging/flatpak/build.sh), installed, and UI tests run inside the sandbox.
flatpak:
name: Flatpak ${{ matrix.arch }}
+ needs: reuse
+ if: ${{ !cancelled() && needs.reuse.outputs.run-id == '' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -156,6 +194,8 @@ jobs:
vfx:
name: ${{ matrix.label }} ${{ matrix.arch }}
+ needs: reuse
+ if: ${{ !cancelled() && needs.reuse.outputs.run-id == '' }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.image }}
strategy:
@@ -231,6 +271,8 @@ jobs:
macos:
name: macOS (universal .dmg)
+ needs: reuse
+ if: ${{ !cancelled() && needs.reuse.outputs.run-id == '' }}
runs-on: ${{ vars.SF_RUNNER_MAC || 'macos-15' }}
steps:
- uses: actions/checkout@v7
@@ -280,6 +322,8 @@ jobs:
windows:
name: Windows x64 (installer, .zip)
+ needs: reuse
+ if: ${{ !cancelled() && needs.reuse.outputs.run-id == '' }}
runs-on: ${{ vars.SF_RUNNER_WIN || 'windows-2022' }}
steps:
- uses: actions/checkout@v7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 28b1dd69..3d9b517d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,9 +3,10 @@ name: Release
# A v* tag publishes a GitHub release (docs/releasing.md has the whole process; scripts/release.sh drives it).
#
# locate the tagged commit must carry the version the tag names (CMakeLists.txt's version, plus its
-# SCULPTFORGE_PRERELEASE for a beta: v0.11.0-beta.1 tags 0.11.0 with "beta.1"). If CI and the Packages
-# workflow (packages.yml) both succeeded on a push to main for exactly this commit, the release uses those
-# packages: built and tested once, promoted unchanged. Otherwise:
+# SCULPTFORGE_PRERELEASE for a beta: v0.11.0-beta.1 tags 0.11.0 with "beta.1"). If CI succeeded on a push to
+# main for exactly this commit and the Packages workflow (packages.yml) succeeded for it, on `staging` (the
+# release batch carried the bump) or on that push, the release uses those packages: built and tested once,
+# promoted unchanged. Otherwise:
# build the Packages workflow runs here, from the tag (compiler cache restored from main, never saved).
# smoke every package installed or unpacked on a fresh runner: the app opens a model and sculpts
# (tests/ui/release_smoke.sfui), sculptforge-cli opens, sculpts, saves and reopens (tests/release_smoke.py).
@@ -92,7 +93,12 @@ jobs:
and .path == ".github/workflows/'"$1"'" and .head_repository.full_name == "'"$REPO"'") | .id' | head -1
}
ci=$(runs ci.yml || true)
- pkg=$(runs packages.yml || true)
+ # The packages: the run on `staging` for exactly this commit (the release batch carried the bump: scripts/
+ # merge-queue.sh staging dispatches packages.yml there, and main's push run then reuses it), else main's own.
+ pkg=$(gh api "repos/$REPO/actions/workflows/packages.yml/runs?head_sha=$sha&event=workflow_dispatch&branch=staging&status=success&per_page=5" \
+ --jq '.workflow_runs[] | select(.head_sha == "'"$sha"'" and .head_branch == "staging" and .event == "workflow_dispatch"
+ and .path == ".github/workflows/packages.yml" and .head_repository.full_name == "'"$REPO"'") | .id' | head -1 || true)
+ [ -n "$pkg" ] || pkg=$(runs packages.yml || true)
if [ -z "$ci" ] && [ -n "$pkg" ]; then
# The bump commit adds only release paperwork (tools/release/paperwork_only.py: version lines, CHANGELOG,
# docs, site, fragments) to a main commit whose CI passed: that result stands (scripts/release.sh step ci).
@@ -113,6 +119,9 @@ jobs:
name: Build
needs: locate
if: needs.locate.outputs.run-id == ''
+ permissions:
+ contents: read
+ actions: read # packages.yml's reuse job asks for it (it skips itself here: not a push to main)
uses: ./.github/workflows/packages.yml
with:
ref: ${{ needs.locate.outputs.sha }}
diff --git a/changes/feat-packages-staging.md b/changes/feat-packages-staging.md
new file mode 100644
index 00000000..f02069ce
--- /dev/null
+++ b/changes/feat-packages-staging.md
@@ -0,0 +1,6 @@
+---
+changed: **Release packages on staging**: the merge batch builds the release packages on the `staging` branch beside
+ CI, and main reuses them. A release batch carries the version bump, so the release promotes packages that were
+ already built and tested for the exact tagged commit: tag to published takes about 5 minutes instead of about 25.
+---
+Contributor-facing only; nothing in the app changes.
diff --git a/docs/merge-queue.md b/docs/merge-queue.md
index 61955a8d..f068b9de 100644
--- a/docs/merge-queue.md
+++ b/docs/merge-queue.md
@@ -26,6 +26,8 @@ The merger's own batch (branches merged without pull requests, `~/Work/.sf/merge
`scripts/merge-queue.sh staging --with ~/Work/.sf/t1.sh HEAD`. The batch goes to the branch `staging`, the full CI runs
there while the PC runs the whole suite, and main fast-forwards when both pass. Either way, CI's run on main finds the
full run of the same commit and reuses it rather than building everything a second time (docs/testing-flow.md).
+Packages is dispatched on `staging` as well; main's Packages run reuses it. A red Packages run on staging doesn't hold
+main: main's push then builds its own packages, as before.
Cut, don't wait: what is green at cut time lands; the rest rides the next batch.
diff --git a/docs/releasing.md b/docs/releasing.md
index c3c7c783..f2519b20 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -14,7 +14,11 @@ the gates, what each step does, and how to recover.
1. **Merged tree, tested once on each machine** (docs/testing-flow.md): the merger's batch goes to the branch
`staging` (`scripts/merge-queue.sh staging --with ~/Work/.sf/t1.sh HEAD`). The whole suite runs on the PC (T1) while
the full CI runs on staging (T2), and main fast-forwards to the batch only when both are green. Nobody runs a
- second local full ctest.
+ second local full ctest. Packages (packages.yml) is built on staging too, beside CI. **The release batch carries
+ the bump**: `RELEASE=X.Y.Z [HIGHLIGHTS=f] ~/Work/.sf/merge-batch.sh <branches>` runs
+ `scripts/release.sh X.Y.Z --only bump --staged` on top of the merged batch (it commits, pushes nothing), so staging
+ builds and tests the packages of the exact commit that will be tagged. The release command afterwards finds the
+ versions already set, reuses CI and promotes those packages: tag to published is the smoke tests, about 5 minutes.
2. **Version and words**:
- 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
@@ -48,8 +52,10 @@ the gates, what each step does, and how to recover.
## Build once, promote
-A push to main runs CI and Packages. When the tag points at a commit for which both passed on main, the Release
-workflow takes **that run's packages unchanged** (it checks the commit, the workflow file and the event). It
+A push to main runs CI and Packages; a batch that went through `staging` already ran both there, and main's runs
+reuse them. When the tag points at a commit whose CI passed on main and whose Packages passed on staging or on main,
+the Release workflow takes **that run's packages unchanged** (it checks the commit, the workflow file, the branch and
+the event). It
smoke-tests them, then publishes. Nothing is compiled again, so a release takes a few minutes. Otherwise (for
example, the tag is on a commit Packages skipped), Release builds the packages itself from the tag.
diff --git a/docs/testing-flow.md b/docs/testing-flow.md
index 99d613b2..badd36d0 100644
--- a/docs/testing-flow.md
+++ b/docs/testing-flow.md
@@ -43,9 +43,12 @@ load to 65 on 12 threads and the compiler crashed. Each worktree fetches and bui
(`/root/wt/<name>/fc`); ccache (`CCACHE_BASEDIR=/root/wt`) is shared, so another worktree's objects are cache hits.
CI on main then doesn't build it all again. The `Changes` job sees that this exact commit passed a full run on
-staging, with both VFX jobs green, and passes as reused. The merger no longer runs a local full ctest.
+staging, with both VFX jobs green, and passes as reused. The merger no longer runs a local full ctest. The release
+packages (packages.yml) are built on staging beside CI, and main's Packages run reuses them (job `reuse`). A release
+batch carries the bump commit (`RELEASE=X.Y.Z ~/Work/.sf/merge-batch.sh ...`, docs/releasing.md), so its packages
+are the ones the release publishes.
-## Release: the bump reuses CI
+## Release: the bump reuses CI (or rides in the batch)
`scripts/release.sh` step `ci` used to wait about 20 minutes for CI on the bump commit. That commit only adds
paperwork to a commit CI had already passed. `tools/release/paperwork_only.py BASE HEAD` checks this file by file
@@ -91,8 +94,9 @@ Every tier runs ctest through `tools/test/run.py --build build [-- ctest args]`:
`sculptforge_tests_nightly`. The `tests/perf/*.sfui` scripts are `perf_*` (labels ui and nightly).
- `.github/workflows/nightly.yml` runs the nightly tests that don't need a GPU (`-L nightly -LE ui`) once a day.
- `~/Work/.sf/nightly.sh` is run by hand at the end of the day, not from cron. It runs `ctest -L nightly` on the PC's GPU, the whole suite with no
- cache, floor-tier stroke benchmarks on the laptop (`SF_HW_SIMULATE=floor`, only at load < 2), and an idle and
- calibration check on the Windows desktop (`win.sh`). The summary goes to `~/Work/.sf/nightly/<date>.md`.
+ cache, floor-tier stroke benchmarks on the laptop (`SF_HW_SIMULATE=floor`, only at load < 2), and, only on request
+ (`SF_NIGHTLY_WIN=1`: it opens a window on that desktop), an idle and calibration check on the Windows desktop
+ (`win.sh`). Every other app run is offscreen (`SDL_VIDEO_DRIVER=offscreen`). The summary goes to `~/Work/.sf/nightly/<date>.md`.
## Speculative CI
diff --git a/scripts/merge-queue.sh b/scripts/merge-queue.sh
index 4f766e9a..31453d5b 100755
--- a/scripts/merge-queue.sh
+++ b/scripts/merge-queue.sh
@@ -14,6 +14,9 @@
# while CMD runs here (e.g. '~/Work/.sf/pc.sh .', T1), and when both pass main
# fast-forwards to exactly that commit. CI's run on main then reuses the
# staging result (ci.yml, job Changes) instead of building it all again.
+# The release packages (packages.yml) are built on staging too, beside CI;
+# main's Packages run reuses them, and a release batch that carries the
+# bump (release.sh --staged) gets the packages it will publish.
#
# 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
@@ -150,6 +153,9 @@ land_staging() { # land_staging [--with CMD] [REF]
say "staging ${sha:0:8} ($(git log -1 --format=%s "$sha" | cut -c1-60)) on main $(git rev-parse --short origin/main)"
git push -q --force origin "$sha:refs/heads/staging"
git fetch -q origin staging
+ # Not waited for: a red Packages run doesn't hold main (main's push then builds its own, as before staging).
+ gh workflow run packages.yml -R "$REPO" --ref staging >/dev/null && echo " Packages dispatched on staging" ||
+ echo " note: couldn't dispatch Packages on staging: main's push builds them"
if [ -n "$with" ]; then
bash -c "$with" > "/tmp/merge-queue-with-${sha:0:8}.log" 2>&1 &
pid=$!
diff --git a/scripts/release.sh b/scripts/release.sh
index 84c64371..707ecac4 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -7,6 +7,9 @@
# 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
+# scripts/release.sh X.Y.Z --only bump --staged the bump commit only, not pushed: the merger puts it on top of
+# the release batch (RELEASE=X.Y.Z ~/Work/.sf/merge-batch.sh), so `staging` builds the packages of
+# the exact commit to tag while CI runs, and the release later only smoke-tests and publishes them
# HIGHLIGHTS=f scripts/release.sh X.Y.Z-beta.N --yes a beta (also -rc.N): a GitHub pre-release for testers, offered
# only to apps on the Preview update channel (see "Betas" below and docs/releasing.md)
# HIGHLIGHTS=file the update feed's 3-5 highlight lines, one per line (default: the version's highlight: lines in
@@ -27,7 +30,7 @@
# issue replies. The stable release later is plain scripts/release.sh X.Y.Z, which clears the prerelease.
# Needs: gh logged in as islandmed (gh auth status), git, curl, python3, sha256sum (or shasum); run it from a clean
# checkout of main. Pushes to main and the tag are made here, so only the release coordinator runs it, after
-# Tony's "ship it" for this version.
+# the owner's "ship it" for this version.
set -euo pipefail
REPO=islandmed/SculptForge
@@ -57,19 +60,21 @@ confirm() {
V=${1:-}
[[ "$V" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-((beta|rc)\.[0-9]+))?$ ]] ||
- { echo "usage: scripts/release.sh X.Y.Z[-beta.N|-rc.N] [--from STEP | --only STEP] [--yes]"; exit 2; }
+ { echo "usage: scripts/release.sh X.Y.Z[-beta.N|-rc.N] [--from STEP | --only STEP] [--yes] [--staged]"; exit 2; }
BASE=${BASH_REMATCH[1]} PRE=${BASH_REMATCH[3]} # 0.11.0-beta.1: BASE 0.11.0, PRE beta.1; a stable release: PRE ""
[ -z "$PRE" ] || STEPS=(bump check ci tag release preview status)
shift
-FROM=bump ONLY=
+FROM=bump ONLY= STAGED=
while [ $# -gt 0 ]; do
case $1 in
--from) FROM=$2; shift 2 ;;
--only) ONLY=$2; shift 2 ;;
--yes) YES=1; shift ;;
+ --staged) STAGED=1; shift ;;
*) echo "unknown argument $1"; exit 2 ;;
esac
done
+[ -z "$STAGED" ] || [ "$ONLY" = bump ] || { echo "--staged goes with --only bump (the later steps run on main after it lands)"; exit 2; }
T=v$V
TODAY=$(date +%F)
CURRENT=setup
@@ -266,7 +271,7 @@ preflight() {
pr=$(gh pr view "$OMARCHY_PR" -R omacom/omarchy-pkgs --json state,headRepositoryOwner,headRefName \
-q '.state + " " + .headRepositoryOwner.login + " " + .headRefName' 2>/dev/null || true)
read -r state owner branch <<<"$pr" || true
- [ "$state" = OPEN ] || die "omacom/omarchy-pkgs#$OMARCHY_PR is ${state:-unreadable}" "if it merged, open a version-bump PR for pkgbuilds/sculptforge/PKGBUILD there and set OMARCHY_PR in this script; if it was closed, ask Tony"
+ [ "$state" = OPEN ] || die "omacom/omarchy-pkgs#$OMARCHY_PR is ${state:-unreadable}" "if it merged, open a version-bump PR for pkgbuilds/sculptforge/PKGBUILD there and set OMARCHY_PR in this script; if it was closed, ask the owner"
gh_file "$owner/omarchy-pkgs" pkgbuilds/sculptforge/PKGBUILD "$branch" | grep -E "^sha256sums=\('[0-9a-f]{64}'" >/dev/null ||
die "the Omarchy PKGBUILD on $owner/omarchy-pkgs $branch has no sha256sums=('<64 hex>' line" "fix it on that branch"
ok "What's New, home page card, highlights, PKGBUILD, Homebrew tap and Omarchy PR #$OMARCHY_PR are ready"
@@ -274,9 +279,16 @@ preflight() {
# --- steps --------------------------------------------------------------------------------------------------------
-# Sets every version file to X.Y.Z, rebuilds the guide and the home page's What's New area, pushes main.
+# Sets every version file to X.Y.Z, rebuilds the guide and the home page's What's New area, pushes main (--staged:
+# commits on top of the checked-out batch and pushes nothing; scripts/merge-queue.sh staging lands it).
step_bump() {
- on_main
+ if [ -n "$STAGED" ]; then
+ [ -z "$(git status --porcelain --untracked-files=no)" ] || die "uncommitted changes" "commit them first (git status)"
+ git fetch -q origin main --tags
+ git merge-base --is-ancestor origin/main HEAD || die "HEAD does not contain origin/main" "merge origin/main into the batch first"
+ else
+ on_main
+ fi
preflight bump
local out
# A beta's #testers checklist comes from the fragments, so it is written before they go (step status names it).
@@ -372,6 +384,10 @@ PY
else
commit -m "Release $V: version files, CHANGELOG section, guide"
fi
+ if [ -n "$STAGED" ]; then
+ ok "version files at $V, guide rebuilt, committed $(git rev-parse --short HEAD) (not pushed: scripts/merge-queue.sh staging HEAD lands it)"
+ return
+ fi
push_main
ok "version files at $V, guide rebuilt, pushed main $(git rev-parse --short HEAD)"
}
@@ -431,7 +447,7 @@ step_tag() {
local sha
sha=$(git rev-parse HEAD)
confirm "Tag $T at $(git log -1 --format='%h %s' "$sha") and push it? This publishes SculptForge $V${PRE:+ as a GitHub pre-release for testers}." ||
- die "not confirmed" "run again and answer y (or YES=1) once Tony has said ship it for $V"
+ die "not confirmed" "run again and answer y (or YES=1) once the owner has said ship it for $V"
git rev-parse -q --verify "refs/tags/$T" >/dev/null || git tag "$T" "$sha"
gitp push -q origin "$T" || die "pushing $T failed" "git push origin $T (check gh auth status)"
ok "pushed $T"
@@ -555,7 +571,7 @@ step_omarchy() {
pr=$(gh pr view "$OMARCHY_PR" -R omacom/omarchy-pkgs --json state,headRepositoryOwner,headRefName \
-q '.state + " " + .headRepositoryOwner.login + " " + .headRefName' 2>/dev/null || true)
read -r state owner branch <<<"$pr" || true
- [ "$state" = OPEN ] || die "omacom/omarchy-pkgs#$OMARCHY_PR is ${state:-unreadable}" "if it merged, open a version-bump PR for $path there and set OMARCHY_PR in this script; if it was closed, ask Tony"
+ [ "$state" = OPEN ] || die "omacom/omarchy-pkgs#$OMARCHY_PR is ${state:-unreadable}" "if it merged, open a version-bump PR for $path there and set OMARCHY_PR in this script; if it was closed, ask the owner"
sum=$(tarball_sha)
if gh_file "$owner/omarchy-pkgs" "$path" "$branch" | grep -x "pkgver=$V" >/dev/null; then
ok "Omarchy PR #$OMARCHY_PR already builds $V"