#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"

VENV_DIR="$(mktemp -d "${TMPDIR:-/tmp}/myaudio-fresh-venv.XXXXXX")"
trap 'rm -rf "$VENV_DIR"' EXIT

python3 -m venv "$VENV_DIR"
. "$VENV_DIR/bin/activate"

python3 tests/smoke_publish_parser.py
python3 tests/smoke_transcribe_helpers.py
python3 -m py_compile transcribe_audio.py 03_publish_to_wordpress.py

if command -v plutil >/dev/null 2>&1; then
  plutil -lint com.berchman.whisper.publish.plist.example com.berchman.whisper.transcribe.plist
fi

echo "fresh venv smoke check passed"
