The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
fix(release): a release builds its tag, signs Android on release runs alone, and the gate can pass
Jareer3f3b7de93297
diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.ymlindex 79bbef97..996914bd 100644--- a/.github/workflows/build-app.yml+++ b/.github/workflows/build-app.yml@@ -34,6 +34,11 @@ name: Build app# `fail-fast` is off for the same reason.on:workflow_call:+ inputs:+ ref:+ description: The ref to build, when it is not the one this runs on+ type: string+ default: ""secrets:APPLE_CERTIFICATE_P12:description: Base64 of a Developer ID Application .p12@@ -149,8 +154,20 @@ jobs:# hour. A job still running past this is stuck, not slow.timeout-minutes: 90steps:+ # The ref release.yml names, which is its tag: without one a run+ # started by hand builds main and publishes it under the tag's name.- uses: actions/checkout@v7- - uses: dtolnay/rust-toolchain@stable+ with:+ ref: ${{ inputs.ref }}+ # The toolchain src/rust-toolchain.toml pins, installed by name, so the+ # runner never also fetches a stable it will not use.+ - name: The pinned toolchain+ id: toolchain+ shell: bash+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: ${{ steps.toolchain.outputs.channel }}- name: Read the versionid: versiondiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 473a9ec3..7284a1af 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -35,8 +35,15 @@ jobs:- uses: actions/checkout@v7with:ref: ${{ inputs.ref }}- - uses: dtolnay/rust-toolchain@stable+ # The toolchain src/rust-toolchain.toml pins, installed by name: every+ # cargo command below runs from src/, where the pin applies, so a+ # stable installed here would only be fetched and left.+ - name: The pinned toolchain+ id: toolchain+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@masterwith:+ toolchain: ${{ steps.toolchain.outputs.channel }}components: clippy, rustfmt- uses: Swatinem/rust-cache@v2with:@@ -147,8 +154,12 @@ jobs:- uses: actions/checkout@v7with:ref: ${{ inputs.ref }}- - uses: dtolnay/rust-toolchain@stable+ - name: The pinned toolchain+ id: toolchain+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@masterwith:+ toolchain: ${{ steps.toolchain.outputs.channel }}components: clippytargets: wasm32-unknown-unknown- uses: Swatinem/rust-cache@v2@@ -167,8 +178,11 @@ jobs:# which is where a broken platform path was found. Windows runs the# tests, because it is a primary desktop and its own failures (files# held open, FFmpeg's filter threads) only show there; macOS is checked,- # not tested, and is tested where it is developed. No GPU on either- # runner: the GPU tests skip rather than fail.+ # not tested, and is tested where it is developed. Neither runner has a+ # GPU. Windows has WARP, a software adapter, which the parity suite runs+ # on and the cards test does not: a hundred cards on WARP ran past the+ # ninety minutes every time (see cards.rs), so without CONCAT_REQUIRE_GPU+ # it skips there and runs on Linux's lavapipe above.desktop:name: ${{ matrix.verb }} on ${{ matrix.os }}strategy:@@ -182,13 +196,22 @@ jobs:sherpa: win-x64verb: Testsruns-on: ${{ matrix.os }}+ # A compile is minutes and the Windows suite under an hour; a job past+ # this is stuck, and a stuck job is what kept main red for five days.+ timeout-minutes: 120env:FFMPEG_WINDOWS: https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n8.1-latest-win64-gpl-shared-8.1.zipsteps:- uses: actions/checkout@v7with:ref: ${{ inputs.ref }}- - uses: dtolnay/rust-toolchain@stable+ - name: The pinned toolchain+ id: toolchain+ shell: bash+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: ${{ steps.toolchain.outputs.channel }}- name: FFmpeg (macOS)if: runner.os == 'macOS'run: |diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.ymlindex ab1bec21..758a6116 100644--- a/.github/workflows/mobile.yml+++ b/.github/workflows/mobile.yml@@ -20,13 +20,25 @@ name: Build for phones# src/scripts/mobile-env.sh is the one description of the build# environment, here and on a developer's machine.#-# The APK is signed with the repository's key when ANDROID_KEYSTORE (the-# keystore, base64) and ANDROID_KEYSTORE_PASSWORD are set as secrets, and-# with a key made for the run when they are not. The .ipa is ad-hoc-# signed: a tester signs it with their own Apple ID on the way onto a-# phone (AltStore, Sideloadly, Xcode's Devices window all do this).+# The APK is built under a key made for the run, and a release (the `sign`+# input, which release.yml alone passes) signs it over again with the+# repository's key, ANDROID_KEYSTORE (the keystore, base64) and+# ANDROID_KEYSTORE_PASSWORD, in a step of its own after the build: the key+# never sits in the environment of the build and the several hundred build+# scripts it runs, and a pull request's run never sees it at all. The .ipa+# is ad-hoc signed: a tester signs it with their own Apple ID on the way+# onto a phone (AltStore, Sideloadly, Xcode's Devices window all do this).on:workflow_call:+ inputs:+ ref:+ description: The ref to build, when it is not the one this runs on+ type: string+ default: ""+ sign:+ description: Sign the APK with the repository's key; a release does, nothing else may+ type: boolean+ default: falsesecrets:ANDROID_KEYSTORE:description: Base64 of the release keystore@@ -55,19 +67,26 @@ jobs:runs-on: ubuntu-latesttimeout-minutes: 90steps:+ # The ref release.yml names, which is its tag: without one a run+ # started by hand builds main and publishes it under the tag's name.- uses: actions/checkout@v7+ with:+ ref: ${{ inputs.ref }}- name: Read the versionid: versionrun: |version=$(sed -n 's/^version = "\(.*\)"/\1/p' src/Cargo.toml | head -1)echo "version=$version" >> "$GITHUB_OUTPUT"echo "Building Concat $version for aarch64-linux-android"- # The engine pins its toolchain in rust-toolchain.toml, so the phone's- # standard library is added to that toolchain from inside src/,- # where the pin applies.- - uses: dtolnay/rust-toolchain@stable- - run: rustup target add aarch64-linux-android- working-directory: src+ # The toolchain src/rust-toolchain.toml pins, installed by name, with+ # the phone's standard library.+ - name: The pinned toolchain+ id: toolchain+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: ${{ steps.toolchain.outputs.channel }}+ targets: aarch64-linux-android- uses: taiki-e/cache-cargo-install-action@v2with:tool: cargo-apk@@ -106,28 +125,20 @@ jobs:workspaces: srckey: aarch64-linux-android- # A release APK has to be signed. With the repository's key it is- # signed with that, and installs over the store's build; without one- # it is signed with a key made for the run, which installs on a phone- # as any sideloaded app does.- - name: Signing key- env:- KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE }}- KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ # A release APK has to be signed, and cargo-apk signs it as it builds,+ # so the build runs under a key made for the run. That key installs+ # on a phone as any sideloaded app does, and there is nothing worth+ # keeping in the environment the build scripts of several hundred+ # crates run in.+ - name: A key for the runrun: |set -euo pipefail- keystore=$RUNNER_TEMP/release.keystore- if [ -n "$KEYSTORE_B64" ]; then- echo "$KEYSTORE_B64" | base64 --decode > "$keystore"- password=$KEYSTORE_PASSWORD- else- password=concat- keytool -genkeypair -v -keystore "$keystore" -storepass "$password" -keypass "$password" \- -alias concat -keyalg RSA -keysize 2048 -validity 10000 \- -dname "CN=Concat, O=Concat" >/dev/null 2>&1- fi+ keystore=$RUNNER_TEMP/run.keystore+ keytool -genkeypair -v -keystore "$keystore" -storepass concat -keypass concat \+ -alias concat -keyalg RSA -keysize 2048 -validity 10000 \+ -dname "CN=Concat, O=Concat" >/dev/null 2>&1echo "CARGO_APK_RELEASE_KEYSTORE=$keystore" >> "$GITHUB_ENV"- echo "CARGO_APK_RELEASE_KEYSTORE_PASSWORD=$password" >> "$GITHUB_ENV"+ echo "CARGO_APK_RELEASE_KEYSTORE_PASSWORD=concat" >> "$GITHUB_ENV"# The build environment first, then the build under it.- name: Build the APK@@ -137,6 +148,33 @@ jobs:eval "$(scripts/mobile-env.sh aarch64-linux-android)"cargo apk build --release -p concat-android 2>&1 | tee build.log+ # A release's APK is signed over again with the repository's key, so+ # it installs over the build before it. Only a release asks (`sign`);+ # the key and its password reach this one step, the password through+ # the environment and never the command line, and the keystore is+ # removed once the signature is on. apksigner replaces the run's+ # signature rather than adding to it. A release with no key set keeps+ # the run's key and says so in the run's annotations.+ - name: Sign with the repository's key+ if: inputs.sign+ env:+ KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE }}+ KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ run: |+ set -euo pipefail+ if [ -z "$KEYSTORE_B64" ]; then+ echo "::warning::ANDROID_KEYSTORE is not set; the APK keeps the key made for this run"+ exit 0+ fi+ keystore=$RUNNER_TEMP/release.keystore+ echo "$KEYSTORE_B64" | base64 --decode > "$keystore"+ sdk=${ANDROID_HOME:-$ANDROID_SDK_ROOT}+ tools=$(ls -d "$sdk"/build-tools/*/ | sort -V | tail -1)+ apk=src/target/release/apk/Concat.apk+ "$tools/apksigner" sign --ks "$keystore" --ks-pass env:KEYSTORE_PASSWORD "$apk"+ rm -f "$keystore"+ "$tools/apksigner" verify --print-certs "$apk"+- name: Build log to the summary (failure only)if: failure()run: |@@ -171,18 +209,21 @@ jobs:timeout-minutes: 90steps:- uses: actions/checkout@v7+ with:+ ref: ${{ inputs.ref }}- name: Read the versionid: versionrun: |version=$(sed -n 's/^version = "\(.*\)"/\1/p' src/Cargo.toml | head -1)echo "version=$version" >> "$GITHUB_OUTPUT"echo "Building Concat $version for aarch64-apple-ios"- # The engine pins its toolchain in rust-toolchain.toml, so the phone's- # standard library is added to that toolchain from inside src/,- # where the pin applies.- - uses: dtolnay/rust-toolchain@stable- - run: rustup target add aarch64-apple-ios- working-directory: src+ - name: The pinned toolchain+ id: toolchain+ run: echo "channel=$(sed -n 's/^channel = "\(.*\)"/\1/p' src/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"+ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: ${{ steps.toolchain.outputs.channel }}+ targets: aarch64-apple-ios- run: brew install cmakediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 407f5701..4f9f1ae8 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -71,14 +71,24 @@ jobs:with:ref: ${{ needs.check.outputs.tag }}+ # Both builds are told the tag too. Left to themselves they build the+ # ref the run started on, and a run started by hand starts on main:+ # 0.2.6 shipped that way, 35 commits past the tag it was named for.build:needs: [check, engine]uses: ./.github/workflows/build-app.yml+ with:+ ref: ${{ needs.check.outputs.tag }}secrets: inherit+ # `sign` is the one thing that puts the repository's Android key into a+ # run; a pull request's build of mobile.yml never gets it.phones:needs: [check, engine]uses: ./.github/workflows/mobile.yml+ with:+ ref: ${{ needs.check.outputs.tag }}+ sign: truesecrets: inheritpublish:diff --git a/src/crates/concat-host/src/cards.rs b/src/crates/concat-host/src/cards.rsindex 56138db7..baa18ce6 100644--- a/src/crates/concat-host/src/cards.rs+++ b/src/crates/concat-host/src/cards.rs@@ -587,12 +587,22 @@ mod tests {/// before its screen - comes out changed, where the FFmpeg-drawn cards/// of old came out all but untouched for a mask, a key or a mirror. Set/// `CONCAT_CARDS_DIR` to keep the cards for a look.+ ///+ /// Over a hundred cards is an hour and more on Windows' software+ /// adapter: the CI job that ran it there was killed at ninety minutes+ /// every time. So on a software adapter the test runs only where the+ /// job says the GPU tests must (`CONCAT_REQUIRE_GPU`, which Linux CI+ /// sets for its lavapipe), and skips otherwise, saying so.#[test]fn every_card_draws_and_shows_its_package_at_work() {let Some(compositor) = WgpuCompositor::new() else {eprintln!("no usable GPU adapter; skipping");return;};+ if compositor.on_software_adapter() && std::env::var_os("CONCAT_REQUIRE_GPU").is_none() {+ eprintln!("a software adapter only, and CONCAT_REQUIRE_GPU is not set; skipping");+ return;+ }let dir = std::env::var_os("CONCAT_CARDS_DIR").map(PathBuf::from).unwrap_or_else(|| scratch("draw"));diff --git a/src/crates/concat-render/src/gpu.rs b/src/crates/concat-render/src/gpu.rsindex 2cf1f6f2..0c6db126 100644--- a/src/crates/concat-render/src/gpu.rs+++ b/src/crates/concat-render/src/gpu.rs@@ -720,6 +720,14 @@ impl WgpuCompositor {self.device.adapter_info()}+ /// Whether this compositor draws on a software adapter (WARP, lavapipe)+ /// rather than a GPU. The pictures are the same; the time is not, by+ /// one or two orders, which is what a test that draws hundreds of them+ /// asks before it starts.+ pub fn on_software_adapter(&self) -> bool {+ self.device.adapter_info().device_type == wgpu::DeviceType::Cpu+ }+/// A second compositor on this one's device, with pipelines, pools and/// caches of its own: work on another thread - the effect cards -/// shares the GPU's time with this one and nothing else, so it never