#!/usr/bin/env bash # Orbit's release gate (8 November 2026): the same checks for every change and every provider, before anything reaches a TV. # Builds both editions (household APK, Play APK and Play bundle, all unsigned), runs every unit test for both (the shared # provider contract suite included) and lint, and fails on any failure, any lint error, a missing contract suite, or an # editions check that fails (tools/check_editions.py). Prints the SHA-256s for the install record. # tools/verify.sh (uses Orbit's offline .tooling cache when it's there) set -euo pipefail ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" TOOLING="${ORBIT_TOOLING:-$ROOT/../orbit-tv/.tooling}" OFFLINE=() if [ -d "$TOOLING/gradle-cache" ]; then export GRADLE_USER_HOME="$TOOLING/gradle-cache" ANDROID_USER_HOME="$TOOLING/android"; OFFLINE=(--offline); fi export ANDROID_HOME="${ANDROID_HOME:-/opt/android-sdk}" python3 "$ROOT/tools/test_compare_snapshots.py" 2>&1 | tail -1 # the install checker is tested too cd "$ROOT/android" # A clean build every time (9 November 2026): incremental builds left stale Compose stability checks in the APK. ./gradlew --no-daemon "${OFFLINE[@]}" -q clean ./gradlew --no-daemon "${OFFLINE[@]}" -q :app:assembleHouseholdRelease :app:assemblePlayRelease :app:bundlePlayRelease \ :app:testHouseholdDebugUnitTest :app:testPlayDebugUnitTest --rerun :app:lintHouseholdRelease :app:lintPlayRelease python3 - <<'PY' import glob, re, sys ok = True for edition in ("Household", "Play"): tests = fails = 0; contract = False for p in glob.glob(f'app/build/test-results/test{edition}DebugUnitTest/*.xml'): s = open(p).read(); m = re.search(r'tests="(\d+)".*?failures="(\d+)".*?errors="(\d+)"', s) tests += int(m[1]); fails += int(m[2]) + int(m[3]) if 'ContractTest' in p and 'MediaProviderContract' not in p: contract = True lint = len(re.findall(r'severity="(Error|Fatal)"', open(f'app/build/reports/lint-results-{edition.lower()}Release.xml').read())) print(f"{edition.lower()}: tests {tests}, failures {fails}, lint errors {lint}, contract suite {'present' if contract else 'MISSING'}") ok = ok and fails == 0 and lint == 0 and contract and tests > 0 sys.exit(0 if ok else 1) PY HOUSEHOLD=app/build/outputs/apk/household/release/app-household-release-unsigned.apk PLAY=app/build/outputs/apk/play/release/app-play-release-unsigned.apk BUNDLE=app/build/outputs/bundle/playRelease/app-play-release.aab # Both editions as built (Paul, 10 November 2026): ids, version codes, Play isolation, household intact, nothing signed. # The playback test hook and any server address are refused in every edition there too. python3 "$ROOT/tools/check_editions.py" "$HOUSEHOLD" "$PLAY" "$BUNDLE" "$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)/aapt2" sha256sum "$HOUSEHOLD" "$PLAY" "$BUNDLE" | sed "s#app/build/outputs/##" echo "Release gate passed."