Skip to content

Commit ed2bca4

Browse files
Merge pull request #8 from NIDAP-Community/test-podman
test: add podman script for running tests on macOS
2 parents 8492cdb + 3aaa6dd commit ed2bca4

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎tests/run-tests-podman.sh‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
# Run the package test suite locally in the same container image used by CI,
3+
# via podman (e.g. on macOS with Podman Desktop / podman machine).
4+
#
5+
# Usage:
6+
# ./tests/run-tests-podman.sh
7+
#
8+
# Mirrors .github/workflows/tests.yml, but runs with podman instead of docker.
9+
set -euo pipefail
10+
11+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12+
cd "$REPO_ROOT"
13+
14+
if ! command -v podman >/dev/null 2>&1; then
15+
echo "Error: podman is not installed or not on PATH. Install it with 'brew install podman'." >&2
16+
exit 1
17+
fi
18+
19+
if ! podman info >/dev/null 2>&1; then
20+
echo "Podman machine is not running. Starting it..." >&2
21+
podman machine start
22+
fi
23+
24+
IMAGE=$(jq -r '.base_image' .codeocean/environment.json)
25+
IMAGE=${IMAGE//codeocean/nciccbr}
26+
echo "Using image: $IMAGE"
27+
28+
podman run --rm \
29+
-v "$REPO_ROOT":/workspace:Z \
30+
-w /workspace \
31+
"$IMAGE" \
32+
Rscript tests/testthat.R

0 commit comments

Comments
 (0)