-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into workflow/update-protos
- Loading branch information
Showing
100 changed files
with
1,906 additions
and
1,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
image-prefix: | ||
description: "gets suffixed with 'base' and 'sdk' to create actual image name" | ||
default: ghcr.io/viamrobotics/cpp- | ||
dockerfile: | ||
default: Dockerfile.debian.bullseye | ||
tag: | ||
default: bullseye-amd64 | ||
build-base: | ||
description: "whether to build the base image. the base images change less often and may not be necessary to rebuild." | ||
type: boolean | ||
default: false | ||
build-sdk: | ||
description: "whether to build the SDK image. if this is true and no corresponding base image exists, the job will fail." | ||
type: boolean | ||
default: false | ||
push: | ||
description: "whether to push the images after building them" | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
build-container: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# build base (if inputs.build-base) | ||
- uses: docker/metadata-action@v5 | ||
id: base-meta | ||
if: inputs.build-base | ||
with: | ||
images: ${{ inputs.image-prefix }}base | ||
- uses: docker/build-push-action@v5 | ||
if: inputs.build-base | ||
with: | ||
push: ${{ inputs.push }} | ||
tags: "${{ inputs.image-prefix }}base:${{ inputs.tag }}" | ||
file: etc/docker/base-images/${{ inputs.dockerfile }} | ||
labels: ${{ steps.base-meta.output.labels }} | ||
|
||
# build sdk (if inputs.build-sdk) | ||
- uses: docker/metadata-action@v5 | ||
id: sdk-meta | ||
if: inputs.build-sdk | ||
with: | ||
images: ${{ inputs.image-prefix }}sdk | ||
- uses: docker/build-push-action@v5 | ||
if: inputs.build-sdk | ||
with: | ||
build-args: | | ||
BASE_TAG=${{ inputs.image-prefix }}base:${{ inputs.tag }} | ||
push: ${{ inputs.push }} | ||
tags: "${{ inputs.image-prefix }}sdk:${{ inputs.tag }}" | ||
file: etc/docker/Dockerfile.sdk-build | ||
labels: ${{ steps.sdk-meta.output.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/// @file common/proto_utils.hpp | ||
/// | ||
/// @brief Utils that require generated proto includes. These should be #included | ||
/// in cpp implementation files, but not in wrapper headers consumed by third party code. | ||
#pragma once | ||
|
||
#include <viam/api/common/v1/common.pb.h> | ||
|
||
namespace viam { | ||
namespace sdk { | ||
namespace impl { | ||
|
||
/// @brief Copies elements from a protobuf repeated pointer array into a std::vector. Src type | ||
/// must have a `to_proto` method. | ||
template <typename Src, typename Dst> | ||
void vecToRepeatedPtr(const std::vector<Src>& vec, google::protobuf::RepeatedPtrField<Dst>& dest) { | ||
dest.Clear(); | ||
dest.Reserve(vec.size()); | ||
for (auto& x : vec) { | ||
*dest.Add() = x.to_proto(); | ||
} | ||
} | ||
|
||
/// @brief Non-member to_proto() version. (necessary for moving generated types out of wrapper | ||
/// headers). Takes explicit `to_proto`. | ||
template <typename Src, typename Dst> | ||
void vecToRepeatedPtr(const std::vector<Src>& vec, | ||
google::protobuf::RepeatedPtrField<Dst>& dest, | ||
Dst to_proto(const Src&)) { | ||
dest.Clear(); | ||
dest.Reserve(vec.size()); | ||
for (auto& x : vec) { | ||
*dest.Add() = to_proto(x); | ||
} | ||
} | ||
|
||
/// @brief Copies elements from a std::vector into a protobuf repeated pointer array. Dst type | ||
/// must have a `from_proto` static method. | ||
template <typename Src, typename Dst> | ||
void repeatedPtrToVec(const google::protobuf::RepeatedPtrField<Src>& src, std::vector<Dst>& vec) { | ||
vec.clear(); | ||
vec.reserve(src.size()); | ||
for (auto& x : src) { | ||
vec.push_back(Dst::from_proto(x)); | ||
} | ||
} | ||
|
||
/// @brief Non-member from_proto() version. (necessary for moving generated types out of wrapper | ||
/// headers). Takes explicit `from_proto`. | ||
template <typename Src, typename Dst> | ||
void repeatedPtrToVec(const google::protobuf::RepeatedPtrField<Src>& src, | ||
std::vector<Dst>& vec, | ||
Dst from_proto(const Src&)) { | ||
vec.clear(); | ||
vec.reserve(src.size()); | ||
for (auto& x : src) { | ||
vec.push_back(from_proto(x)); | ||
} | ||
} | ||
|
||
} // namespace impl | ||
} // namespace sdk | ||
} // namespace viam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.