-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.26 KB
/
Copy pathtests.yml
File metadata and controls
80 lines (67 loc) · 2.26 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Unit Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: unit-tests-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE: sam3-tensorrt:infer
jobs:
unit-tests:
runs-on: [self-hosted, linux, gpu] # must match --labels used in config.sh
timeout-minutes: 90
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v4
with:
clean: false
- name: Build docker image
working-directory: docker
run: ./build-trt.bash
- name: Run unit tests in container
env:
MODELS_DIR: /home/jason/Projects/sam3-ws/SAM3-TensorRT/models
TEST_SCRIPT: |
set -uo pipefail
rc=0
if ! ls "$HOME"/models/*.engine >/dev/null 2>&1; then
echo "::error::No .engine files found in the mounted models dir"
exit 1
fi
nvidia-smi || true
echo "::group::C++ build and tests"
( cd "$HOME/sam3trt" \
&& cmake -S . -B build -DSAM3TRT_BUILD_TESTS=ON -DSAM3TRT_BUILD_ROS=OFF \
&& cmake --build build -j"$(nproc)" \
&& ctest --test-dir build --output-on-failure -E Timing ) || rc=1
echo "::endgroup::"
echo "::group::Python tests"
( cd "$HOME" \
&& pip install --user --break-system-packages --no-cache-dir ./sam3trtpy \
&& cd sam3trtpy \
&& python3 -m unittest discover -s tests -v ) || rc=1
echo "::endgroup::"
exit $rc
run: |
U="$(whoami)"
# Same mounts as docker/run-trt.bash, minus the interactive/X11 parts.
docker run --rm \
--gpus all \
--ipc=host \
--user "$(id -u):$(id -g)" \
-e HOME="/home/$U" \
-e TEST_SCRIPT \
-v "$MODELS_DIR:/home/$U/models" \
-v "$GITHUB_WORKSPACE/sam3trt:/home/$U/sam3trt" \
-v "$GITHUB_WORKSPACE/sam3trtpy:/home/$U/sam3trtpy" \
-w "/home/$U" \
"$IMAGE" \
bash -c "$TEST_SCRIPT"