python_mozaggregator/bin/run

33 строки
676 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
usage() {
echo "usage: bin/run serve|test|<other-command-in-container>"
exit 1
}
[ $# -lt 1 ] && usage
# Only wait for backend services in development.
# http://stackoverflow.com/a/13864829
[ ! -z ${DEVELOPMENT+check} ] && ./bin/wait-for-it.sh db:${DB_PORT:-5432} --timeout=0 --strict
case $1 in
serve)
exec python mozaggregator/service.py 0.0.0.0:${PORT}
;;
test)
pytest --cov=mozaggregator tests || exit 1
if [[ ! -z ${CI+check} ]]; then
echo "TODO: Set up codecov."
# bash <(curl -s https://codecov.io/bash) -s /tmp
else
coverage report -m
fi
;;
*)
exec "$@"
;;
esac