Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
ci(workflows): harden runner timeouts, preflight packaging, and installer smoke tests
Samir Hossainsc919528db882
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 47aaec6..5bb15f9 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -16,6 +16,7 @@ jobs:hygiene:name: Hygieneruns-on: ubuntu-latest+ timeout-minutes: 15steps:- uses: actions/checkout@v7- uses: dtolnay/rust-toolchain@stable@@ -28,6 +29,16 @@ jobs:- run: cargo fmt --check- name: Validate Unix installer syntaxrun: bash -n install.sh+ - name: Validate Windows installer syntax+ shell: pwsh+ run: |+ $tokens = $null+ $errors = $null+ [System.Management.Automation.Language.Parser]::ParseFile("install.ps1", [ref]$tokens, [ref]$errors) | Out-Null+ if ($errors.Count -gt 0) {+ $errors | Format-List+ exit 1+ }- run: cargo check --all-targets --all-features --locked- run: cargo clippy --all-targets --all-features --locked -- -D warnings- name: Audit dependencies@@ -41,6 +52,7 @@ jobs:build-and-test:name: Build and test (${{ matrix.os }})runs-on: ${{ matrix.os }}+ timeout-minutes: 25strategy:fail-fast: falsematrix:@@ -57,14 +69,3 @@ jobs:- run: cargo test --all-features --locked- name: Smoke-test binary startuprun: cargo run --all-features --locked -- --version- - name: Validate Windows installer syntax- if: runner.os == 'Windows'- shell: pwsh- run: |- $tokens = $null- $errors = $null- [System.Management.Automation.Language.Parser]::ParseFile("install.ps1", [ref]$tokens, [ref]$errors) | Out-Null- if ($errors.Count -gt 0) {- $errors | Format-List- exit 1- }diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.ymlindex 02b9781..b35e225 100644--- a/.github/workflows/homebrew.yml+++ b/.github/workflows/homebrew.yml@@ -63,12 +63,22 @@ jobs:echo "tag=$VERSION" >> $GITHUB_OUTPUTBASE_URL="https://github.com/${{ github.repository }}/releases/download/$VERSION"- curl -fsSL "$BASE_URL/MovieBox_macOS_Universal.tar.gz" -o macos.tar.gz- curl -fsSL "$BASE_URL/MovieBox_Linux_x64.tar.gz" -o linux-x64.tar.gz- curl -fsSL "$BASE_URL/MovieBox_Linux_arm64.tar.gz" -o linux-arm64.tar.gz- echo "macos_sha=$(sha256sum macos.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT- echo "linux_x64_sha=$(sha256sum linux-x64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT- echo "linux_arm64_sha=$(sha256sum linux-arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT+ curl -fsSL --retry 3 "$BASE_URL/SHA256SUMS" -o SHA256SUMS++ macos_sha=$(awk '$2 == "MovieBox_macOS_Universal.tar.gz" {print $1}' SHA256SUMS)+ linux_x64_sha=$(awk '$2 == "MovieBox_Linux_x64.tar.gz" {print $1}' SHA256SUMS)+ linux_arm64_sha=$(awk '$2 == "MovieBox_Linux_arm64.tar.gz" {print $1}' SHA256SUMS)++ for sha in "$macos_sha" "$linux_x64_sha" "$linux_arm64_sha"; do+ if [[ ! "$sha" =~ ^[0-9a-fA-F]{64}$ ]]; then+ echo "::error::Invalid or missing SHA256 checksum in release manifest: $sha"+ exit 1+ fi+ done++ echo "macos_sha=$macos_sha" >> $GITHUB_OUTPUT+ echo "linux_x64_sha=$linux_x64_sha" >> $GITHUB_OUTPUT+ echo "linux_arm64_sha=$linux_arm64_sha" >> $GITHUB_OUTPUT- name: Update Formulaif: ${{ steps.release_gate.outputs.update != 'false' }}diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d44b872..f4a8150 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -15,6 +15,7 @@ jobs:check-version:name: Check Versionruns-on: ubuntu-latest+ timeout-minutes: 10outputs:version: ${{ steps.check.outputs.version }}is_new: ${{ steps.check.outputs.is_new }}@@ -26,7 +27,7 @@ jobs:VERSION=$(grep '^version =' Cargo.toml | head -1 | awk -F'"' '{print $2}')echo "version=$VERSION" >> $GITHUB_OUTPUT- if gh release view "v$VERSION" &>/dev/null; then+ if gh release view "v$VERSION" --repo "${{ github.repository }}" &>/dev/null; thenecho "is_new=false" >> $GITHUB_OUTPUTecho "Release v$VERSION already exists. Skipping build."else@@ -41,12 +42,12 @@ jobs:needs: check-versionif: needs.check-version.outputs.is_new == 'true'runs-on: ubuntu-latest+ timeout-minutes: 15steps:- uses: actions/checkout@v7- uses: dtolnay/rust-toolchain@stablewith:toolchain: 1.90.0- targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl,x86_64-apple-darwin,aarch64-apple-darwin,x86_64-pc-windows-msvc,aarch64-pc-windows-msvc- uses: Swatinem/rust-cache@v2with:prefix-key: "release-preflight"@@ -57,6 +58,7 @@ jobs:needs: [check-version, preflight]if: needs.check-version.outputs.is_new == 'true'runs-on: ${{ matrix.os }}+ timeout-minutes: 30strategy:fail-fast: falsematrix:@@ -181,6 +183,7 @@ jobs:needs: [check-version, build]if: needs.check-version.outputs.is_new == 'true'runs-on: macos-latest+ timeout-minutes: 15steps:- uses: actions/checkout@v7@@ -218,6 +221,7 @@ jobs:needs: [check-version, build, build-macos-universal]if: needs.check-version.outputs.is_new == 'true'runs-on: ubuntu-latest+ timeout-minutes: 15permissions:attestations: writecontents: writediff --git a/install.ps1 b/install.ps1index df56271..b1a4099 100644--- a/install.ps1+++ b/install.ps1@@ -310,6 +310,14 @@ try {try { Unblock-File -Path $ExtractedExe -ErrorAction SilentlyContinue } catch {}Move-Item -Path $ExtractedExe -Destination $ExePath -Forcetry { Unblock-File -Path $ExePath -ErrorAction SilentlyContinue } catch {}+ try {+ $SmokeOutput = (& $ExePath --version 2>&1 | Out-String)+ if ($LASTEXITCODE -ne 0) {+ throw "Binary execution test failed: $SmokeOutput"+ }+ } catch {+ throw "Binary execution test failed: $_"+ }Write-Success "[4/4] Binary installed to $ExePath"} catch {Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinue@@ -360,7 +368,7 @@ Write-Host " $ moviebox-tui" -ForegroundColor GreenWrite-Host ""if (-not $PlayerDetected) {- Write-Host " [i] Note: A media player (mpv, VLC, or IINA) is recommended for video playback.`n" -ForegroundColor Cyan+ Write-Host " [i] Note: A media player (mpv or VLC) is recommended for video playback.`n" -ForegroundColor Cyan}if ($PathModified) {diff --git a/install.sh b/install.shindex 33305d8..671403f 100755--- a/install.sh+++ b/install.sh@@ -416,12 +416,14 @@ resolve_version() {filocal release_header- release_header=$(curl -fsSI "https://github.com/$REPO/releases/latest") || {- log_error "Failed to contact GitHub for latest release."- return 1- }- local tag- tag=$(printf "%s" "$release_header" | grep -i '^location:' | awk -F '/' '{print $NF}' | tr -d '\r\n')+ release_header=$(curl -fsSI "https://github.com/$REPO/releases/latest" 2>/dev/null || true)+ local tag=""+ if [ -n "$release_header" ]; then+ tag=$(printf "%s" "$release_header" | grep -i '^location:' | awk -F '/' '{print $NF}' | tr -d '\r\n')+ fi+ if [ -z "$tag" ]; then+ tag=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" 2>/dev/null | grep '"tag_name":' | head -1 | awk -F '"' '{print $4}' || true)+ fiif [ -z "$tag" ]; thenlog_error "Could not resolve latest release version from GitHub."return 1@@ -461,7 +463,7 @@ if [ -n "$EXISTING_BIN" ] && [ -x "$EXISTING_BIN" ]; thenprintf "\n %b%s%b %b%s%b\n" "$C_YELLOW" "ℹ" "$C_RESET" "$C_TEXT" "MovieBox-TUI $TARGET_VERSION is already installed at $EXISTING_BIN." "$C_RESET"printf " Choose an action: [1] Reinstall [2] Uninstall [3] Exit: "if [ -e /dev/tty ]; then- read -r user_choice </dev/tty || user_choice="3"+ read -r user_choice </dev/tty 2>/dev/null || user_choice="3"elseread -r user_choice || user_choice="3"fi@@ -550,12 +552,12 @@ run_spinner "[4/4] Installing binary to $INSTALL_DIR" install_binary || exit 1log_success "[4/4] Binary installed to $APP_PATH"if [ "$DRY_RUN" -eq 0 ]; then- if ! "$APP_PATH" --version >/dev/null 2>&1; then- log_error "Installed binary failed execution smoke test ($APP_PATH)."+ if ! smoke_output=$("$APP_PATH" --version 2>&1); then+ log_error "Installed binary failed execution smoke test ($APP_PATH):"+ printf " %s\n" "$smoke_output" >&2exit 1fifi-SHELL_MODIFIED=""if [ "$NO_MODIFY_PATH" -eq 0 ]; thenif ! echo "$PATH" | tr ':' '\n' | grep -Fqx "$INSTALL_DIR"; then@@ -596,16 +598,23 @@ if [ "$NO_MODIFY_PATH" -eq 0 ]; thenfiPLAYER_DETECTED=""-if command -v mpv >/dev/null 2>&1 || [ -d "/Applications/mpv.app" ] || [ -d "$HOME/Applications/mpv.app" ] || [ -f "$HOME/.local/share/flatpak/exports/bin/io.mpv.Mpv" ] || [ -f "/var/lib/flatpak/exports/bin/io.mpv.Mpv" ]; then- PLAYER_DETECTED="mpv"-elif command -v iina >/dev/null 2>&1 || command -v iina-cli >/dev/null 2>&1 || [ -d "/Applications/IINA.app" ] || [ -d "$HOME/Applications/IINA.app" ]; then- PLAYER_DETECTED="IINA"-elif command -v vlc >/dev/null 2>&1 || [ -d "/Applications/VLC.app" ] || [ -d "$HOME/Applications/VLC.app" ] || [ -f "$HOME/.local/share/flatpak/exports/bin/org.videolan.VLC" ] || [ -f "/var/lib/flatpak/exports/bin/org.videolan.VLC" ]; then- PLAYER_DETECTED="VLC"-elif command -v termux-open >/dev/null 2>&1; then- PLAYER_DETECTED="Android Player (termux-open)"+if [ "$OS" = "Darwin" ]; then+ if command -v iina >/dev/null 2>&1 || command -v iina-cli >/dev/null 2>&1 || [ -d "/Applications/IINA.app" ] || [ -d "$HOME/Applications/IINA.app" ]; then+ PLAYER_DETECTED="IINA"+ elif command -v mpv >/dev/null 2>&1 || [ -d "/Applications/mpv.app" ] || [ -d "$HOME/Applications/mpv.app" ]; then+ PLAYER_DETECTED="mpv"+ elif command -v vlc >/dev/null 2>&1 || [ -d "/Applications/VLC.app" ] || [ -d "$HOME/Applications/VLC.app" ]; then+ PLAYER_DETECTED="VLC"+ fi+else+ if command -v mpv >/dev/null 2>&1 || [ -f "$HOME/.local/share/flatpak/exports/bin/io.mpv.Mpv" ] || [ -f "/var/lib/flatpak/exports/bin/io.mpv.Mpv" ]; then+ PLAYER_DETECTED="mpv"+ elif command -v vlc >/dev/null 2>&1 || [ -f "$HOME/.local/share/flatpak/exports/bin/org.videolan.VLC" ] || [ -f "/var/lib/flatpak/exports/bin/org.videolan.VLC" ]; then+ PLAYER_DETECTED="VLC"+ elif command -v termux-open >/dev/null 2>&1; then+ PLAYER_DETECTED="Android Player (termux-open)"+ fifi-printf "\n"printf " %b✔ MovieBox-Tui %s successfully installed!%b\n\n" "$C_GREEN" "$TARGET_VERSION" "$C_RESET"printf " %b•%b %bBinary:%b %b%s%b\n" "$C_MUTED" "$C_RESET" "$C_MUTED" "$C_RESET" "$C_TEXT" "$APP_PATH" "$C_RESET"