mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-12 10:34:17 +00:00
1826cc4b6c
* updated to use new spiff branch and fixed broken tests w/ burnettk essweine * updated spiffworkflow with new main build w/ burnettk essweine * initial updates to new spiff branch w/ burnettk essweine * more updates for new spiff w/ burnettk essweine * fixed some linting issues w/ burnettk essweine * fixed some failing tests w/ burnettk * updated spiffworkflow for cancel fix w/ burnettk * Improvement/flexible task iteration 2 (#504) * wip * consistent failure, mostly * removing test code and tests * removing unused test bpmn files * removing unused test bpmn files * minor cleanup of commented code * spaces and unused imports * go back to spiff on main --------- Co-authored-by: burnettk <burnettk@users.noreply.github.com> * lint * updated test to reflect storing predicted tasks w/ burnettk * add some orders so postgres does not do whatever it wants, and clear log * fix lint --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com> Co-authored-by: danfunk <daniel.h.funk@gmail.com> Co-authored-by: burnettk <burnettk@users.noreply.github.com>
90 lines
2.4 KiB
Bash
Executable File
90 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
function error_handler() {
|
|
>&2 echo "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:-}"
|
|
|
|
if [[ "$subcommand" == "pre" ]]; then
|
|
if [[ -n "$(git status --porcelain SpiffWorkflow)" ]]; then
|
|
echo "SpiffWorkflow has uncommitted changes. Running its test suite."
|
|
pushd SpiffWorkflow
|
|
make tests-par # run tests in parallel
|
|
popd
|
|
fi
|
|
fi
|
|
|
|
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_autofixers() {
|
|
# checking command -v ruff is not good enough, since the asdf shim may be installed, which will make command -v succeed,
|
|
# but ruff may not have been pip installed inside the correct version of python.
|
|
if ! ruff --help >/dev/null 2>&1; then
|
|
pip install ruff
|
|
asdf reshim python
|
|
fi
|
|
|
|
python_dirs="$(get_python_dirs) bin"
|
|
# shellcheck disable=2086
|
|
ruff --fix $python_dirs || 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
|
|
|
|
for python_project in "${python_projects[@]}" ; do
|
|
# if pre, only do stuff when there are changes
|
|
if [[ "$subcommand" != "pre" ]] || [[ -n "$(git status --porcelain "$python_project")" ]]; then
|
|
pushd "$python_project"
|
|
run_autofixers || run_autofixers
|
|
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
|