Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
ci: skip downstream workflows without a release and gate the live test
Samir Hossains0d3116bf9b2d
diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.ymlindex 73a284e..02b9781 100644--- a/.github/workflows/homebrew.yml+++ b/.github/workflows/homebrew.yml@@ -15,6 +15,7 @@ jobs:update-homebrew:if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}runs-on: ubuntu-latest+ timeout-minutes: 15permissions:contents: writesteps:@@ -34,8 +35,23 @@ jobs:ref: ${{ steps.ref.outputs.target_ref }}fetch-depth: 0+ - name: Skip when no release was published+ id: release_gate+ if: ${{ github.event_name == 'workflow_run' }}+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ VERSION="v$(grep '^version =' Cargo.toml | head -1 | awk -F'"' '{print $2}')"+ if gh release view "$VERSION" --repo "${{ github.repository }}" --json id > /dev/null 2>&1; then+ echo "update=true" >> "$GITHUB_OUTPUT"+ else+ echo "Release run finished without publishing $VERSION (no new release). Nothing to do."+ echo "update=false" >> "$GITHUB_OUTPUT"+ fi+- name: Get Release Dataid: release+ if: ${{ steps.release_gate.outputs.update != 'false' }}run: |VERSION="v$(grep '^version =' Cargo.toml | head -1 | awk -F'"' '{print $2}')"CLEAN_VERSION="${VERSION#v}"@@ -55,6 +71,7 @@ jobs:echo "linux_arm64_sha=$(sha256sum linux-arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT- name: Update Formula+ if: ${{ steps.release_gate.outputs.update != 'false' }}run: |FORMULA_FILE="Formula/moviebox-tui.rb"VERSION="${{ steps.release.outputs.version }}"@@ -64,6 +81,7 @@ jobs:sed -i "s/LINUX_ARM64_SHA256 = \".*\"/LINUX_ARM64_SHA256 = \"${{ steps.release.outputs.linux_arm64_sha }}\"/" "$FORMULA_FILE"- name: Commit and Push Changes+ if: ${{ steps.release_gate.outputs.update != 'false' }}uses: stefanzweifel/git-auto-commit-action@v7with:commit_message: "chore(homebrew): update formula to v${{ steps.release.outputs.version }}"diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex a5398ea..1cc1a48 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -19,6 +19,7 @@ jobs:name: Publishif: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}runs-on: ubuntu-latest+ timeout-minutes: 20steps:- name: Determine refid: ref@@ -34,7 +35,22 @@ jobs:with:ref: ${{ steps.ref.outputs.target_ref }}+ - name: Skip when no release was published+ id: release_gate+ if: ${{ github.event_name == 'workflow_run' }}+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ VERSION=$(grep '^version =' Cargo.toml | head -1 | awk -F'"' '{print $2}')+ if gh release view "v$VERSION" --repo "${{ github.repository }}" --json id > /dev/null 2>&1; then+ echo "publish=true" >> "$GITHUB_OUTPUT"+ else+ echo "Release run finished without publishing v$VERSION (no new release). Nothing to do."+ echo "publish=false" >> "$GITHUB_OUTPUT"+ fi+- name: Confirm version+ if: ${{ steps.release_gate.outputs.publish != 'false' }}run: |VERSION=$(grep '^version =' Cargo.toml | head -1 | awk -F'"' '{print $2}')echo "Publishing version $VERSION from ${{ steps.ref.outputs.target_ref }}"@@ -44,11 +60,13 @@ jobs:fi- name: Install Rust+ if: ${{ steps.release_gate.outputs.publish != 'false' }}uses: dtolnay/rust-toolchain@stablewith:toolchain: 1.90.0- name: Publish to crates.io+ if: ${{ steps.release_gate.outputs.publish != 'false' }}env:CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}run: cargo publish --lockeddiff --git a/docs/release-checklist.md b/docs/release-checklist.mdindex 89c28f2..32c1530 100644--- a/docs/release-checklist.md+++ b/docs/release-checklist.md@@ -22,6 +22,9 @@ Confirm the entire unit and integration test suite passes on the CI host matrixcleanly and pass the release workflow's target-binary `--version` smoke test; theystill require native player/runtime checks before release certification. A localhost without the target C/linker toolchain cannot substitute for that runner result.+Known gap: the Windows ARM64 binary is built and published but never executed by the+release workflow (x64 runners cannot run it); smoke-test it manually, e.g. under+Windows on ARM emulation or a native ARM64 device, before certifying a release.Confirm the main GitHub Actions workflows are green:diff --git a/docs/testing.md b/docs/testing.mdindex a0705ea..e2fe5ed 100644--- a/docs/testing.md+++ b/docs/testing.md@@ -30,8 +30,8 @@ MovieBox-TUI/├── content_pipeline.rs # Content/metadata pipeline, stale request isolation, & cache keys├── tui_acceptance.rs # Headless TUI rendering, theme rendering, and resize matrix├── update_lifecycle.rs # Update single-flight checks, modal hitboxes, & platform assets- ├── real_acceptance.rs # Real artifact downloads, live SHA256 integrity, & version verify- ├── version_upgrade_e2e.rs # Genuine 0.1.12 -> 0.1.13 end-to-end upgrade execution+ ├── real_acceptance.rs # Opt-in live artifact downloads, SHA256 integrity, & version verify+ ├── version_upgrade_e2e.rs # Offline (mock-server) end-to-end upgrade execution├── addons_manifest.rs # Addon manifest deserialization & catalog checks└── favorites_lifecycle.rs # Favorites persistence, identity, and navigation lifecycle```@@ -46,9 +46,9 @@ Inline unit tests live inside `#[cfg(test)] mod tests` blocks within their respe### B. Subsystem Integration Tests (`tests/*.rs`)Integration tests live in the `tests/` directory and test externally observable behaviors without mocking internal types:-- **`version_upgrade_e2e.rs`**: Validates genuine end-to-end version upgrade from `0.1.12` to `0.1.13`, verifying discovery, live HTTP asset and checksum download, SHA-256 integrity check, staging, atomic replacement, and verification that the newly installed binary returns `moviebox-tui 0.1.13` (where old version != new version).+- **`version_upgrade_e2e.rs`**: Validates the full update pipeline against a local mock HTTP server (no real network), verifying discovery, asset and checksum download, SHA-256 integrity check, staging, atomic replacement, rollback, and verification that the newly installed binary reports its new version (Unix only).- **`update_lifecycle.rs`**: Validates update single-flight concurrency barriers, error recovery on network failure, 1:1 mouse hit-test synchronization with rendered popup geometry, deterministic platform asset filtering, checksum integrity verification (valid, mismatch, missing, multi-format), archive extraction with strict path traversal rejection (`..`), active work protection (playback and download guards), environment detection (Homebrew, ReadOnly, DirectReplace), and safe atomic binary replacement/rollback.-- **`real_acceptance.rs`**: Validates real-world GitHub release artifact downloads, live streaming SHA-256 verification against upstream `SHA256SUMS`, actual archive extraction to non-empty executable binaries (`chmod 0755`), real `--version` validation of extracted binaries, Windows helper script batch syntax, and data preservation across updates.+- **`real_acceptance.rs`**: Validates real-world GitHub release artifact downloads, live streaming SHA-256 verification against upstream `SHA256SUMS`, actual archive extraction to non-empty executable binaries (`chmod 0755`), real `--version` validation of extracted binaries, Windows helper script batch syntax, and data preservation across updates. The live-download test is `#[ignore]`-gated so default runs stay offline; opt in with `MOVIEBOX_LIVE_TESTS=1 cargo test --test real_acceptance -- --ignored`.- **`content_pipeline.rs`**: Validates search result identity, ambiguous title isolation, stale metadata response protection (`request_id` validation), cache key dimensional isolation, addon metadata mapping & partial degradation, search failure vs empty result status distinction, and mode-switch stale response isolation.- **`error_handling.rs`**: Validates active player session lifecycle, playback debounce guards, search failure cleanup, addon manifest error toasts, stream and download resolution failure notifications, malformed M3U recovery, and URL scheme rejection.- **`tui_acceptance.rs`**: Validates headless TUI rendering, all theme palettes, end-to-end user journeys (search, details, navigation, mode switching), mouse click and scroll interactions, modal dismissals, and terminal resize matrices across 8 standard and boundary dimensions without panics.@@ -85,6 +85,12 @@ cargo test --test player_integration --all-features --lockedcargo test --test m3u_integration --all-features --locked```+Run the opt-in live-network acceptance test:++```bash+MOVIEBOX_LIVE_TESTS=1 cargo test --test real_acceptance --all-features --locked -- --ignored+```+---## 3. Code Hygiene and Static Analysisdiff --git a/tests/real_acceptance.rs b/tests/real_acceptance.rsindex 4290a0a..a54b9d8 100644--- a/tests/real_acceptance.rs+++ b/tests/real_acceptance.rs@@ -13,8 +13,20 @@ use std::io::Write;#[cfg(target_os = "macos")]use std::process::Command;+fn live_tests_enabled() -> bool {+ matches!(+ std::env::var("MOVIEBOX_LIVE_TESTS").as_deref(),+ Ok("1") | Ok("true")+ )+}+#[tokio::test]+#[ignore = "live network test; opt in with MOVIEBOX_LIVE_TESTS=1 cargo test -- --ignored"]async fn test_real_github_release_artifact_download_and_integrity() {+ if !live_tests_enabled() {+ eprintln!("skipping live-network test; set MOVIEBOX_LIVE_TESTS=1 to enable");+ return;+ }let temp_dir = tempfile::tempdir().unwrap();let archive_path = temp_dir.path().join("MovieBox_macOS_Universal.tar.gz");let checksum_url =