Skip to content

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.yml
index 47aaec6..5bb15f9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,6 +16,7 @@ jobs:
hygiene:
name: Hygiene
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
@@ -28,6 +29,16 @@ jobs:
- run: cargo fmt --check
- name: Validate Unix installer syntax
run: 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: 25
strategy:
fail-fast: false
matrix:
@@ -57,14 +69,3 @@ jobs:
- run: cargo test --all-features --locked
- name: Smoke-test binary startup
run: 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.yml
index 02b9781..b35e225 100644
--- a/.github/workflows/homebrew.yml
+++ b/.github/workflows/homebrew.yml
@@ -63,12 +63,22 @@ jobs:
echo "tag=$VERSION" >> $GITHUB_OUTPUT
BASE_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 Formula
if: ${{ steps.release_gate.outputs.update != 'false' }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d44b872..f4a8150 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -15,6 +15,7 @@ jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
+ timeout-minutes: 10
outputs:
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; then
echo "is_new=false" >> $GITHUB_OUTPUT
echo "Release v$VERSION already exists. Skipping build."
else
@@ -41,12 +42,12 @@ jobs:
needs: check-version
if: needs.check-version.outputs.is_new == 'true'
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
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@v2
with:
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: 30
strategy:
fail-fast: false
matrix:
@@ -181,6 +183,7 @@ jobs:
needs: [check-version, build]
if: needs.check-version.outputs.is_new == 'true'
runs-on: macos-latest
+ timeout-minutes: 15
steps:
- 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: 15
permissions:
attestations: write
contents: write
diff --git a/install.ps1 b/install.ps1
index 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 -Force
try { 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 Green
Write-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.sh
index 33305d8..671403f 100755
--- a/install.sh
+++ b/install.sh
@@ -416,12 +416,14 @@ resolve_version() {
fi
local 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)
+ fi
if [ -z "$tag" ]; then
log_error "Could not resolve latest release version from GitHub."
return 1
@@ -461,7 +463,7 @@ if [ -n "$EXISTING_BIN" ] && [ -x "$EXISTING_BIN" ]; then
printf "\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"
else
read -r user_choice || user_choice="3"
fi
@@ -550,12 +552,12 @@ run_spinner "[4/4] Installing binary to $INSTALL_DIR" install_binary || exit 1
log_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" >&2
exit 1
fi
fi
-
SHELL_MODIFIED=""
if [ "$NO_MODIFY_PATH" -eq 0 ]; then
if ! echo "$PATH" | tr ':' '\n' | grep -Fqx "$INSTALL_DIR"; then
@@ -596,16 +598,23 @@ if [ "$NO_MODIFY_PATH" -eq 0 ]; then
fi
PLAYER_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)"
+ fi
fi
-
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"