#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" OUTPUT_DIR="${CV_BENCHMARK_OUTPUT_DIR:-$ROOT_DIR/tmp/cv-benchmarks/latest}" APPROVED_DIR="${CV_BENCHMARK_APPROVED_DIR:-$ROOT_DIR/tmp/cv-benchmarks/approved-fixtures}" CORPUS_DIR="${CV_BENCHMARK_CORPUS_DIR:-/home/pi/cvs}" if [[ ! -d "$CORPUS_DIR" ]]; then echo "CV corpus directory not found: $CORPUS_DIR" >&2 exit 1 fi if ! find "$CORPUS_DIR" -maxdepth 1 -type f \( -iname '*.pdf' -o -iname '*.docx' -o -iname '*.txt' -o -iname '*.md' \) -print -quit | grep -q .; then echo "No supported CV files were found in: $CORPUS_DIR" >&2 exit 1 fi mkdir -p "$OUTPUT_DIR" "$APPROVED_DIR" echo "CV benchmark corpus: $CORPUS_DIR" echo "CV benchmark output: $OUTPUT_DIR" echo "Approved fixtures: $APPROVED_DIR" CV_BENCHMARK_CORPUS_DIR="$CORPUS_DIR" \ CV_BENCHMARK_OUTPUT_DIR="$OUTPUT_DIR" \ CV_BENCHMARK_APPROVED_DIR="$APPROVED_DIR" \ dotnet test "$ROOT_DIR/JobTrackerApi.Tests/JobTrackerApi.Tests.csproj" --filter CvCorpusHarnessTests test -s "$OUTPUT_DIR/index.json" test -s "$OUTPUT_DIR/report.md" if [[ -f "$OUTPUT_DIR/report.md" ]]; then echo echo "Benchmark report written to: $OUTPUT_DIR/report.md" fi if [[ -f "$OUTPUT_DIR/index.json" ]]; then echo "Benchmark index written to: $OUTPUT_DIR/index.json" fi