mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-06 08:43:36 +02:00
Overhaul script handling. Closes #125.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# developer perogative ;D
|
||||
if command -v enablenvm >/dev/null 2>&1; then
|
||||
enablenvm >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
|
||||
echo -e "${YELLOW}=== RemoteTerm Quality Checks ===${NC}"
|
||||
echo
|
||||
|
||||
# --- Phase 1: Lint & Format ---
|
||||
|
||||
echo -e "${YELLOW}=== Phase 1: Lint & Format ===${NC}"
|
||||
|
||||
echo -e "${BLUE}[backend lint]${NC} Running ruff check + format..."
|
||||
cd "$REPO_ROOT"
|
||||
uv run ruff check app/ tests/ --fix
|
||||
uv run ruff format app/ tests/
|
||||
echo -e "${GREEN}[backend lint]${NC} Passed!"
|
||||
|
||||
echo -e "${BLUE}[frontend lint]${NC} Running eslint + prettier..."
|
||||
cd "$REPO_ROOT/frontend"
|
||||
npm run lint:fix
|
||||
npm run format
|
||||
echo -e "${GREEN}[frontend lint]${NC} Passed!"
|
||||
|
||||
echo -e "${GREEN}=== Phase 1 complete ===${NC}"
|
||||
echo
|
||||
|
||||
# --- Phase 2: Typecheck, Tests & Build ---
|
||||
|
||||
echo -e "${YELLOW}=== Phase 2: Typecheck, Tests & Build ===${NC}"
|
||||
|
||||
echo -e "${BLUE}[pyright]${NC} Running type check..."
|
||||
cd "$REPO_ROOT"
|
||||
uv run pyright app/
|
||||
echo -e "${GREEN}[pyright]${NC} Passed!"
|
||||
|
||||
echo -e "${BLUE}[pytest]${NC} Running backend tests..."
|
||||
cd "$REPO_ROOT"
|
||||
PYTHONPATH=. uv run pytest tests/ -v
|
||||
echo -e "${GREEN}[pytest]${NC} Passed!"
|
||||
|
||||
echo -e "${BLUE}[frontend]${NC} Running tests + build..."
|
||||
cd "$REPO_ROOT/frontend"
|
||||
npm run test:run
|
||||
npm run build
|
||||
echo -e "${GREEN}[frontend]${NC} Passed!"
|
||||
|
||||
echo -e "${GREEN}=== Phase 2 complete ===${NC}"
|
||||
echo
|
||||
|
||||
echo -e "${GREEN}=== All quality checks passed! ===${NC}"
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
|
||||
NODE_VERSIONS=("20" "22" "24")
|
||||
# Use explicit npm patch versions so resolver regressions are caught.
|
||||
NPM_VERSIONS=("9.1.1" "9.9.4" "10.9.5" "11.6.2")
|
||||
EXTRA_CASES=(
|
||||
"18|9.1.1"
|
||||
"20|8.19.4"
|
||||
"18|8.19.4"
|
||||
"24|11.12.0"
|
||||
"25|11.6.2"
|
||||
"25|11.12.0"
|
||||
)
|
||||
|
||||
run_combo() {
|
||||
local node_version="$1"
|
||||
local npm_version="$2"
|
||||
local image="node:${node_version}-slim"
|
||||
|
||||
docker run --rm \
|
||||
-v "$REPO_ROOT:/src:ro" \
|
||||
-w /tmp \
|
||||
"$image" \
|
||||
bash -lc "
|
||||
set -euo pipefail
|
||||
cp -a /src/frontend ./frontend
|
||||
cd frontend
|
||||
npm i -g npm@${npm_version}
|
||||
echo 'Using Node:' \$(node -v)
|
||||
echo 'Using npm:' \$(npm -v)
|
||||
npm ci
|
||||
npm run build
|
||||
"
|
||||
}
|
||||
|
||||
declare -a TEST_CASES=()
|
||||
declare -A SEEN_CASES=()
|
||||
|
||||
add_case() {
|
||||
local node_version="$1"
|
||||
local npm_version="$2"
|
||||
local key="${node_version}|${npm_version}"
|
||||
if [[ -n "${SEEN_CASES[$key]:-}" ]]; then
|
||||
return
|
||||
fi
|
||||
SEEN_CASES["$key"]=1
|
||||
TEST_CASES+=("$key")
|
||||
}
|
||||
|
||||
for node_version in "${NODE_VERSIONS[@]}"; do
|
||||
for npm_version in "${NPM_VERSIONS[@]}"; do
|
||||
add_case "$node_version" "$npm_version"
|
||||
done
|
||||
done
|
||||
|
||||
for case_spec in "${EXTRA_CASES[@]}"; do
|
||||
IFS='|' read -r node_version npm_version <<<"$case_spec"
|
||||
add_case "$node_version" "$npm_version"
|
||||
done
|
||||
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
declare -a JOB_PIDS=()
|
||||
declare -a JOB_LABELS=()
|
||||
declare -a JOB_LOGS=()
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
echo -e "${YELLOW}=== Frontend Docker CI Matrix ===${NC}"
|
||||
echo -e "${BLUE}Repo:${NC} $REPO_ROOT"
|
||||
echo
|
||||
|
||||
for case_spec in "${TEST_CASES[@]}"; do
|
||||
IFS='|' read -r node_version npm_version <<<"$case_spec"
|
||||
label="Node ${node_version} / npm ${npm_version}"
|
||||
safe_npm="${npm_version//./-}"
|
||||
log_file="$TMP_DIR/node-${node_version}-npm-${safe_npm}.log"
|
||||
|
||||
echo -e "${BLUE}Starting:${NC} ${label}"
|
||||
(
|
||||
echo -e "${YELLOW}=== ${label} ===${NC}"
|
||||
run_combo "$node_version" "$npm_version"
|
||||
) >"$log_file" 2>&1 &
|
||||
|
||||
JOB_PIDS+=("$!")
|
||||
JOB_LABELS+=("$label")
|
||||
JOB_LOGS+=("$log_file")
|
||||
done
|
||||
|
||||
echo
|
||||
|
||||
failures=0
|
||||
for idx in "${!JOB_PIDS[@]}"; do
|
||||
if wait "${JOB_PIDS[$idx]}"; then
|
||||
echo -e "${GREEN}Passed:${NC} ${JOB_LABELS[$idx]}"
|
||||
else
|
||||
failures=$((failures + 1))
|
||||
echo -e "${RED}Failed:${NC} ${JOB_LABELS[$idx]}"
|
||||
echo -e "${YELLOW}--- ${JOB_LABELS[$idx]} log ---${NC}"
|
||||
cat "${JOB_LOGS[$idx]}"
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
if (( failures > 0 )); then
|
||||
echo -e "${RED}=== Docker CI matrix failed (${failures} job(s)) ===${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}=== Docker CI matrix passed ===${NC}"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
|
||||
echo "Starting E2E tests..."
|
||||
cd "$REPO_ROOT/tests/e2e"
|
||||
npx playwright test "$@"
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
YELLOW='\033[1;33m'
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
|
||||
echo -e "${YELLOW}=== Extended Quality Checks ===${NC}"
|
||||
echo
|
||||
|
||||
echo -e "${BLUE}[all_quality]${NC} Running full lint, typecheck, unit tests, and the standard frontend build..."
|
||||
"$REPO_ROOT/scripts/quality/all_quality.sh"
|
||||
echo -e "${GREEN}[all_quality]${NC} Passed!"
|
||||
echo
|
||||
|
||||
echo -e "${BLUE}[e2e]${NC} Running end-to-end tests..."
|
||||
"$REPO_ROOT/scripts/quality/e2e.sh" "$@"
|
||||
echo -e "${GREEN}[e2e]${NC} Passed!"
|
||||
echo
|
||||
|
||||
echo -e "${BLUE}[docker_ci]${NC} Running Docker frontend install/build matrix..."
|
||||
"$REPO_ROOT/scripts/quality/docker_ci.sh"
|
||||
echo -e "${GREEN}[docker_ci]${NC} Passed!"
|
||||
echo
|
||||
|
||||
echo -e "${GREEN}=== Extended quality checks passed! ===${NC}"
|
||||
Reference in New Issue
Block a user