spiff-arena/bin/run_pyl
jasquat 928273c034
blank-task-list-on-new-pi (#1634)
* return a blank task list if the new instance has not started yet and does not have an associated bpmn process

* fixed minor typo

* use ruff instead of black for formatting w/ burnettk

* upgrade ruff and remove references to black w/ burnettk

* remove unnecessary packages for pre-commit w/ burnettk

* we do not use reorder lib w/ burnettk

* ruff is needed w/ burnettk

---------

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
2024-05-29 16:25:47 -04:00

59 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
function error_handler() {
echo >&2 "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
python_projects=(
spiffworkflow-backend
)
react_projects=(
spiffworkflow-frontend
)
subcommand="${1:-}"
function get_python_dirs() {
(git ls-tree -r HEAD --name-only | grep -E '\.py$' | awk -F '/' '{print $1}' | sort | uniq | grep -v '\.' | grep -Ev '^(bin|migrations)$') || echo ''
}
function run_pre_commmit() {
poetry run pre-commit run --verbose --all-files
}
for react_project in "${react_projects[@]}"; do
# if pre, only do stuff when there are changes
if [[ -n "$(git status --porcelain "$react_project")" ]]; then
pushd "$react_project"
npm run lint:fix
popd
fi
done
if [[ "$subcommand" != "pre" ]] || [[ -n "$(git status --porcelain "spiffworkflow-backend")" ]]; then
# rune_pre_commit only applies to spiffworkflow-backend at the moment
run_pre_commmit || run_pre_commmit
fi
function clear_log_file() {
unit_testing_log_file="./log/unit_testing.log"
if [[ -f "$unit_testing_log_file" ]]; then
>"$unit_testing_log_file"
fi
}
for python_project in "${python_projects[@]}"; do
if [[ "$subcommand" != "pre" ]] || [[ -n "$(git status --porcelain "$python_project")" ]]; then
pushd "$python_project"
poetry install
poetry run mypy $(get_python_dirs)
clear_log_file
./bin/tests-par
popd
fi
done