Fixes: 1) Apply `--omit` filter for test coverage reports to exclude unnecessary files; 2) Replace `services_data` volume mounts with named Docker volumes for consistency and cleanup (e.g., `postgres-data`, `redis-data`); Extra: 1) Remove `services_data` from `.gitignore`, Docker-related cleanup in uninstall scripts; 2) Simplified related files removal scripts for Unix and Windows; 3) Minor adjustments in documentation comments.
50 lines
1.5 KiB
Bash
50 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
source ./scripts/Unix/starter.sh
|
|
|
|
report=""
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case "$1" in
|
|
--report|-r)
|
|
if [ "${2-}" = "" ]; then
|
|
echo "Error: --report/-r requires an argument: xml or html" >&2
|
|
exit 1
|
|
fi
|
|
report="$2"
|
|
shift 2
|
|
;;
|
|
--report=*)
|
|
report="${1#*=}"
|
|
shift
|
|
;;
|
|
-r=*)
|
|
report="${1#*=}"
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
echo "Usage: $0 [--report|-r xml|html]" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
case "${report:-}" in
|
|
"")
|
|
docker compose exec app uv run coverage erase
|
|
docker compose exec app uv run coverage run --source='.' --omit='storefront/*,monitoring/*,Dockerfiles/*,*/__init__.py,*/tests/*,*/migrations/*,manage.py,evibes/*' manage.py test
|
|
docker compose exec app uv run coverage report -m
|
|
;;
|
|
xml)
|
|
docker compose exec app uv run coverage xml --omit='storefront/*,monitoring/*,Dockerfiles/*,*/__init__.py,*/tests/*,*/migrations/*,manage.py,evibes/*'
|
|
;;
|
|
html)
|
|
docker compose exec app uv run coverage html --omit='storefront/*,monitoring/*,Dockerfiles/*,*/__init__.py,*/tests/*,*/migrations/*,manage.py,evibes/*'
|
|
;;
|
|
*)
|
|
echo "Invalid report type: $report (expected xml or html)" >&2
|
|
exit 1
|
|
;;
|
|
esac
|