first commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
if [ -z "${PYTHON_BIN:-}" ]; then
|
||||
if [ -x "$REPO_ROOT/.venv/bin/python" ]; then
|
||||
PYTHON_BIN="$REPO_ROOT/.venv/bin/python"
|
||||
else
|
||||
PYTHON_BIN="python3"
|
||||
fi
|
||||
fi
|
||||
|
||||
section() {
|
||||
printf '\n==> %s\n' "$1"
|
||||
}
|
||||
|
||||
run_python_unittest() {
|
||||
local name="$1"
|
||||
local start_dir="$2"
|
||||
shift 2
|
||||
local test_files=()
|
||||
local python_path="$REPO_ROOT:$REPO_ROOT/$start_dir"
|
||||
local path_entry
|
||||
|
||||
section "$name"
|
||||
|
||||
while IFS= read -r test_file; do
|
||||
test_files+=("$test_file")
|
||||
done < <(find "$REPO_ROOT/$start_dir" -name 'test*.py' -print | sort)
|
||||
|
||||
if [ "${#test_files[@]}" -eq 0 ]; then
|
||||
echo "No Python tests found under $start_dir"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for path_entry in "$@"; do
|
||||
if [[ "$path_entry" = /* ]]; then
|
||||
python_path="$python_path:$path_entry"
|
||||
else
|
||||
python_path="$python_path:$REPO_ROOT/$path_entry"
|
||||
fi
|
||||
done
|
||||
|
||||
PYTHONPATH="$python_path${PYTHONPATH:+:$PYTHONPATH}" \
|
||||
"$PYTHON_BIN" -m unittest "${test_files[@]}"
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=scripts/test/common.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
section "Documentation checks"
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git lfs version >/dev/null 2>&1; then
|
||||
if git lfs ls-files --name-only | grep -q '^docs/public/hero/'; then
|
||||
git lfs pull --include="docs/public/hero/**" --exclude=""
|
||||
fi
|
||||
fi
|
||||
npm --prefix docs run check
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=scripts/test/common.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
run_python_unittest "Global policy tests" "tests/python/global"
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=scripts/test/common.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
section "cadjs tests"
|
||||
npm --prefix packages/cadjs test
|
||||
|
||||
section "implicitjs tests"
|
||||
npm --prefix packages/implicitjs test
|
||||
|
||||
section "CAD Viewer tests"
|
||||
npm --prefix viewer run test
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck source=scripts/test/common.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh"
|
||||
|
||||
LIST_SKILLS_SCRIPT="$REPO_ROOT/scripts/utils/list-skills.sh"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
run_python_unittest "cadpy package Python tests" "tests/python/packages/cadpy" "packages/cadpy/src"
|
||||
run_python_unittest "cadpy_metadata package Python tests" "tests/python/packages/cadpy_metadata" "packages/cadpy_metadata/src"
|
||||
|
||||
while IFS= read -r skill; do
|
||||
test_dir="tests/python/skills/$skill"
|
||||
if [ -d "$test_dir" ]; then
|
||||
skill_paths=("skills/$skill/scripts")
|
||||
if [ "$skill" = "cad" ] || [ "$skill" = "dxf" ]; then
|
||||
skill_paths+=("skills/$skill/scripts/packages/cadpy/src")
|
||||
fi
|
||||
run_python_unittest "$skill skill Python tests" "$test_dir" "${skill_paths[@]}"
|
||||
fi
|
||||
done < <("$LIST_SKILLS_SCRIPT")
|
||||
|
||||
run_python_unittest "MoveIt2 server Python tests" "tests/python/viewer/moveit2_server" "viewer/moveit2_server"
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
"$SCRIPT_DIR/test-js.sh"
|
||||
"$SCRIPT_DIR/test-python.sh"
|
||||
"$SCRIPT_DIR/test-global.sh"
|
||||
Reference in New Issue
Block a user