| # SpeechKit CI: unit tests + numeric regression + memory stress. | |
| # Usage: ./Scripts/ci.sh [workspace-dir] (workspace = iphone-asr checkout with dist/ + ios_refs/) | |
| set -euo pipefail | |
| cd "$(dirname "$0")/.." | |
| WORKSPACE="${1:-..}" | |
| echo "== unit tests ==" | |
| swift test 2>&1 | tail -3 | |
| echo "== build release ==" | |
| swift build -c release 2>&1 | tail -1 | |
| echo "== numeric regression ==" | |
| OUT=$(./.build/release/asrkit-cli "$WORKSPACE") | |
| echo "$OUT" | |
| if echo "$OUT" | grep -q FAIL; then | |
| echo "CI FAIL: regression check failed"; exit 1 | |
| fi | |
| echo "== memory stress (100 passes) ==" | |
| STRESS=$(./.build/release/asrkit-cli "$WORKSPACE" --stress | grep stress) | |
| echo "$STRESS" | |
| START=$(echo "$STRESS" | head -1 | grep -o '[0-9]\+' | tail -1) | |
| END=$(echo "$STRESS" | tail -1 | grep -o '[0-9]\+' | tail -1) | |
| if [ $((END - START)) -gt 50 ]; then | |
| echo "CI FAIL: footprint grew ${START}MB -> ${END}MB"; exit 1 | |
| fi | |
| echo "== CI PASS ==" | |