#!/usr/bin/env bash

set -e

echo "Running ruff check..."
poetry run ruff check backfill tests --no-cache

echo "Running ruff format..."
poetry run ruff format backfill tests --check --no-cache

echo 'Running mypy...'
poetry run mypy --cache-dir=/dev/null backfill tests

# run pytest with args set
echo 'Running tests...'

PYTHONDONTWRITEBYTECODE=1 COVERAGE_FILE=build/.coverage poetry run pytest tests/unit/ \
  -p no:cacheprovider \
  --cov backfill \
  --cov-report xml:build/coverage.xml \
  --cov-report term \
  --junitxml=build/pyunit.xml

echo 'Validating qa refresh manifest file...'
poetry run pdpbackfill lint manifest --manifest-file-path=pdp_qa_refresh/manifest.json --check-keys-exist-locally
