#!/usr/bin/env bash

set -e

# type checking
echo 'Running mypy...'
poetry run mypy --cache-dir=/dev/null ows_assets_uploader tests

# run linting of files
echo 'Running yaml linter...'
poetry run yamllint docker-compose.yml
echo 'Running ruff linter...'
poetry run ruff check ows_assets_uploader tests --no-cache
echo 'Running ruff formatter check...'
poetry run ruff format ows_assets_uploader tests --diff --no-cache

# run pytest with args set
echo 'Running tests...'
PYTHONDONTWRITEBYTECODE=1 COVERAGE_FILE=build/.coverage poetry run pytest tests/unit/ \
  -p no:cacheprovider \
  --cov ows_assets_uploader \
  --cov-report xml:build/coverage.xml \
  --cov-report term \
  --junitxml=build/pyunit.xml
