Skip to content

Commit 615d143

Browse files
committed
implement test in terms of new sdk build
1 parent 693d7f2 commit 615d143

File tree

4 files changed

+29
-69
lines changed

4 files changed

+29
-69
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,15 @@ jobs:
2222
###########################################
2323
- name: build-docker-test
2424
run: |
25-
docker build -t cpp . -f etc/docker/tests/Dockerfile.debian.bullseye
26-
docker run -e BUILD_SHARED=${{ matrix.BUILD_SHARED }} --rm -i -w /tmp cpp /bin/bash
25+
docker build -t cpp . -f etc/docker/base-images/Dockerfile.debian.bullseye
26+
docker build -t cpp-test . -f etc/docker/Dockerfile.sdk-build \
27+
--build-arg BASE_TAG=cpp \
28+
--build-arg REPO_SETUP=copy \
29+
--build-arg BUILD_SHARED=${{ matrix.BUILD_SHARED }} \
30+
--build-arg BUILD_TESTS=ON \
31+
--build-arg BUILD_EXAMPLES=ON \
32+
--build-arg EXTRA_CMAKE_ARGS=\
33+
"-DVIAMCPPSDK_CLANG_TIDY=ON \
34+
-DVIAMCPPSDK_SANITIZED_BUILD=${{ matrix.BUILD_SHARED }}"
35+
36+
docker run -w /viam-cpp-sdk/build -t --entrypoint /viam-cpp-sdk/etc/docker/tests/run_test.sh cpp-test /bin/bash

etc/docker/Dockerfile.sdk-build

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@
44
# docker build --build-arg BASE_TAG=base/bullseye --build-arg GIT_TAG=[...] etc/docker/Dockerfile.sdk-build .
55
# You can substitute the bullseye image for whichever you want to use as a base.
66
# Note that it is necessary to tag the base image with `-t` and then refer to it using the `BASE_TAG` arg.
7+
8+
ARG REPO_SETUP=git
9+
710
ARG BASE_TAG
8-
FROM ${BASE_TAG} AS build-sdk
9-
ENV DEBIAN_FRONTEND=noninteractive
1011

12+
FROM ${BASE_TAG} AS repo_setup_git
1113
ARG GIT_TAG
14+
ONBUILD RUN echo "Checking if GIT_TAG is set" && test -n "${GIT_TAG}"
15+
ONBUILD RUN git clone https://github.com/viamrobotics/viam-cpp-sdk/ -b ${GIT_TAG}
16+
17+
FROM ${BASE_TAG} AS repo_setup_copy
18+
ONBUILD COPY . /viam-cpp-sdk/
19+
20+
FROM repo_setup_${REPO_SETUP}
21+
ENV DEBIAN_FRONTEND=noninteractive
22+
1223
ARG BUILD_TYPE=RelWithDebInfo
1324
ARG BUILD_SHARED=ON
1425
ARG BUILD_TESTS=OFF
1526
ARG BUILD_EXAMPLES=OFF
16-
17-
RUN git clone https://github.com/viamrobotics/viam-cpp-sdk/ -b ${GIT_TAG}
27+
ARG EXTRA_CMAKE_ARGS
1828

1929
WORKDIR /viam-cpp-sdk
2030

@@ -25,7 +35,8 @@ RUN mkdir build && \
2535
-DBUILD_SHARED_LIBS=${BUILD_SHARED} \
2636
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
2737
-DVIAMCPPSDK_BUILD_TESTS=${BUILD_TESTS} \
28-
-DVIAMCPPSDK_BUILD_EXAMPLES=${BUILD_EXAMPLES}
38+
-DVIAMCPPSDK_BUILD_EXAMPLES=${BUILD_EXAMPLES} \
39+
${EXTRA_CMAKE_ARGS}
2940

3041
RUN cmake --build build --target install && \
3142
cmake --install build

etc/docker/tests/Dockerfile.debian.bullseye

Lines changed: 0 additions & 51 deletions
This file was deleted.

etc/docker/tests/run_test.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
mkdir build
5-
cd build
6-
cmake .. -G Ninja -DVIAMCPPSDK_USE_DYNAMIC_PROTOS=ON \
7-
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
8-
-DVIAMCPPSDK_SANITIZED_BUILD=$BUILD_SHARED \
9-
-DVIAMCPPSDK_CLANG_TIDY=ON \
10-
-DBUILD_SHARED_LIBS=$BUILD_SHARED
11-
12-
ninja all
13-
ninja install
14-
INSTALL_DIR="$(pwd)/install"
4+
BUILD_SHARED=$(grep 'BUILD_SHARED_LIBS' CMakeCache.txt | cut -d '=' -f 2)
155

166
pushd src/viam/sdk/tests
177
UBSAN_OPTIONS="print_stacktrace=1" ctest --output-on-failure

0 commit comments

Comments
 (0)