From 3736b0543c80f59f5dd648e1df812fec9f5e895f Mon Sep 17 00:00:00 2001 From: zackees Date: Tue, 12 May 2026 20:13:52 -0700 Subject: [PATCH] fix(ci): build the Rust fastled CLI from source when binstall fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #65 added a Python `_find_rust_fastled_cli` helper that locates the Rust binary by walking `target/{release,debug}/`, `$CARGO_HOME/bin`, and PATH (skipping Python venv dirs). On CI the helper now correctly skips the Python entry-point shim — but then returns `None` because the Rust binary is missing entirely: * `cargo binstall fastled-cli` fails (no release published yet). * `cargo test --workspace` (in `./test`) compiles the test binary into `target//debug/deps/` but does not always produce the main bin output at `target//debug/fastled[.exe]`. * The Build Webpage / deploy job never runs `cargo test` at all. So `Api.project_init` / `download_cpp_devtools_extension` fail with "Could not locate the fastled CLI binary" on every CI runner. Fix: when cargo-binstall does not supply a pre-built copy, fall back to `cargo build --release --bin fastled` inside `./install`. Both the unit-test and deploy jobs go through `./install`, so this covers both broken paths. Uses the local `_cargo` trampoline so the MSVC target is forced on Windows (matching where the existing helper searches). Local: `bash lint` clean, 119 unit tests pass. --- install | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/install b/install index cbfa5471..388c9614 100755 --- a/install +++ b/install @@ -79,8 +79,31 @@ if ! command -v cargo-binstall &> /dev/null; then | bash 2>/dev/null || echo " cargo-binstall install failed (non-fatal)" fi +FASTLED_CLI_BINSTALLED=0 +FASTLED_TAURI_BINSTALLED=0 if command -v cargo-binstall &> /dev/null; then echo "Fetching pre-built binaries via cargo-binstall..." - cargo binstall fastled-cli --no-confirm 2>/dev/null || echo " fastled-cli: no pre-built binary available (will compile from source when needed)" - cargo binstall fastled-tauri --no-confirm 2>/dev/null || echo " fastled-tauri: no pre-built binary available (will compile from source when needed)" + if cargo binstall fastled-cli --no-confirm 2>/dev/null; then + FASTLED_CLI_BINSTALLED=1 + else + echo " fastled-cli: no pre-built binary available (will compile from source)" + fi + if cargo binstall fastled-tauri --no-confirm 2>/dev/null; then + FASTLED_TAURI_BINSTALLED=1 + else + echo " fastled-tauri: no pre-built binary available (will compile from source)" + fi +fi + +# Ensure the Rust `fastled` CLI binary is materialised somewhere our Python +# helpers (src/fastled/_rust_cli.py) can find it. The Python `[project.scripts]` +# entry-point shim collides with the Rust binary's name on PATH, so the helper +# explicitly looks in target/{release,debug}/ and $CARGO_HOME/bin. If +# cargo-binstall didn't supply a pre-built copy, build from source so unit +# tests and the deploy workflow can subprocess the binary for the internal +# auto-install plumbing flags (--internal-ensure-fastled-repo, etc.). +if [[ "$FASTLED_CLI_BINSTALLED" -eq 0 ]]; then + echo "Building fastled CLI from source..." + "$(dirname "$0")/_cargo" build --release --bin fastled \ + || { echo "Error: cargo build --bin fastled failed"; exit 1; } fi