Skip to content

Commit

Permalink
feat: auto-publish workflow (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogun-anduril authored Dec 2, 2024
1 parent deabf61 commit 1deee04
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 57 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release
on:
push:
branches:
- master

permissions:
contents: read

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins: [
"@semantic-release/commit-analyzer",
'@semantic-release/release-notes-generator',
"@semantic-release/github"
]
79 changes: 22 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,45 @@
# Lattice SDK C++

The official [Anduril](https://www.anduril.com/) Lattice SDK for C++.

## Documentation

See the documentation for [Lattice C++ SDK](https://docs.anduril.com/sdks/cpp).

## Requirements

* gRPC 1.62.2. This can be installed with Homebrew on OSX `brew install grpc`
* Protobuf 28.2.0
:warning It's very important that the versions of lib protobuf match the version that it was compiled with as C++ requires very specific [guarantees](https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp). The current version requires:

* gRPC == 1.68.0
* Protobuf == 28.3.0
* CMake >= 3.16

## Installation

The only supported way of install the C++ SDK is by fetching the package using CMake. Please use a fixed version of `GIT_TAG` to ensure that
you are not impacted by dependency updates of `gRPC` or `Protobuf`.

### CMakeLists.txt

```cmake
cmake_minimum_required(VERSION 3.25.0)
project(lattice-sdk-example)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Download the SDK from github and add it as part of the project
include(FetchContent)
FetchContent_Declare(
lattice-sdk-cpp
GIT_REPOSITORY https://github.com/anduril/lattice-sdk-cpp.git
GIT_TAG 1.0.0
)
set(FETCHCONTENT_QUIET OFF)
FetchContent_MakeAvailable(lattice-sdk-cpp)
# Build the text-only CLI and link against the Lattice SDK.
add_executable(cli_client main.cpp)
target_link_libraries(cli_client lattice-sdk-cpp)
```

### Usage
main.cpp

```cpp
#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/security/credentials.h>
#include <anduril/entitymanager/v1/entity_manager_api.pub.grpc.pb.h>

int main(int argc, char *argv[]) {
GOOGLE_PROTOBUF_VERIFY_VERSION;

auto url = "YOUR_ENVIRONMENT_URL"

grpc::ClientContext ctx;
// Setting custom metadata to be sent to the server
ctx.AddMetadata("authorization", "Bearer $BEARER TOKEN");

auto creds = grpc::SslCredentials(grpc::SslCredentialsOptions());
std::shared_ptr<anduril::entitymanager::v1::EntityManagerAPI::Stub> mStub =
anduril::entitymanager::v1::EntityManagerAPI::NewStub(grpc::CreateChannel(url, creds));

anduril::entitymanager::v1::GetEntityRequest req;
req.set_entity_id("$ENTITY_ID");

anduril::entitymanager::v1::GetEntityResponse res;
# Other build instructions
....
grpc::Status status = mStub->GetEntity(&ctx, req, &res);
# Link SDK with your sample application.
target_link_libraries(sample_app lattice-sdk-cpp)
```

if(!status.ok()) {
std::cerr << "Error code: " << status.error_code() << std::endl;
std::cerr << "Error message: " << status.error_message() << std::endl;
} else {
std::cout << res.entity().DebugString() << std::endl;
}
## Support

return 0;
}
```
For support with this library please [file an issue](https://github.com/anduril/lattice-sdk-cpp/issues/new) or reach out to your Anduril representative.

```
mkdir build
cd build
cmake ..
make
./cli_client
```

0 comments on commit 1deee04

Please sign in to comment.