#!/bin/bash

set -e

# Root directory of the tests: lambda-documents/tests
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPORT_FILE="report/report_cross_lambda.html"

echo "Root directory is: $ROOT_DIR"
echo "▶ Running linting..."
yamllint -s docker-compose.yaml
ruff check .
ruff format . --check --diff
mypy cross_lambda_integration models utils config.py

echo "▶ Running Cross Lambda Tests..."

pytest $ROOT_DIR/cross_lambda_integration/test*.py --html="$REPORT_FILE" --self-contained-html --reruns 1 --reruns-delay 1

echo "✅ Cross-lambda tests done. View report in $REPORT_FILE/"

