Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add podman playwright #308

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion scripts/playwright-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,34 @@ IMAGE_TAG="v1.45.3-jammy" # This version have to be synchronized with playwright

NODE_MODULES_CACHE_DIR="$HOME/.cache/navigation-playwright-docker-node-modules"

command_exists() {
command -v "$1" >/dev/null 2>&1
}

run_command() {
docker run --rm --network host -it -w /work \
$CONTAINER_TOOL run --rm --network host -it -w /work \
-v $(pwd):/work \
-v "$NODE_MODULES_CACHE_DIR:/work/node_modules" \
"$IMAGE_NAME:$IMAGE_TAG" \
/bin/bash -c "$1"
}

if command_exists docker; then
CONTAINER_TOOL="docker"
elif command_exists podman; then
CONTAINER_TOOL="podman"
else
echo "Neither Docker nor Podman is installed on the system."
exit 1
fi

if [[ "$1" = "clear-cache" ]]; then
rm -rf "$NODE_MODULES_CACHE_DIR"
exit 0
fi

if [[ ! -d "$NODE_MODULES_CACHE_DIR" ]]; then
mkdir -p "$NODE_MODULES_CACHE_DIR"
run_command 'npm ci'
fi

Expand Down
Loading