Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

Release: promote a candidate instead of compiling again. A release whose code is an rc's (only the README, the workflows and the release tools may differ) is that rc's attested binaries packed again as the release: raea's version isn't compiled in (release.sh writes share/raea/VERSION; rc3's five binaries hold no "0.1.1-rc3"), so what ships is what the rc's checks ran, in minutes instead of a three-hour cold build. release.yml reads the tag's "promoted-from: <rc>" line (or the promote_from input; none builds from source) through tools/release/promoted-from.sh, which refuses, naming the files, when any code differs; each job then takes the rc's archive for its platform through tools/release/promoted-bins.sh (sha256, and gh attestation verify against release.yml and the rc's tag), its symbols from the rc's run, and packs, checks, attests and attaches as before. release.sh keeps a promoted Linux binary's carried symbols instead of stripping it twice. dry_run (by hand) packs and checks without attesting or attaching. Tested: rc5 against main passes the code check and rc4 is refused with its files; rc3's Mac archive downloads, verifies and unpacks

shinyobjectzf96fdda16a53
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fbb2707f..3cc9a46a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -8,6 +8,11 @@
# git tag -a v0.1.0 -m "raea 0.1.0" -m "skills-passed: <full sha>"
# A tag with a suffix (v0.1.0-rc1, v0.1.0-canary.3) is made a pre-release; a plain version (v0.1.0) is a full release,
# GitHub's latest. The release's notes are set by hand.
+# A release whose code is a candidate's is promoted, not compiled again (tools/release/promoted-from.sh: the tag's
+# "promoted-from: v0.1.0-rc5" line, which tools/agents/release-go.sh writes): each job takes the candidate's attested
+# binaries for its platform (tools/release/promoted-bins.sh) and packs, checks, attests and attaches them as the
+# release, in minutes instead of the three hours a cold build takes. Run by hand, dry_run packs and checks without
+# attesting or attaching (the archives are the run's artifacts), for trying a promote before the real one.
name: release
on:
@@ -23,6 +28,14 @@ on:
description: the full SHA where tools/skills.sh check passed with the feed app (else the tag's skills-passed line)
default: ""
type: string
+ promote_from:
+ description: a candidate tag (v0.1.0-rc5) whose binaries this release is, else the tag's promoted-from line; none builds from source
+ default: ""
+ type: string
+ dry_run:
+ description: pack and check only; nothing attested or attached (the archives are this run's artifacts)
+ default: false
+ type: boolean
permissions:
contents: write
@@ -56,6 +69,10 @@ jobs:
ref: ${{ env.TAG }}
submodules: true
lfs: false
+ - name: Promoted from a candidate, or built (tools/release/promoted-from.sh)
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: bash tools/release/promoted-from.sh "$TAG" "${{ inputs.promote_from }}"
- name: Linux libraries
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build nasm libxkbcommon-dev libxkbcommon-x11-dev libasound2-dev libfontconfig1-dev libvulkan-dev libudev-dev mesa-vulkan-drivers xvfb
@@ -78,7 +95,7 @@ jobs:
# rc3's build left 576 MB of macos-15's 320 GB free, and rc4's dSYMs (#88) ran it out linking raea-page-host
# (ld: write() failed, errno=28): the image's other Xcodes and the Android and .NET SDKs go first
- name: Room for the build
- if: runner.os == 'macOS'
+ if: runner.os == 'macOS' && env.RAEA_PROMOTED_FROM == ''
run: |
df -h . | tail -1
keep=$(cd "$(xcode-select -p)/../.." && pwd -P)
@@ -88,6 +105,7 @@ jobs:
echo "kept $keep"
df -h . | tail -1
- name: Build
+ if: env.RAEA_PROMOTED_FROM == ''
run: |
feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)
cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
@@ -99,6 +117,11 @@ jobs:
if [ -n "${{ matrix.extra }}" ]; then cp target/dist/${{ matrix.extra }} ship/; fi
# the Mac's dSYMs (tools/link-jit.sh made them as it stripped each binary, #88); release.sh keeps them
if [ -d target/dist/symbols ]; then cp -R target/dist/symbols ship/; fi
+ - name: The candidate's binaries (tools/release/promoted-bins.sh)
+ if: env.RAEA_PROMOTED_FROM != ''
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: bash tools/release/promoted-bins.sh "$RAEA_PROMOTED_FROM" ship
# the packing and its checks need only ship/, and macos-15's disk ran out packing rc1 with target/ kept
- name: Free the build's disk
run: |
@@ -132,14 +155,23 @@ jobs:
retention-days: 90
if-no-files-found: warn
- uses: actions/attest-build-provenance@v2
+ if: ${{ !inputs.dry_run }}
with:
subject-path: dist/raea-*.tar.gz
- name: Attach to the release
+ if: ${{ !inputs.dry_run }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" ${{ contains(env.TAG, '-') && '--prerelease' || '' }} --title "raea ${TAG#v}" --notes "Built by .github/workflows/release.yml; notes follow."
gh release upload "$TAG" dist/raea-*.tar.gz dist/raea-*.tar.gz.sha256 --clobber
+ - uses: actions/upload-artifact@v4
+ if: ${{ inputs.dry_run }}
+ with:
+ name: dry-run-${{ runner.os }}
+ path: dist/raea-*.tar.gz*
+ retention-days: 3
+ compression-level: 0
# Windows in Git's bash on GitHub's runner, with the Visual Studio Build Tools in its image (their image terms; we
# accept no licence and download no Microsoft files). The C runtime is the DLL one (the VC++ redistributable): ort's
@@ -156,7 +188,12 @@ jobs:
ref: ${{ env.TAG }}
submodules: true
lfs: false
+ - name: Promoted from a candidate, or built (tools/release/promoted-from.sh)
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: bash tools/release/promoted-from.sh "$TAG" "${{ inputs.promote_from }}"
- name: Toolchain (rust-toolchain.toml's pin)
+ if: env.RAEA_PROMOTED_FROM == ''
run: rustup show active-toolchain || rustup toolchain install
# jq for Windows ends -r lines with CRLF, so tools/bevy-plugins.sh read "ahoy\r" and lost its Bevy 0.20 block
# (feature `ahoy` not found, 11-04); -b writes LF
@@ -183,12 +220,18 @@ jobs:
# the app targets' hosts a cargo call each: with raea-cli's crates in one call taffy's features unify and
# rune-taffy doesn't build; raea-perceive (`raea song`'s map, #43) a call of its own too
- name: Build
+ if: env.RAEA_PROMOTED_FROM == ''
run: |
feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)
cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
cargo build --profile dist --locked -p raea-rune-host
cargo build --profile dist --locked -p raea-page-host --features window
cargo build --profile dist --locked -p raea-perceive
+ - name: The candidate's binaries (tools/release/promoted-bins.sh)
+ if: env.RAEA_PROMOTED_FROM != ''
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: bash tools/release/promoted-bins.sh "$RAEA_PROMOTED_FROM" target/dist
# which DLLs raea needs from the machine (the CRT's come from the VC++ redistributable)
- name: What raea.exe imports
run: |
@@ -238,6 +281,7 @@ jobs:
for n in $(sed -n 's/^\([^ ]*\) (.*): OPEN.*/\1/p' "$RUNNER_TEMP/play.txt"); do echo "--- $n"; { grep -v "known driver" "$out/$n.log" || echo "(its log is empty)"; } | tail -25; done
exit $s
- uses: actions/attest-build-provenance@v2
+ if: ${{ !inputs.dry_run }}
with:
subject-path: dist/raea-*.zip
# kept even when its check fails, with the check's own files, so a failure can be looked into on a fresh runner
@@ -311,6 +355,7 @@ jobs:
if ($LASTEXITCODE -or -not (Test-Path hello.png)) { throw "raea render failed" }
Get-Item hello.png | Format-List Name, Length
- name: Attach to the release
+ if: ${{ !inputs.dry_run }}
env:
GH_TOKEN: ${{ github.token }}
run: |
diff --git a/tools/release.sh b/tools/release.sh
index 455ef6bb..0e75567e 100755
--- a/tools/release.sh
+++ b/tools/release.sh
@@ -6,7 +6,8 @@
# out as the installer puts it under ~/.raea. Built from the committed tree at REF (never anyone's unfinished edit);
# the runtime's packages (sdk/react/js/node_modules, installed, not committed) come from this checkout.
#
-# tools/release.sh VERSION BIN_DIR [REF] BIN_DIR holds a release build's raea and its bundler
+# tools/release.sh VERSION BIN_DIR [REF] BIN_DIR holds a release build's raea and its bundler, or a candidate's,
+# unpacked from its archive (a promoted release, tools/release/promoted-from.sh)
# (libraea_bundle.dylib, .so, or raea.exe and raea_bundle.dll),
# raea-perceive (`raea song` runs it; off Apple since #43), and the app
# targets' two
@@ -110,7 +111,13 @@ case $platform in
# dist/NAME-symbols/FILE.debug, which the stripped file names (gdb and addr2line find it); never shipped
mkdir -p "$out/$name-symbols"
for f in "$stage"/bin/*; do
- d="$out/$name-symbols/$(basename "$f").debug"
+ n=$(basename "$f"); d="$out/$name-symbols/$n.debug"
+ # already stripped, with its debuglink: a promoted release's binary, packed once as its candidate
+ # (tools/release/promoted-bins.sh), whose symbols come with it in BIN_DIR/symbols; the link names the same file
+ if readelf -S "$f" 2>/dev/null | grep -q '\.gnu_debuglink'; then
+ if [ -f "$bin/symbols/$n.debug" ]; then cp "$bin/symbols/$n.debug" "$d"; else echo "release.sh: note: $n came stripped, without its symbols" >&2; fi
+ continue
+ fi
objcopy --only-keep-debug "$f" "$d" && strip --strip-debug --discard-all "$f" && objcopy --add-gnu-debuglink="$d" "$f"
done
# what a Linux machine needs beside it: the bundled Noto Sans JP is a Latin subset, so kanji and kana come from the
diff --git a/tools/release/promoted-bins.sh b/tools/release/promoted-bins.sh
new file mode 100755
index 00000000..3766da79
--- /dev/null
+++ b/tools/release/promoted-bins.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# A promoted release's binaries (tools/release/promoted-from.sh): the candidate FROM's archive for this machine's
+# platform, downloaded from FROM's release, checked against its .sha256 and its attestation (signed by release.yml for
+# FROM's tag in this repository), and unpacked into DEST as a build leaves them for tools/release.sh: raea and its
+# bundler, raea-perceive, the two hosts, and symbols/: what the candidate's run kept of their symbols (never shipped;
+# release.sh keeps them beside the new archive, and a Linux binary's debuglink names the same file).
+# GH_TOKEN=... tools/release/promoted-bins.sh FROM DEST
+set -euo pipefail
+die() { echo "promoted-bins: $*" >&2; exit 1; }
+from=${1:?FROM}
+dest=${2:?DEST}
+repo=${GITHUB_REPOSITORY:-shinyobjectz/raea}
+v=${from#v}
+case $(uname -s) in
+ Linux) platform=linux-x86_64 ext=tar.gz os=Linux ;;
+ MINGW*|MSYS*|CYGWIN*) platform=windows-x86_64 ext=zip os=Windows ;;
+ *) platform=macos-arm64 ext=tar.gz os=macOS ;;
+esac
+archive=raea-$v-$platform.$ext
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT
+
+gh release download "$from" -R "$repo" -p "$archive" -p "$archive.sha256" -D "$tmp" || die "$from's release has no $archive"
+(cd "$tmp" && if command -v sha256sum >/dev/null; then sha256sum -c "$archive.sha256"; else shasum -a 256 -c "$archive.sha256"; fi) \
+ || die "$archive doesn't match its .sha256"
+gh attestation verify "$tmp/$archive" -R "$repo" --source-ref "refs/tags/$from" \
+ --signer-workflow "github.com/$repo/.github/workflows/release.yml" >/dev/null \
+ || die "$archive isn't attested as release.yml's build of $from"
+echo "promoted-bins: $archive: sha256 and attestation checked"
+
+mkdir -p "$tmp/x" "$dest"
+if [ "$ext" = zip ]; then 7z x -y -bso0 -bsp0 -o"$tmp/x" "$tmp/$archive"; else tar -xzf "$tmp/$archive" -C "$tmp/x"; fi
+[ -d "$tmp/x/raea/bin" ] || die "$archive has no raea/bin"
+cp -p "$tmp/x/raea/bin/"* "$dest/"
+ls -l "$dest"
+
+# the symbols release.sh kept beside the candidate's archive, uploaded by its run as symbols-<OS> (Windows keeps none)
+[ "$os" = Windows ] && exit 0
+run=$(gh run list -R "$repo" -w release.yml --branch "$from" -L 20 --json databaseId,event -q '[.[] | select(.event == "push")][0].databaseId')
+if [ -n "$run" ] && gh run download "$run" -R "$repo" -n "symbols-$os" -D "$tmp/sym" 2>/dev/null; then
+ src=$tmp/sym
+ # the artifact holds raea-VERSION-PLATFORM-symbols/ itself, or only what's in it
+ for d in "$tmp/sym"/raea-*-symbols; do [ -d "$d" ] && src=$d; done
+ mkdir -p "$dest/symbols" && cp -R "$src/." "$dest/symbols/"
+ echo "promoted-bins: symbols from run $run: $(ls "$dest/symbols" | wc -l | tr -d ' ') files"
+else
+ echo "promoted-bins: note: no symbols-$os from $from's run ${run:-(none found)}; the release keeps none (they're never shipped)" >&2
+fi
diff --git a/tools/release/promoted-from.sh b/tools/release/promoted-from.sh
new file mode 100755
index 00000000..bc32590d
--- /dev/null
+++ b/tools/release/promoted-from.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+# What a release is promoted from (11-11, Shane: "i dont want to wait so long"): a release whose code is a release
+# candidate's is that candidate's binaries packed again, not a second three-hour compile. raea's version isn't compiled
+# in (tools/release.sh writes share/raea/VERSION as it packs), so the candidate's binaries are the release's: what
+# shipped is exactly what the candidate's checks ran.
+#
+# The candidate is the promote_from input when release.yml is run by hand ("none" builds from source even when the tag
+# names one), else the annotated tag's "promoted-from: <tag>" line (tools/agents/release-go.sh writes it); with
+# neither, the release is built from source as before. The candidate's commit may differ from the release's only in
+# files no build reads (SAME below: the README, the workflows, the release and app-packing tools); anything else and
+# this refuses, naming the files. Written to GITHUB_ENV as RAEA_PROMOTED_FROM (or printed, off Actions).
+# tools/release/promoted-from.sh TAG [FROM] in release.yml, on the tag's checkout
+# tools/release/promoted-from.sh --check FROM REF the files that differ, exit 1 if any (release-go.sh, before tagging)
+set -euo pipefail
+die() { echo "promoted-from: $*" >&2; exit 1; }
+
+# what a candidate and its release may differ in: nothing a cargo build of the shipped binaries reads (engine/cli's
+# tests include tools/release.sh, and tests aren't in a release build)
+SAME=(':(exclude)README.md' ':(exclude).github' ':(exclude)tools/release.sh' ':(exclude)tools/release-check.sh'
+ ':(exclude)tools/release' ':(exclude)tools/agents' ':(exclude)tools/raea-app')
+
+fetch_tag() { git cat-file -e "refs/tags/$1" 2>/dev/null || git fetch -q --depth=1 origin "refs/tags/$1:refs/tags/$1"; }
+differ() { git diff --name-only "$1^{commit}" "$2^{commit}" -- . "${SAME[@]}"; }
+
+if [ "${1:-}" = --check ]; then
+ from=${2:?--check FROM REF}; ref=${3:?--check FROM REF}
+ fetch_tag "$from" || die "no tag $from on origin"
+ files=$(differ "refs/tags/$from" "$ref")
+ [ -z "$files" ] && exit 0
+ echo "promoted-from: $ref's code isn't $from's; these differ, so it can't be promoted (release from source instead):" >&2
+ printf ' %s\n' $files >&2
+ exit 1
+fi
+
+tag=${1:?tag}
+from=${2:-}
+if [ -z "$from" ]; then
+ # the tag's own message; a branch or a SHA (a dry run by hand) has none
+ git fetch -q --depth=1 origin "refs/tags/$tag:refs/tags/$tag" 2>/dev/null || true
+ if [ "$(git cat-file -t "refs/tags/$tag" 2>/dev/null || true)" = tag ]; then
+ from=$(git for-each-ref --format='%(contents)' "refs/tags/$tag" | sed -nE 's/^promoted-from: *(v[0-9][0-9A-Za-z.+-]*) *$/\1/p' | head -1)
+ fi
+fi
+if [ -z "$from" ] || [ "$from" = none ]; then
+ echo "promoted-from: none; built from source"
+ exit 0
+fi
+[[ $from =~ ^v[0-9] ]] || die "$from isn't a release tag (v...)"
+[ "$from" != "$tag" ] || die "$tag can't be promoted from itself"
+fetch_tag "$from" || die "no tag $from on origin"
+files=$(differ "refs/tags/$from" HEAD)
+if [ -n "$files" ]; then
+ echo "promoted-from: this checkout's code isn't $from's; these differ, so it can't be promoted (run release.yml by hand with promote_from: none to build it):" >&2
+ printf ' %s\n' $files >&2
+ exit 1
+fi
+echo "promoted-from: $from ($(git rev-parse --short "refs/tags/$from^{commit}")); its binaries, packed again as ${tag#v}"
+if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then echo "Promoted from $from: its binaries, packed again as ${tag#v}; no compile." >> "$GITHUB_STEP_SUMMARY"; fi
+if [ -n "${GITHUB_ENV:-}" ]; then echo "RAEA_PROMOTED_FROM=$from" >> "$GITHUB_ENV"; else echo "RAEA_PROMOTED_FROM=$from"; fi