app: cherry-pick rune's pause and sound fixes onto the checkout
Rune comes from app/vendor/rune now, a checkout of 63ad0209 on branch ported, carrying the four commits of upstream issues 1320 (a pause while a clip is layered holds the layer's picture and time) and 1325 (a video's sound is read ahead of the clock and leads it). Both were written against eb9f1104 and ported across the refactors since. The faults are the first two and the third in docs/rune-upstream.md; the app's workarounds in review.rs stay until the fixes arrive upstream.
This commit is contained in:
1 parent
80fef698ce
commit
5bf262b82b
3795 files changed
+663463
-28
No files matched your search
+110
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
# Mints a short-lived Cloudflare token for the current release job from the token issuer
|
||||
# (anomalyco/secrets). Run after aws-actions/configure-aws-credentials has assumed
|
||||
# arn:aws:iam::604439173067:role/github/opencode-release: the Lambda identifies the role from the
|
||||
# SigV4 signature and mints only the `opencode/release` token. No repo, stage, permission or TTL
|
||||
# is sent in the request, and the token is pinned to the runner's IP for 30 minutes.
|
||||
#
|
||||
# Step-scoped by default: the token goes to $GITHUB_OUTPUT and only steps that list
|
||||
# `CLOUDFLARE_API_TOKEN: ${{ steps.<id>.outputs.token }}` in their env receive it.
|
||||
set -euo pipefail
|
||||
set +x
|
||||
|
||||
url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/}
|
||||
account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968}
|
||||
|
||||
# One argv value, never a line in curl's config: a newline in an override must not be able to
|
||||
# inject curl options or move the AWS credentials into Basic auth.
|
||||
url_pattern='^https://[a-z0-9]+\.lambda-url\.us-east-1\.on\.aws/$'
|
||||
if ! [[ "$url" =~ $url_pattern ]]; then
|
||||
echo "::error::CLOUDFLARE_TOKEN_URL is not the token issuer's function URL." >&2
|
||||
exit 1
|
||||
fi
|
||||
case "$account" in
|
||||
*[!0-9a-f]*|"")
|
||||
echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ ${#account} -ne 32 ]; then
|
||||
echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2
|
||||
exit 1
|
||||
fi
|
||||
for name in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do
|
||||
if [ -z "${!name:-}" ]; then
|
||||
echo "::error::$name is not set; run aws-actions/configure-aws-credentials first." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# The response is captured, never streamed: it contains the token. AWS credentials go to curl
|
||||
# through stdin, not argv, so they stay out of `ps` and any trace of this script.
|
||||
response=$(
|
||||
printf 'user = "%s:%s"\nheader = "x-amz-security-token: %s"\n' \
|
||||
"$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$AWS_SESSION_TOKEN" |
|
||||
curl --config - \
|
||||
--proto '=https' --proto-redir '=https' \
|
||||
--aws-sigv4 "aws:amz:us-east-1:lambda" \
|
||||
--request POST --url "$url" \
|
||||
--fail-with-body --silent --show-error --max-time 20
|
||||
)
|
||||
|
||||
token=$(printf '%s' "$response" | jq -er 'if (.token | type) == "string" then .token else error("token") end' 2>/dev/null)
|
||||
expires=$(printf '%s' "$response" | jq -er 'if (.expires_on | type) == "string" then .expires_on else error("expires_on") end' 2>/dev/null)
|
||||
|
||||
# Validate before any output. No error below includes the token value.
|
||||
case "$token" in
|
||||
""|*[[:space:]]*)
|
||||
echo "::error::The token issuer returned an invalid token." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ ${#token} -lt 8 ] || [ ${#token} -gt 512 ]; then
|
||||
echo "::error::The token issuer returned an invalid token length." >&2
|
||||
exit 1
|
||||
fi
|
||||
case "$expires" in
|
||||
""|*[[:space:]]*)
|
||||
echo "::error::The token issuer returned an invalid expires_on." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
iso_pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z$'
|
||||
if ! printf '%s' "$response" | jq -e --arg re "$iso_pattern" '(.expires_on | type) == "string" and (.expires_on | test($re))' > /dev/null; then
|
||||
echo "::error::The token issuer returned an invalid expires_on." >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! [[ "$expires" =~ $iso_pattern ]]; then
|
||||
echo "::error::The token issuer returned an invalid expires_on." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# GitHub masks the exact string everywhere after this, including accidental traces and our own
|
||||
# error messages. This is the first output that contains it.
|
||||
printf '::add-mask::%s\n' "$token"
|
||||
|
||||
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||
{
|
||||
printf 'token=%s\n' "$token"
|
||||
printf 'expires_on=%s\n' "$expires"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
elif [ -n "${GITHUB_ENV:-}" ]; then
|
||||
printf 'CLOUDFLARE_API_TOKEN=%s\n' "$token" >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
# Verify immediately, with the token on curl's stdin rather than argv. A runner whose Cloudflare
|
||||
# egress address differs from the address Lambda saw (IPv4 vs IPv6, or a different NAT address)
|
||||
# fails here instead of part way through an upload.
|
||||
verify_url="https://api.cloudflare.com/client/v4/accounts/$account/tokens/verify"
|
||||
if ! verify=$(printf 'header = "Authorization: Bearer %s"\nurl = "%s"\n' "$token" "$verify_url" |
|
||||
curl --config - --proto '=https' --proto-redir '=https' --silent --show-error --fail-with-body --max-time 20); then
|
||||
echo "::error::Cloudflare rejected the freshly minted token. The runner's egress IP to Cloudflare may differ from the IP Lambda saw (IPv4 vs IPv6 or a different NAT address). Use a runner with stable egress." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! printf '%s' "$verify" | jq -e '.success == true and .result.status == "active"' > /dev/null; then
|
||||
echo "::error::Cloudflare did not report the freshly minted token as active." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "::notice::Cloudflare token ready; expires $expires"
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
name: file size
|
||||
|
||||
# The Rust file-size and folder-shape check (scripts/file-size.sh), per pull request and per push
|
||||
# to dev: a few seconds on Linux. It ran inside macos-tests.yml until that moved to a schedule.
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: file-size-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
size:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- run: bash scripts/file-size.sh
|
||||
@@ -0,0 +1,74 @@
|
||||
name: macOS tests
|
||||
|
||||
# On a schedule and on request, never per pull request or per push (the owner's decision,
|
||||
# 2026-11-12): the test job takes over an hour on a Mac runner, Mac runners are scarce and shared
|
||||
# across the organisation, and changes merge straight after their pull request, so a run per
|
||||
# change (twice: the pull request, then the push to dev) was mostly cancelled or ignored. Every six
|
||||
# hours, `changes` (a Linux job) starts the Mac job only when dev is on a commit no run has tested
|
||||
# to the end yet; workflow_dispatch always tests. The Rust file-size check that also ran here
|
||||
# runs per pull request in file-size.yml.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "41 */6 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
# One run at a time: a newer run cancels an older one still testing.
|
||||
concurrency:
|
||||
group: macos-tests
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
test: ${{ steps.check.outputs.test }}
|
||||
steps:
|
||||
- id: check
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT: ${{ github.event_name }}
|
||||
SHA: ${{ github.sha }}
|
||||
REPO: ${{ github.repository }}
|
||||
RUN_ID: ${{ github.run_id }}
|
||||
run: |
|
||||
# The commit the last run that finished its tests (green or red) tested: rerunning the
|
||||
# same commit tells nothing new. A cancelled run doesn't count.
|
||||
last=$(gh api "repos/$REPO/actions/workflows/macos-tests.yml/runs?branch=dev&per_page=50" \
|
||||
--jq "[.workflow_runs[] | select(.id != $RUN_ID and (.conclusion == \"success\" or .conclusion == \"failure\"))][0].head_sha // empty" || true)
|
||||
if [ "$EVENT" = schedule ] && [ "$last" = "$SHA" ]; then
|
||||
echo "test=false" >> "$GITHUB_OUTPUT"
|
||||
echo "dev is still at ${SHA:0:9}, which the last run tested." >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "test=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
test:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.test == 'true'
|
||||
runs-on: blacksmith-6vcpu-macos-latest
|
||||
timeout-minutes: 90
|
||||
env:
|
||||
# One job per core: serial builds ran past the timeout with no cache, so no cache was ever saved.
|
||||
CARGO_BUILD_JOBS: 3
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_PROFILE_TEST_DEBUG: 0
|
||||
CARGO_PROFILE_TEST_STRIP: debuginfo
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-on-failure: true
|
||||
# The virtual Metal adapter does not expose TIMESTAMP_QUERY. Keep the
|
||||
# shader freshness, pipeline, rendering, font and menu tests enabled.
|
||||
- run: >-
|
||||
cargo test -p rune -p rune-core -p rune-edit -p rune-gpu -p rune-image -p rune-media -p rune-spell -p rune-text -p rune-kit
|
||||
--features rune/test-gpu-counters,rune-gpu/test-gpu-counters,rune-kit/markdown,rune-kit/mermaid --no-fail-fast --
|
||||
--skip metal::compute_tests::passes_sample_timestamps_at_their_boundaries
|
||||
# Kept outside the main invocation above so rune-ref (`libm/force-soft-floats`, `serde/derive`)
|
||||
# and rune-i18n (`icu_provider/sync`) do not alter the core feature set.
|
||||
- run: cargo test -p rune-ref
|
||||
- run: cargo test -p rune-i18n
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
name: site
|
||||
|
||||
# Deploys the docs site in site/. dev deploys https://dev.anoma.ly/team/rune, production deploys https://anoma.ly/team/rune.
|
||||
on:
|
||||
push:
|
||||
branches: [dev, production]
|
||||
paths:
|
||||
- "site/**"
|
||||
- ".github/workflows/site.yml"
|
||||
|
||||
concurrency:
|
||||
group: site-${{ github.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ github.ref_name == 'dev' && 'dev' || 'release' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
working-directory: site
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/rune-${{ github.ref_name == 'dev' && 'dev' || 'release' }}
|
||||
role-session-name: site-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- run: bun install --frozen-lockfile
|
||||
- name: Cloudflare token
|
||||
id: cloudflare-token
|
||||
run: bash "$GITHUB_WORKSPACE/.github/release/cloudflare-token.sh"
|
||||
env:
|
||||
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
|
||||
- run: bun run deploy:${{ github.ref_name == 'production' && 'production' || 'dev' }}
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
name: www
|
||||
|
||||
# The public page in www/ is the Rune app in www/app. CI builds it to wasm, has the native build write its static
|
||||
# HTML (`--html`), and deploys: dev to https://dev.anoma.ly/rune, production to https://anoma.ly/rune. Rune itself is
|
||||
# the page, so a push that changes crates/ deploys it too. Pull requests build the dev page and deploy nothing, and
|
||||
# only for a change to the page's own files: a change to crates/ merges straight after its pull request, and the
|
||||
# push to dev builds it then, so building it twice told nothing. A newer push to dev replaces a dev deploy still
|
||||
# running; production always finishes.
|
||||
on:
|
||||
push:
|
||||
branches: [dev, production]
|
||||
paths:
|
||||
- "www/**"
|
||||
- "crates/**"
|
||||
- "scripts/web-build.sh"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- "rust-toolchain.toml"
|
||||
- ".github/workflows/www.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "www/**"
|
||||
- "scripts/web-build.sh"
|
||||
- "rust-toolchain.toml"
|
||||
- ".github/workflows/www.yml"
|
||||
|
||||
concurrency:
|
||||
group: www-${{ github.head_ref || github.ref_name }}
|
||||
cancel-in-progress: ${{ github.ref_name != 'production' }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
BINARYEN_VERSION: "133"
|
||||
MODE: ${{ github.ref_name == 'production' && 'production' || 'dev' }}
|
||||
CARGO_INCREMENTAL: "0"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ github.ref_name == 'dev' && 'dev' || 'release' }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
working-directory: www
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
# Pull requests build and deploy nothing, so they never assume the role.
|
||||
- name: Configure AWS credentials
|
||||
if: github.event_name == 'push'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/rune-${{ github.ref_name == 'dev' && 'dev' || 'release' }}
|
||||
role-session-name: www-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
# rust-toolchain.toml picks the toolchain. rust-src is installed up front: otherwise rustup fetches it mid-build
|
||||
# from parallel rustc calls, which race and fail.
|
||||
- name: Rust toolchain
|
||||
working-directory: .
|
||||
run: |
|
||||
rustup toolchain install
|
||||
rustup target add wasm32-unknown-unknown
|
||||
rustup component add rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: www
|
||||
save-if: ${{ github.event_name == 'push' }}
|
||||
- name: wasm-bindgen version from Cargo.lock
|
||||
id: bindgen
|
||||
working-directory: .
|
||||
run: echo "version=$(grep -A1 '^name = "wasm-bindgen"$' Cargo.lock | sed -n 's/^version = "\(.*\)"/\1/p')" >> "$GITHUB_OUTPUT"
|
||||
- uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: wasm-bindgen@${{ steps.bindgen.outputs.version }}
|
||||
- uses: actions/cache@v4
|
||||
id: binaryen
|
||||
with:
|
||||
path: ~/.binaryen
|
||||
key: binaryen-${{ env.BINARYEN_VERSION }}
|
||||
- name: Install binaryen
|
||||
if: steps.binaryen.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p ~/.binaryen
|
||||
curl -fsSL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-x86_64-linux.tar.gz" \
|
||||
| tar -xz -C ~/.binaryen --strip-components=1
|
||||
- run: echo "$HOME/.binaryen/bin" >> "$GITHUB_PATH"
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
- run: bun install --frozen-lockfile
|
||||
# The native app (tests and the `--html` export) links winit's keyboard library. Its packages are cached, so a
|
||||
# run doesn't need the Ubuntu mirrors (on 2026-11-11 the runners couldn't resolve them for over an hour, and
|
||||
# every run failed here); a run that must fetch them retries.
|
||||
- uses: actions/cache@v4
|
||||
id: debs
|
||||
with:
|
||||
path: ~/.debs
|
||||
key: debs-libxkbcommon-${{ runner.os }}-${{ runner.arch }}-${{ env.ImageOS }}
|
||||
- name: Native libraries
|
||||
run: |
|
||||
if [ "${{ steps.debs.outputs.cache-hit }}" != true ]; then
|
||||
mkdir -p ~/.debs
|
||||
for attempt in 1 2 3; do
|
||||
sudo apt-get -o Acquire::Retries=3 update &&
|
||||
(cd ~/.debs && apt-get -o Acquire::Retries=3 download libxkbcommon-dev libxkbcommon0) && break
|
||||
[ "$attempt" = 3 ] && exit 1
|
||||
sleep $((attempt * 20))
|
||||
done
|
||||
fi
|
||||
sudo dpkg -i ~/.debs/*.deb
|
||||
- name: Test the page
|
||||
working-directory: .
|
||||
run: cargo test -p rune-www
|
||||
- name: Build
|
||||
run: bun run build --mode "$MODE"
|
||||
- name: Cloudflare token
|
||||
id: cloudflare-token
|
||||
if: github.event_name == 'push'
|
||||
run: bash "$GITHUB_WORKSPACE/.github/release/cloudflare-token.sh"
|
||||
env:
|
||||
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
|
||||
- name: Deploy
|
||||
if: github.event_name == 'push'
|
||||
run: bunx cf deploy --prebuilt --mode "$MODE"
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
|
||||
Reference in new issue
Block a user