-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·44 lines (38 loc) · 1.04 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·44 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
MODE="${1:-cpu}"
BUILD_FLAG="${2:-}"
if [[ "$MODE" == "gpu" ]]; then
IMAGE="visual-mic-gpu-dev"
DOCKERFILE="-f Dockerfile.gpu"
RUN_FLAGS="--gpus device=0"
elif [[ "$MODE" == "--build" ]]; then
# Handle ./test.sh --build (no mode, just build flag)
MODE="cpu"
BUILD_FLAG="--build"
IMAGE="visual-mic-dev"
DOCKERFILE=""
RUN_FLAGS=""
else
IMAGE="visual-mic-dev"
DOCKERFILE=""
RUN_FLAGS=""
fi
# Build image if it doesn't exist or --build flag passed
if [[ "$BUILD_FLAG" == "--build" ]] || ! docker image inspect ${IMAGE} &>/dev/null; then
echo "Building test image (${MODE})..."
docker build \
--build-arg UID="$(id -u)" \
--build-arg GID="$(id -g)" \
--build-arg UNAME="$(whoami)" \
${DOCKERFILE} \
-t ${IMAGE} .
echo ""
fi
echo "=== Lint ==="
docker run --rm --entrypoint "" ${IMAGE} ruff check .
echo ""
echo "=== Tests ==="
docker run --rm ${RUN_FLAGS} --entrypoint "" ${IMAGE} python -m pytest tests/ -v
echo ""
echo "All checks passed."