Files
OrbitTv/tools/verify.sh
T
pauljdandClaude Opus 5.5 a719f68b19 Provider contract step 1: MediaProvider interface, shared contract tests, release gate
Paul approved the seven-operation contract (8 November 2026). This step adds it alongside today's Emby session, which
the app still uses unchanged: nothing calls MediaProvider yet, so no behaviour, stored id, schedule, database or
signing changes.

- MediaProvider.kt: the contract, LibraryId (server's own id, never its address), MediaRef for anything leaving its
  library, five ProviderError kinds, PlaybackPlan whose loggable form leaves out credentials, local file ids from a
  128-bit SHA-256 prefix.
- MediaProviderContract: twelve shared checks every adapter must pass; a reference provider passes them all, and
  ContractCatchesFlawsTest shows each check fails on the flaw it guards against.
- tools/verify.sh: the release gate (build, all tests, lint, contract suite present); .gitea/workflows/ci.yml runs it
  on every push where a runner exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:19:14 +00:00

27 lines
1.7 KiB
Bash
Executable File

#!/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 the release APK, runs every unit test (the shared provider contract suite included) and lint, and fails on any
# failure, any lint error, or a missing contract suite. Prints the APK's SHA-256 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}"
cd "$ROOT/android"
./gradlew --no-daemon "${OFFLINE[@]}" -q :app:assembleRelease :app:testDebugUnitTest --rerun :app:lintRelease
python3 - <<'PY'
import glob, re, sys
tests = fails = 0; contract = False
for p in glob.glob('app/build/test-results/testDebugUnitTest/*.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('app/build/reports/lint-results-release.xml').read()))
print(f"tests {tests}, failures {fails}, lint errors {lint}, contract suite {'present' if contract else 'MISSING'}")
sys.exit(0 if fails == 0 and lint == 0 and contract and tests > 0 else 1)
PY
sha256sum app/build/outputs/apk/release/app-release.apk | cut -c1-64
echo "Release gate passed."