Skip to content

Commit 9340e59

Browse files
committed
Merge branch 'make-proto-conversions-private' of ssh://github.com/stuqdog/cpp-sdk into make-proto-conversions-private
2 parents 0b428a9 + ff26416 commit 9340e59

File tree

18 files changed

+4652
-2702
lines changed

18 files changed

+4652
-2702
lines changed

.github/workflows/conan.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: Test conan packages
22

33
on:
4-
# Run weekdays at 11:15pm UTC, and specify below to only run if there's been new commits
4+
# Runs for PRs that directly change conan code, and weekdays at 11:15pm UTC.
5+
# Additional logic in the prepare job below makes it so scheduled builds only run
6+
# on new commits.
57
schedule:
68
- cron: "15 11 * * 1-5"
79
workflow_dispatch:
10+
pull_request:
11+
paths:
12+
- conanfile.py
13+
- test_package/conanfile.py
814

915
jobs:
1016
prepare:
@@ -13,17 +19,25 @@ jobs:
1319
steps:
1420
- name: Checkout Code
1521
uses: actions/checkout@v4
16-
17-
- name: Get new commit count
18-
id: new_commit_count
19-
shell: bash
20-
run: echo "commit_count=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_OUTPUT
21-
22-
- name: Cancelling scheduled build with no new commits
22+
- name: Get current git info
23+
if: github.event_name == 'schedule'
24+
id: git_info
25+
run: |
26+
echo "current_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
27+
echo "current_branch=$(git branch --show-current)" >> $GITHUB_OUTPUT
28+
- name: Get last successful commit
29+
if: github.event_name == 'schedule'
30+
id: last_successful_commit
31+
uses: tylermilner/last-successful-commit-hash-action@v1
32+
with:
33+
branch: main
34+
workflow-id: conan.yml
35+
github-token: ${{ github.token }}
36+
- name: Cancel scheduled build with no new commits
2337
uses: andymckay/[email protected]
2438
if: |
25-
steps.new_commit_count.outputs.commit_count == '0' &&
26-
github.event_name == 'schedule'
39+
github.event_name == 'schedule' &&
40+
steps.git_info.outputs.current_commit == steps.last_successful_commit.outputs.commit-hash
2741
2842
build_macos:
2943
if: github.repository_owner == 'viamrobotics'

.github/workflows/docker.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
# build base (if inputs.build-base)
34+
- uses: docker/metadata-action@v5
35+
id: base-meta
36+
if: inputs.build-base
37+
with:
38+
images: ${{ inputs.image-prefix }}base
39+
- uses: docker/build-push-action@v5
40+
if: inputs.build-base
41+
with:
42+
push: ${{ inputs.push }}
43+
tags: "${{ inputs.image-prefix }}base:${{ inputs.tag }}"
44+
file: etc/docker/base-images/${{ inputs.dockerfile }}
45+
labels: ${{ steps.base-meta.output.labels }}
46+
47+
# build sdk (if inputs.build-sdk)
48+
- uses: docker/metadata-action@v5
49+
id: sdk-meta
50+
if: inputs.build-sdk
51+
with:
52+
images: ${{ inputs.image-prefix }}sdk
53+
- uses: docker/build-push-action@v5
54+
if: inputs.build-sdk
55+
with:
56+
build-args: |
57+
BASE_TAG=${{ inputs.image-prefix }}base:${{ inputs.tag }}
58+
push: ${{ inputs.push }}
59+
tags: "${{ inputs.image-prefix }}sdk:${{ inputs.tag }}"
60+
file: etc/docker/Dockerfile.sdk-build
61+
labels: ${{ steps.sdk-meta.output.labels }}

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.14)
37+
set(CMAKE_PROJECT_VERSION 0.0.15)
3838

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

conanfile.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ def set_version(self):
3232
self.version = re.search("set\(CMAKE_PROJECT_VERSION (.+)\)", content).group(1).strip()
3333

3434
def configure(self):
35-
# If we're building static then build the world as static, otherwise
36-
# stuff will probably break.
37-
# If you want your shared build to also build the world as shared, you
38-
# can invoke conan with -o "&:shared=False" -o "*:shared=False",
39-
# possibly with --build=missing or --build=cascade as desired,
40-
# but this is probably not necessary.
41-
if not self.options.shared:
42-
self.options["*"].shared = False
35+
if self.options.shared:
36+
# See https://github.com/conan-io/conan-center-index/issues/25107
37+
self.options["grpc"].secure = True
38+
39+
# From some experiments it seems that the shared-ness of these packages
40+
# should match that of the SDK recipe. Failure to do so can cause linker
41+
# errors while compiling, or static initialization errors at runtime for modules.
42+
for lib in ["grpc", "protobuf", "abseil"]:
43+
self.options[lib].shared = True
4344

4445
def requirements(self):
4546
self.requires('boost/[>=1.74.0]', transitive_headers=True)
@@ -49,8 +50,8 @@ def requirements(self):
4950
self.requires('grpc/[>=1.48.4]', transitive_headers=True)
5051
self.requires('protobuf/[>=3.17.1]', transitive_headers=True)
5152

52-
self.requires('xtensor/[>=0.24.3]', transitive_headers=True)
53-
self.requires('abseil/[>=20230125.3]')
53+
self.requires('xtensor/[>=0.24.3]')
54+
self.requires('abseil/[>=20230125.3]', transitive_libs=True)
5455

5556
def build_requirements(self):
5657
if self.options.offline_proto_generation:
@@ -83,13 +84,13 @@ def package(self):
8384

8485
def package_info(self):
8586
self.cpp_info.components["viam_rust_utils"].libs = ["viam_rust_utils"]
86-
87+
8788
self.cpp_info.components["viamsdk"].libs = ["viamsdk"]
8889

8990
for component in ["viamsdk", "viamapi"]:
9091
self.cpp_info.components[component].set_property("cmake_target_name", "viam-cpp-sdk::{}".format(component))
9192
self.cpp_info.components[component].set_property("pkg_config_name", "viam-cpp-sdk-lib{}".format(component))
92-
self.cpp_info.components[component].requires = ["grpc::grpc++", "protobuf::libprotobuf"]
93+
self.cpp_info.components[component].requires = ["grpc::grpc++"]
9394
if self.settings.os in ["Linux", "FreeBSD"]:
9495
self.cpp_info.components[component].system_libs = ["pthread"]
9596

@@ -114,11 +115,12 @@ def package_info(self):
114115
"viamapi",
115116
"boost::headers",
116117
"boost::log",
118+
"grpc::grpc++_reflection",
119+
"protobuf::libprotobuf",
117120
"xtensor::xtensor",
118121

119122
"viam_rust_utils",
120123
"abseil::absl_strings",
121-
"grpc::grpc++_reflection"
122124
])
123125

124126
self.cpp_info.components["viamsdk"].frameworks = ["Security"]

src/viam/api/api_proto_tag.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.354
1+
v0.1.362

0 commit comments

Comments
 (0)