34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
CHECK_ONLY=0
|
|
if [[ "${1:-}" == --check ]]; then
|
|
CHECK_ONLY=1
|
|
shift
|
|
fi
|
|
if [[ $# -ne 1 || ! "$1" =~ ^[0-9]{3}$ ]]; then
|
|
echo 'Usage: scripts/testtask.sh [--check] TASK_ID (three digits)' >&2
|
|
exit 2
|
|
fi
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
command -v python3 >/dev/null 2>&1 || {
|
|
echo 'testtask: Python 3 is required for source routing and snapshot verification.' >&2
|
|
exit 127
|
|
}
|
|
TASK_SOURCE="$(python3 "$SCRIPT_DIR/testtask_source.py" "$SCRIPT_DIR/.." "$1")"
|
|
printf 'testtask: TASK-%s source: %s\n' "$1" "$TASK_SOURCE"
|
|
source "$SCRIPT_DIR/testtask-node.sh"
|
|
if ! command -v roborto-testtask >/dev/null 2>&1; then
|
|
echo 'testtask: standalone roborto-testtask CLI is missing; install/configure it before running.' >&2
|
|
exit 127
|
|
fi
|
|
cd -- "$TASK_SOURCE"
|
|
if (( CHECK_ONLY )); then
|
|
export ROBORTO_PROJECT_ROOT="$TASK_SOURCE" ROBORTO_TASK_ID="$1"
|
|
source .roborto/testtask.conf
|
|
export ROBORTO_WORKTREE
|
|
"$ROBORTO_HOOK" validate
|
|
printf 'testtask: preflight passed (%s); no runner or browser started.\n' "$(node --version)"
|
|
exit 0
|
|
fi
|
|
exec roborto-testtask "$1"
|