Skip to content

Commit

Permalink
Added CD GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
amessing-bdai committed Feb 29, 2024
1 parent a68fe71 commit 35c9120
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .devcontainer/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:22.04

RUN apt-get update --fix-missing &&\
apt-get install -y --no-install-recommends build-essential ca-certificates git g++ pkg-config python3 curl ninja-build tar zip unzip zlib1g-dev libssl-dev wget &&\
apt-get autoclean &&\
apt-get autoremove &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

RUN wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3.tar.gz &&\
tar -xzf cmake-3.28.3.tar.gz &&\
cd cmake-3.28.3 &&\
./configure &&\
make install &&\
cd .. &&\
rm cmake-3.28.3.tar.gz &&\
rm -r cmake-3.28.3

RUN git clone https://github.com/microsoft/vcpkg &&\
cd vcpkg &&\
git checkout 3b213864579b6fa686e38715508f7cd41a50900f &&\
./bootstrap-vcpkg.sh -disableMetrics &&\
./vcpkg install grpc:x64-linux &&\
./vcpkg install eigen3:x64-linux &&\
./vcpkg install cli11:x64-linux
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM arm64v8/ubuntu:22.04
SHELL ["/bin/bash", "-c"]

RUN apt-get update --fix-missing &&\
apt-get install -y --no-install-recommends build-essential ca-certificates cmake git g++ pkg-config python3 curl ninja-build tar zip unzip zlib1g-dev libssl-dev wget &&\
apt-get autoclean &&\
apt-get autoremove &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

RUN wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3.tar.gz &&\
tar -xzf cmake-3.28.3.tar.gz &&\
cd cmake-3.28.3 &&\
./configure &&\
make install &&\
cd .. &&\
rm cmake-3.28.3.tar.gz &&\
rm -r cmake-3.28.3

RUN git clone https://github.com/microsoft/vcpkg &&\
cd vcpkg &&\
git checkout 3b213864579b6fa686e38715508f7cd41a50900f &&\
export VCPKG_FORCE_SYSTEM_BINARIES=arm &&\
./bootstrap-vcpkg.sh -disableMetrics &&\
./vcpkg install grpc:arm64-linux &&\
./vcpkg install eigen3:arm64-linux &&\
./vcpkg install cli11:arm64-linux
129 changes: 129 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# This workflow automatically releases binaries upon tagging.
name: spot-cpp-sdk CD

on:
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: bdaiinstitute/spot_cpp_sdk_builder

jobs:
# Commented out due to speed of runners. Uncomment when we get the better ones.
# build-docker-image:
# permissions:
# contents: read
# packages: write
# # This is used to complete the identity challenge
# # with sigstore/fulcio when running outside of PRs.
# id-token: write
# strategy:
# fail-fast: false
# matrix:
# config:
# - { arch: "amd64" }
# - { arch: "arm64" }
# name: Build docker image for ${{ matrix.config.arch }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Set up QEMU # as virtualization is necessary to build container images
# uses: docker/setup-qemu-action@v3

# - name: Setup Docker buildx # to workaround: https://github.com/docker/build-push-action/issues/461
# uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# - name: Log into registry ${{ env.REGISTRY }}
# uses: docker/login-action@v3 # https://github.com/docker/login-action
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

# # Extract metadata (tags, labels) for Docker
# # https://github.com/docker/metadata-action
# - name: Extract Docker metadata
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}_${{ matrix.config.arch }}

# - name: Build and push
# uses: docker/build-push-action@v5 # https://github.com/docker/build-push-action
# id: build
# with:
# context: .
# file: .devcontainer/Dockerfile.${{ matrix.config.arch }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# push: true

build-artifacts:
strategy:
fail-fast: false
matrix:
config:
- { arch: "amd64" }
- { arch: "arm64" }
name: Build spot-cpp-sdk for ${{ matrix.config.arch }}
# needs: build-docker-image
runs-on: ubuntu-latest
# container:
# # env cannot be used here...
# image: ghcr.io/bdaiinstitute/spot_cpp_sdk_builder_${{ matrix.config.arch }}:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build spot-sdk-cpp
uses: addnab/docker-run-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
image: ghcr.io/bdaiinstitute/spot_cpp_sdk_builder_${{ matrix.config.arch }}:latest
options: |
--platform linux/${{ matrix.config.arch }}
--volume ${{ github.workspace }}:/spot-sdk-cpp
run: |
cd spot-sdk-cpp/cpp
mkdir build
cd build
cmake ../ -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE -DBUILD_CHOREOGRAPHY_LIBS=ON
make -j2 install package
- name: Upload ${{ matrix.config.arch }} artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.arch }}-artifact
path: '*.deb'
retention-days: 1

bundle-debians:
name: Release artifacts
runs-on: ubuntu-latest
needs: build-artifacts
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: '*-artifact'
merge-multiple: true

- name: Release to GitHub
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
files: '*.deb'

6 changes: 6 additions & 0 deletions docs/cpp/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ make -j6 install

The `make` command generates a lot of deprecation warnings during the compiling of the classes generated from the protobuf definitions. This is expected as the protobuf definitions contain `deprecated` flags for fields that will not be supported in future versions of the SDK.

Build the SDK and generate a debian package using the `make` command below:

```
make -j6 install package
```

**On Windows:**

- Open the `sln` file in the build folder in Microsoft Visual Studio.
Expand Down
6 changes: 6 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
git add -A
git commit --amend
git tag -d 4.0.0
git tag -a 4.0.0 -m "4.0.0"
git push --force
git push --tags

0 comments on commit 35c9120

Please sign in to comment.