Skip to content

Commit d672f39

Browse files
authored
Merge branch 'main' into workflow/update-protos
2 parents 3b03426 + e331f2c commit d672f39

File tree

100 files changed

+1906
-1142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1906
-1142
lines changed

.github/workflows/docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
image-prefix:
5+
description: "gets suffixed with 'base' and 'sdk' to create actual image name"
6+
default: ghcr.io/viamrobotics/cpp-
7+
dockerfile:
8+
default: Dockerfile.debian.bullseye
9+
tag:
10+
default: bullseye-amd64
11+
build-base:
12+
description: "whether to build the base image. the base images change less often and may not be necessary to rebuild."
13+
type: boolean
14+
default: false
15+
build-sdk:
16+
description: "whether to build the SDK image. if this is true and no corresponding base image exists, the job will fail."
17+
type: boolean
18+
default: false
19+
push:
20+
description: "whether to push the images after building them"
21+
type: boolean
22+
default: false
23+
24+
jobs:
25+
build-container:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: docker/login-action@v3
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
# build base (if inputs.build-base)
40+
- uses: docker/metadata-action@v5
41+
id: base-meta
42+
if: inputs.build-base
43+
with:
44+
images: ${{ inputs.image-prefix }}base
45+
- uses: docker/build-push-action@v5
46+
if: inputs.build-base
47+
with:
48+
push: ${{ inputs.push }}
49+
tags: "${{ inputs.image-prefix }}base:${{ inputs.tag }}"
50+
file: etc/docker/base-images/${{ inputs.dockerfile }}
51+
labels: ${{ steps.base-meta.output.labels }}
52+
53+
# build sdk (if inputs.build-sdk)
54+
- uses: docker/metadata-action@v5
55+
id: sdk-meta
56+
if: inputs.build-sdk
57+
with:
58+
images: ${{ inputs.image-prefix }}sdk
59+
- uses: docker/build-push-action@v5
60+
if: inputs.build-sdk
61+
with:
62+
build-args: |
63+
BASE_TAG=${{ inputs.image-prefix }}base:${{ inputs.tag }}
64+
push: ${{ inputs.push }}
65+
tags: "${{ inputs.image-prefix }}sdk:${{ inputs.tag }}"
66+
file: etc/docker/Dockerfile.sdk-build
67+
labels: ${{ steps.sdk-meta.output.labels }}

.github/workflows/linter.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
name: cpp-linter
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
workflow_dispatch:
46

57
jobs:
68
cpp-linter:
79
if: github.repository_owner == 'viamrobotics'
810
runs-on: ubuntu-latest
9-
container:
10-
image: ghcr.io/viamrobotics/canon:amd64
11+
container: ghcr.io/viamrobotics/cpp-base:bullseye-amd64
1112
steps:
1213
- name: Checkout Code
1314
uses: actions/checkout@v4
1415
with:
1516
fetch-depth: 0
16-
- name: install clang-format
17-
run: sudo apt install -y clang-format
1817
- name: verify no uncommitted changes
1918
run: |
19+
chown $(whoami) .
2020
git init
2121
git add .
22-
chown -R testbot .
23-
sudo -u testbot bash -lc 'sh ./bin/run-clang-format.sh'
22+
./bin/run-clang-format.sh
2423
GEN_DIFF=$(git status -s)
2524
2625
if [ -n "$GEN_DIFF" ]; then

.github/workflows/test.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,38 @@ name: Test
33
on:
44
pull_request:
55
workflow_dispatch:
6+
inputs:
7+
no-tidy:
8+
type: boolean
9+
description: set to true to build without clang-tidy (2x faster)
610

711
jobs:
812
run-tests:
913
if: github.repository_owner == 'viamrobotics'
1014
runs-on: ubuntu-latest
11-
container:
12-
image: ghcr.io/viamrobotics/canon:amd64
15+
container: ghcr.io/viamrobotics/cpp-base:bullseye-amd64
1316
strategy:
1417
matrix:
1518
include:
1619
- BUILD_SHARED: ON
1720
- BUILD_SHARED: OFF
1821
steps:
1922
- uses: actions/checkout@v4
20-
###########################################
21-
# necessary installs for building #
22-
###########################################
23-
- name: build-docker-test
23+
- name: cmake
2424
run: |
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
25+
mkdir build
26+
cd build
27+
cmake .. -G Ninja \
28+
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED }} \
29+
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
30+
-DVIAMCPPSDK_BUILD_TESTS=ON \
31+
-DVIAMCPPSDK_BUILD_EXAMPLES=ON \
32+
-DVIAMCPPSDK_CLANG_TIDY=${{ inputs.no-tidy && 'OFF' || 'ON' }} \
33+
-DVIAMCPPSDK_SANITIZED_BUILD=${{ matrix.BUILD_SHARED }}
34+
- name: build
35+
run: |
36+
cmake --build build --target install
37+
cmake --install build
38+
- name: test
39+
working-directory: build
40+
run: ../etc/docker/tests/run_test.sh

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# constrained by the version of CMake available on target systems.
3535
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
3636

37-
set(CMAKE_PROJECT_VERSION 0.0.15)
37+
set(CMAKE_PROJECT_VERSION 0.0.16)
3838

3939
# Identify the project.
4040
project(viam-cpp-sdk

etc/docker/base-images/Dockerfile.debian.bookworm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ RUN apt-get update
4141

4242
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-bookworm-15 \
4343
clang-15 \
44-
clang-tidy-15
44+
clang-tidy-15 \
45+
clang-format

etc/docker/base-images/Dockerfile.debian.bullseye

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM debian:bullseye
22

3-
ENV HOME /root
3+
ENV HOME=/root
44
ARG DEBIAN_FRONTEND=noninteractive
55

66
RUN apt-get update
@@ -39,7 +39,8 @@ RUN apt-get update
3939

4040
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-bullseye-15 \
4141
clang-15 \
42-
clang-tidy-15
42+
clang-tidy-15 \
43+
clang-format
4344

4445
RUN apt-get -y --no-install-recommends install -t bullseye-backports \
4546
cmake

etc/docker/base-images/Dockerfile.debian.sid

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ RUN apt-get update
4141

4242
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-15 \
4343
clang-15 \
44-
clang-tidy-15
44+
clang-tidy-15 \
45+
clang-format

etc/docker/base-images/Dockerfile.ubuntu.focal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ RUN apt-get update
4242

4343
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-focal-15 \
4444
clang-15 \
45-
clang-tidy-15
45+
clang-tidy-15 \
46+
clang-format
4647

4748
RUN apt-get -y install cmake
4849

etc/docker/base-images/Dockerfile.ubuntu.jammy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN apt-get update
4242

4343
RUN apt-get -y --no-install-recommends install -t llvm-toolchain-jammy-15 \
4444
clang-15 \
45-
clang-tidy-15
45+
clang-tidy-15 \
46+
clang-format
4647

4748
RUN apt-get -y install cmake

src/viam/api/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ if (VIAMCPPSDK_USE_DYNAMIC_PROTOS)
225225
${PROTO_GEN_DIR}/service/motion/v1/motion.grpc.pb.h
226226
${PROTO_GEN_DIR}/service/motion/v1/motion.pb.cc
227227
${PROTO_GEN_DIR}/service/motion/v1/motion.pb.h
228+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.grpc.pb.cc
229+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.grpc.pb.h
230+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.pb.cc
231+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.pb.h
228232
${PROTO_GEN_DIR}/tagger/v1/tagger.grpc.pb.cc
229233
${PROTO_GEN_DIR}/tagger/v1/tagger.grpc.pb.h
230234
${PROTO_GEN_DIR}/tagger/v1/tagger.pb.cc
@@ -328,6 +332,8 @@ target_sources(viamapi
328332
${PROTO_GEN_DIR}/service/mlmodel/v1/mlmodel.pb.cc
329333
${PROTO_GEN_DIR}/service/motion/v1/motion.grpc.pb.cc
330334
${PROTO_GEN_DIR}/service/motion/v1/motion.pb.cc
335+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.grpc.pb.cc
336+
${PROTO_GEN_DIR}/service/navigation/v1/navigation.pb.cc
331337
${PROTO_GEN_DIR}/tagger/v1/tagger.grpc.pb.cc
332338
${PROTO_GEN_DIR}/tagger/v1/tagger.pb.cc
333339
PUBLIC FILE_SET viamapi_includes TYPE HEADERS
@@ -385,6 +391,8 @@ target_sources(viamapi
385391
${PROTO_GEN_DIR}/../../viam/api/service/mlmodel/v1/mlmodel.pb.h
386392
${PROTO_GEN_DIR}/../../viam/api/service/motion/v1/motion.grpc.pb.h
387393
${PROTO_GEN_DIR}/../../viam/api/service/motion/v1/motion.pb.h
394+
${PROTO_GEN_DIR}/../../viam/api/service/navigation/v1/navigation.grpc.pb.h
395+
${PROTO_GEN_DIR}/../../viam/api/service/navigation/v1/navigation.pb.h
388396
${PROTO_GEN_DIR}/../../viam/api/tagger/v1/tagger.pb.h
389397
)
390398

0 commit comments

Comments
 (0)