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.

The engine's release check on real machines (tools/release-machines.sh): a candidate's archives checked on the Windows PC's own GPU and the Linux box with a hard pass (RAEA_CHECK_HARD=1: a folder with a space and letters outside ASCII, 3D, an MP4, one render forty times with every exit read, two at once). And raea's own Windows programs signed in the release once the repository names its Azure signing identity (tools/release/win-sign.sh, RAEA_WIN_SIGN=1; off and unsigned until then, #221)

shinyobjectz2556f423665c
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 52412f1e..d6e05876 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -223,6 +223,9 @@ jobs:
# (tools/release/win-bundle.sh), as Microsoft documents for app-local deployment.
windows:
runs-on: ${{ (vars.RELEASE_WINDOWS_RUNNER && fromJSON(vars.RELEASE_WINDOWS_RUNNER)) || 'windows-latest' }}
+ # the signing identity's federated credential trusts this repository's environment "signing" and nothing else
+ # (Azure app raea-release-signing); with no identity set there is no environment, and the zip is unsigned
+ environment: ${{ vars.AZURE_SIGN_CLIENT_ID != '' && 'signing' || '' }}
timeout-minutes: 350
env:
# the compile cache, as build's
@@ -352,9 +355,24 @@ jobs:
run: bash tools/release/lavapipe.sh
- name: Where the skills gate passed
run: bash tools/release/skills-passed.sh "$TAG" "${{ inputs.skills_passed }}"
+ # raea's own Windows programs signed (#221), once the repository has the signing identity: the variables
+ # AZURE_SIGN_CLIENT_ID, AZURE_SIGN_TENANT_ID and AZURE_SIGN_SUBSCRIPTION_ID name an Azure app whose federated
+ # credential trusts this workflow and which holds the Artifact Signing Certificate Profile Signer role on the
+ # account (no secret is stored: the job's own token is exchanged). Without them the zip is unsigned, as before
+ - name: Sign in to Azure for signing
+ if: ${{ vars.AZURE_SIGN_CLIENT_ID != '' }}
+ uses: azure/login@v2
+ with:
+ client-id: ${{ vars.AZURE_SIGN_CLIENT_ID }}
+ tenant-id: ${{ vars.AZURE_SIGN_TENANT_ID }}
+ subscription-id: ${{ vars.AZURE_SIGN_SUBSCRIPTION_ID }}
+ - name: jsign (signs raea's programs)
+ if: ${{ vars.AZURE_SIGN_CLIENT_ID != '' }}
+ run: choco install jsign -y --no-progress
- name: Pack and check (tools/release.sh)
env:
RAEA_CHECK_DIR: ${{ runner.temp }}/release-check
+ RAEA_WIN_SIGN: ${{ vars.AZURE_SIGN_CLIENT_ID != '' && '1' || '' }}
run: bash tools/release.sh "${TAG#v}" target/dist HEAD
# live play on Windows (PT20 left it unproven): bevy-ts's play cases, `play --offscreen` with an input script and
# a snapshot's pixels probed, run by the raea just built; check.sh reads the pixels with ImageMagick, which the
diff --git a/tools/release-check.sh b/tools/release-check.sh
index 60e5707c..c29ed48b 100644
--- a/tools/release-check.sh
+++ b/tools/release-check.sh
@@ -172,5 +172,33 @@ if [ -f "$check/raea/bin/raea.exe" ]; then
done
"$check/raea/bin/uv.exe" --version 2>&1 | grep -q '^uv ' || fail "bin/uv.exe doesn't run"
fi
+# RAEA_CHECK_HARD=1 (tools/release-machines.sh, on real machines: a PC's own GPU, the Linux box): what reports from
+# other systems needed and a runner's one pass doesn't show.
+if [ "${RAEA_CHECK_HARD:-}" = 1 ]; then
+ # a project in a folder with a space and letters outside ASCII, as a person's own folders have ("C:\Users\José M\"):
+ # the page, its 3D, and an MP4 of it (#40-#42, #78, #169: paths read as URLs, as \\?\ paths, with backslashes kept)
+ hard="$check/José's work/proj é"
+ mkdir -p "$hard" && cp "$check/p/hello.tsx" "$check/3d/cube.tsx" "$hard/"
+ (cd "$hard" && RAEA_NO_TREE=1 RUST_BACKTRACE=1 "$raea" render hello.tsx --frame 3 -o "héllo out.png" > render.log 2>&1 && [ -s "héllo out.png" ]) || { tail -20 "$hard/render.log" >&2; fail "no frame from a folder with a space and letters outside ASCII"; }
+ ! grep -q "is all black" "$hard/render.log" || fail "the frame from a folder with a space and letters outside ASCII is all black"
+ # 3D on this machine's own GPU: Windows too, which a runner (WARP, lavapipe) never draws on (#66: an AMD GPU drew nothing)
+ (cd "$hard" && RAEA_NO_TREE=1 RUST_BACKTRACE=1 "$raea" render cube.tsx --frame 3 -o cube.png > cube.log 2>&1 && [ -s cube.png ]) || { tail -20 "$hard/cube.log" >&2; fail "no 3D frame on this machine's GPU"; }
+ ! grep -q "is all black" "$hard/cube.log" || fail "the 3D frame on this machine's GPU is all black"
+ (cd "$hard" && RAEA_NO_TREE=1 RUST_BACKTRACE=1 "$raea" render hello.tsx -o hello.mp4 > mp4.log 2>&1 && [ -s hello.mp4 ]) || { tail -20 "$hard/mp4.log" >&2; fail "no MP4 from a folder with a space and letters outside ASCII"; }
+ # the same render over and over: a crash one run in many is still a crash (#65: a segfault at exit, 1 run in 160, after
+ # the frames were written), so every run's exit is read, not only its file
+ n=${RAEA_CHECK_REPEATS:-40}
+ for i in $(seq "$n"); do
+ (cd "$hard" && RAEA_NO_TREE=1 "$raea" render cube.tsx --frame $((i % 9)) -o "again.png" > again.log 2>&1) || { s=$?; tail -20 "$hard/again.log" >&2; fail "run $i of $n of the same 3D render ended with exit $s"; }
+ done
+ # two renders at once, each in its own folder: neither takes the other's work folder away (#29)
+ mkdir -p "$hard/a" "$hard/b" && cp "$hard/hello.tsx" "$hard/a/" && cp "$hard/hello.tsx" "$hard/b/"
+ (cd "$hard/a" && RAEA_NO_TREE=1 "$raea" render hello.tsx -o out.mp4 > render.log 2>&1) & pa=$!
+ (cd "$hard/b" && RAEA_NO_TREE=1 "$raea" render hello.tsx -o out.mp4 > render.log 2>&1) & pb=$!
+ wait $pa || { tail -20 "$hard/a/render.log" >&2; fail "one of two renders running at once failed"; }
+ wait $pb || { tail -20 "$hard/b/render.log" >&2; fail "one of two renders running at once failed"; }
+ [ -s "$hard/a/out.mp4" ] && [ -s "$hard/b/out.mp4" ] || fail "two renders at once didn't both write their MP4"
+ echo "release: the hard pass too: a folder with a space and letters outside ASCII, 3D on this GPU, $n runs of one render, two at once"
+fi
echo "release: $archive checked: an unpacked copy rendered a frame and checked an app on both targets with RAEA_NO_TREE=1"
rm -rf "$check"
diff --git a/tools/release-machines.sh b/tools/release-machines.sh
new file mode 100644
index 00000000..49f43db7
--- /dev/null
+++ b/tools/release-machines.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# The engine's release check run on real machines, hard pass and all (tools/release-check.sh with RAEA_CHECK_HARD=1):
+# a release's Windows zip on the Windows PC, on its own GPU, and its Linux tarball on the Linux box. release.yml's
+# runners check each archive once, on a software GPU on Windows; what people reported from their own machines (a folder
+# with a space or an accent in its name, an AMD or NVIDIA GPU, a crash one run in many, two renders at once) only shows
+# on a machine like theirs. This is the engine's half of the app's tools/raea-app/everywhere.sh (raea-platform).
+# tools/release-machines.sh VERSION [linux windows] e.g. tools/release-machines.sh 0.1.10-rc3
+# The archives come from the release (kept in ~/.cache/raea-app/engine-VERSION, as everywhere.sh keeps them), go to each
+# machine, are checked there and removed. One line per machine at the end; exit 1 names what failed.
+# RAEA_WIN_CHECK_HOST names the PC; RAEA_LINUX_BOX the Sprite; RAEA_CHECK_REPEATS how many times the one render repeats (40).
+set -uo pipefail
+version=${1:?usage: release-machines.sh VERSION [linux windows]}
+version=${version#v}
+shift
+machines=("$@"); [ ${#machines[@]} -gt 0 ] || machines=(linux windows)
+REPO=shinyobjectz/raea
+root=$(cd "$(dirname "$0")/.." && pwd)
+cache="$HOME/.cache/raea-app/engine-$version"; mkdir -p "$cache"
+logs=${RAEA_MACHINES_LOGS:-$(mktemp -d)}; mkdir -p "$logs"
+repeats=${RAEA_CHECK_REPEATS:-40}
+archive() {
+ local name=$1
+ [ -f "$cache/$name" ] || gh release download "v$version" -R "$REPO" -p "$name" -p "$name.sha256" -D "$cache" --clobber >&2 || return 1
+ (cd "$cache" && shasum -a 256 -c "$name.sha256" >/dev/null) || { echo "FAIL $name doesn't match its .sha256" >&2; return 1; }
+ echo "$cache/$name"
+}
+# the check and what it reads beside itself (release/win-bundle.files), as one small tarball
+kit="$logs/kit.tar"
+tar -cf "$kit" -C "$root/tools" release-check.sh release/win-bundle.files || exit 1
+
+linux() {
+ local a; a=$(archive "raea-$version-linux-x86_64.tar.gz") || return 1
+ # shellcheck disable=SC1091
+ . "$root/sdk/cloud/deploy/sprites/org.sh" || { echo "FAIL no Sprite org"; return 1; }
+ local S=(-o "$ORG" -s "${RAEA_LINUX_BOX:-raea-linux}") dir="raea-engine-check-$(date +%s)-$$"
+ sprite exec --no-stdin "${S[@]}" -- bash -c "mkdir -p ~/$dir" || { echo "FAIL the Linux box isn't reachable"; return 1; }
+ local want got
+ want=$(wc -c < "$a" | tr -d ' ')
+ got=$(sprite exec "${S[@]}" -- bash -c "cat > ~/$dir/raea.tar.gz && wc -c < ~/$dir/raea.tar.gz" < "$a" | tr -dc 0-9)
+ [ "$got" = "$want" ] || { echo "FAIL the archive didn't reach the Linux box whole (${got:-0} of $want bytes)"; return 1; }
+ sprite exec "${S[@]}" -- bash -c "tar -xf - -C ~/$dir" < "$kit" || { echo "FAIL copying the check"; return 1; }
+ echo "machines: the check is running on the Linux box"
+ # (no stdin of ours held open: a check started with it open sits silent, 11-25; under Xvfb, as release.yml runs it:
+ # the app check opens a window, and the box has no screen)
+ sprite exec --no-stdin "${S[@]}" -- bash -c "cd ~/$dir && RAEA_CHECK_HARD=1 RAEA_CHECK_REPEATS=$repeats timeout 2400 xvfb-run -a -s '-screen 0 1280x1024x24' bash release-check.sh ~/$dir/raea.tar.gz > check.out 2>&1 < /dev/null; code=\$?; tail -40 check.out; cd ~ && rm -rf ~/$dir; exit \$code"
+}
+
+windows() {
+ local a; a=$(archive "raea-$version-windows-x86_64.zip") || return 1
+ local host=${RAEA_WIN_CHECK_HOST:-cuda-box} dir="raea-engine-check-$(date +%s)-$$"
+ ssh -o ConnectTimeout=15 "$host" "mkdir $dir" >/dev/null || { echo "FAIL the PC isn't reachable over ssh"; return 1; }
+ # shellcheck disable=SC2064
+ trap "ssh -o ConnectTimeout=15 '$host' 'rmdir /s /q $dir' >/dev/null 2>&1" RETURN
+ local free
+ free=$(ssh "$host" "powershell -NoProfile -Command [math]::Floor((Get-PSDrive C).Free/1MB)" | tr -dc 0-9)
+ [ "${free:-0}" -ge 3000 ] || { echo "FAIL the PC has ${free:-?} MB free on C:, and the check needs 3000"; return 1; }
+ scp -q "$a" "$host:$dir/raea.zip" && scp -q "$kit" "$host:$dir/kit.tar" || { echo "FAIL copying the archive to the PC"; return 1; }
+ # the PC's ssh shell is cmd, which takes `>` and `&&` in a command for itself: the check's line goes as a file
+ printf 'cd ~/%s && tar -xf kit.tar && RAEA_CHECK_HARD=1 RAEA_CHECK_REPEATS=%s RAEA_CHECK_DIR="$PWD/c" bash release-check.sh "$PWD/raea.zip" > check.out 2>&1; code=$?; tail -40 check.out; exit $code\n' "$dir" "$repeats" > "$logs/win-run.sh"
+ scp -q "$logs/win-run.sh" "$host:$dir/run.sh" || { echo "FAIL copying the check to the PC"; return 1; }
+ echo "machines: the check is running on the PC"
+ ssh "$host" "\"C:\\Program Files\\Git\\bin\\bash.exe\" $dir/run.sh"
+}
+
+echo "machines: the engine $version on: ${machines[*]} (logs: $logs)"
+pids=()
+for m in "${machines[@]}"; do
+ case $m in linux | windows) ;; *) echo "machines: linux or windows, not $m"; exit 2 ;; esac
+ "$m" > "$logs/$m.log" 2>&1 &
+ pids+=($!)
+done
+failed=()
+for i in "${!machines[@]}"; do
+ m=${machines[$i]}
+ if wait "${pids[$i]}"; then
+ echo "machines: $m ok $(grep -h 'the hard pass too' "$logs/$m.log" | tail -1)"
+ else
+ echo "machines: $m FAILED $(grep -h -E '^(FAIL|release: )' "$logs/$m.log" | tail -1)"; failed+=("$m")
+ fi
+done
+[ ${#failed[@]} -eq 0 ] || { echo "FAIL ${failed[*]} (engine $version; logs in $logs)"; exit 1; }
+echo "ok the engine $version on ${machines[*]}"
diff --git a/tools/release.sh b/tools/release.sh
index 6000e2ee..b4ea3e55 100755
--- a/tools/release.sh
+++ b/tools/release.sh
@@ -206,6 +206,12 @@ for md in "$stage"/share/raea/skills/*/SKILL.md; do
perl -0pi -e 's/\A---\n(.*?)\n---\n/"---\n" . join("\n", grep { !\/^version:\/ } split(\/\n\/, $1)) . "\nversion: '"$version"'\n---\n"/se' "$md"
done
if [ $platform = windows-x86_64 ]; then
+ # RAEA_WIN_SIGN=1: raea's own programs signed before they're zipped (tools/release/win-sign.sh, #221). Off, the zip is
+ # as it was: unsigned, which Smart App Control blocks on a PC that has it on
+ if [ "${RAEA_WIN_SIGN:-}" = 1 ]; then
+ bash "$root/tools/release/win-sign.sh" "$stage/bin/raea.exe" "$stage/bin/raea_bundle.dll" "$stage/bin/raea-perceive.exe" "$stage/bin/raea-rune-host.exe" "$stage/bin/raea-page-host.exe" ||
+ { echo "release.sh: raea's Windows programs couldn't be signed (RAEA_WIN_SIGN=1)" >&2; exit 1; }
+ fi
archive=$name.zip
rm -f "$out/$archive"
(cd "$(dirname "$stage")" && 7z a -tzip -bso0 -bsp0 "$out/$archive" raea)
diff --git a/tools/release/win-sign.sh b/tools/release/win-sign.sh
new file mode 100644
index 00000000..ee32b3a7
--- /dev/null
+++ b/tools/release/win-sign.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Authenticode-signs raea's own Windows programs before release.sh zips them (#221: Smart App Control and SmartScreen
+# block an unsigned raea.exe and its DLL on a PC that has them on). release.sh calls it when RAEA_WIN_SIGN=1, with the
+# files; the others in bin\ (Microsoft's, FFmpeg, uv) keep their makers' signatures or none, and are never re-signed.
+# The same account and profile as the app's (raea-platform tools/raea-app/win/sign.sh): Azure Artifact Signing, account
+# raeasigning, timestamped by Microsoft's TSA so a signature outlives its days-long certificate. The access token comes
+# from the Azure CLI, signed in by a person (az login) or by the release workflow's own identity (azure/login).
+# tools/release/win-sign.sh FILE...
+set -euo pipefail
+[ $# -gt 0 ] || { echo "usage: win-sign.sh FILE..." >&2; exit 2; }
+command -v jsign >/dev/null || { echo "win-sign.sh: no jsign (brew install jsign; choco install jsign)" >&2; exit 1; }
+endpoint=${RAEA_SIGN_ENDPOINT:-eus.codesigning.azure.net}
+account=${RAEA_SIGN_ACCOUNT:-raeasigning}
+profile=${RAEA_SIGN_PROFILE:-raea-app}
+token=$(az account get-access-token --resource https://codesigning.azure.net --query accessToken -o tsv | tr -d '\r') ||
+ { echo "win-sign.sh: no Azure token (az login)" >&2; exit 1; }
+jsign --storetype TRUSTEDSIGNING --keystore "$endpoint" --storepass "$token" --alias "$account/$profile" \
+ --tsaurl http://timestamp.acs.microsoft.com --tsmode RFC3161 --replace --name raea --url https://raea.io "$@"