Skip to content

RSDK-5238 - Versioned releases #86

RSDK-5238 - Versioned releases

RSDK-5238 - Versioned releases #86

Workflow file for this run

name: Build + draft release
# CR erodkin: delete me before merging
on: pull_request
# (erodkin) this is needed to create the release, per https://github.com/softprops/action-gh-release/issues/236
permissions:
contents: write
jobs:
prepare:
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.which_version.outputs.version }}
sha: ${{ steps.commit.outputs.commit_long_sha }}
steps:
- name: Check if organization member
id: is_organization_member
uses: jamessingleton/[email protected]
with:
organization: viamrobotics
username: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cancelling - user not part of organization
uses: andymckay/[email protected]
if: |
steps.is_organization_member.outputs.result == 'false'
- name: Checkout Code
uses: actions/checkout@v3
- name: Which Version
id: which_version
shell: bash
run: echo "version=$(grep 'set(CMAKE_PROJECT_VERSION' CMakeLists.txt | sed 's/)//' | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Check if release exists
uses: cardinalby/[email protected]
id: release_exists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseName: releases/v${{ steps.which_version.outputs.version }}
doNotFailIfNotFound: 'true'
- name: Cancelling - release already exists
uses: andymckay/[email protected]
if: steps.release_exists.outputs.id != ''
- name: Commit + Push
id: commit
uses: EndBug/[email protected]
with:
default_author: github_actions
message: Bumping version to v${{ steps.which_version.outputs.version }} [skip ci]
build_macos:
if: github.repository_owner == 'viamrobotics'
needs: [prepare]
runs-on: [self-hosted, ARM64, macOS]
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
platform: macosx_arm64
- target: x86_64-apple-darwin
platform: macosx_x86_64
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ needs.prepare.outputs.sha }}
- name: Install dependencies
run: |
brew install abseil cmake boost grpc protobuf xtensor
brew install pkg-config ninja buf
- name: Setup build directory
run: mkdir builds
- name: Build
run: |
export BUF_CONFIG_DIR=$(mktemp -d)
mkdir build
cmake -S . -B build -G Ninja
cmake --build build --target all install -- -v
- name: Copy
run: |
cmake --install build --prefix builds/libviamsdk-${{ matrix.platform }}
cmake --install build --prefix builds/libviamapi-${{ matrix.platform }}
cp build/install/lib/libviam_rust_utils.a builds/libviam_rust_utils-${{ matrix.platform }}.a
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: builds
build_linux:
if: github.repository_owner == 'viamrobotics'
needs: [prepare]
runs-on: ${{ matrix.runs_on }}
container:
image: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-debian-bullseye
platform: linux_aarch64-debian-bullseye
image: debian:bullseye
runs_on: buildjet-8vcpu-ubuntu-2204-arm
- target: x86_64-debian-bullseye
platform: linux_x86_64-debian-bullseye
image: debian:bullseye
runs_on: buildjet-8vcpu-ubuntu-2204
- target: aarch64-debian-bookworm
platform: linux_aarch64-ubuntu-jammy
image: debian:bookworm
runs_on: buildjet-8vcpu-ubuntu-2204-arm
- target: x86_64-debian-bookworm
platform: linux_x86_64-ubuntu-jammy
image: debian:bookworm
runs_on: buildjet-8vcpu-ubuntu-2204
- target: aarch64-ubuntu-jammy-gnu
platform: linux_aarch64-ubuntu-jammy
image: ubuntu:22.04
runs_on: buildjet-8vcpu-ubuntu-2204-arm
- target: x86_64-ubuntu-jammy-gnu
platform: linux_x86_64-ubuntu-jammy
image: ubuntu:22.04
runs_on: buildjet-8vcpu-ubuntu-2204
#- target: x86_64-unknown-linux-gnu
#platform: linux_x86_64
#image: ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main
#runs_on: buildjet-4vcpu-ubuntu-2204
#- target: arm-unknown-linux-gnueabihf
#platform: linux_armv6l
#image: ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:main
#runs_on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ needs.prepare.outputs.sha }}
- name: Install dependencies
run: |
apt-get update
apt-get -y dist-upgrade
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
build-essential \
ca-certificates \
curl \
doxygen \
g++ \
gdb \
git \
gnupg \
gpg \
less \
libabsl-dev \
libboost-all-dev \
libc-ares-dev \
libgrpc++-dev \
libre2-dev \
libssl-dev \
ninja-build \
pkg-config \
software-properties-common \
sudo \
wget \
zlib1g-dev
# Add the public key for the llvm repository to get the correct clang version
bash -c 'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -'
apt-add-repository -y 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main'
# Add public key and repository to get cmake 3.25+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - > /usr/share/keyrings/kitware-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' > /etc/apt/sources.list.d/kitware.list
apt-get update
apt-get -y --no-install-recommends install -t llvm-toolchain-focal-15 clang-15 clang-tidy-15
apt-get -y install cmake
#mkdir -p ${HOME}/opt/src
#cd ${HOME}/opt/src && \
#git clone --recurse-submodules -b v1.52.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
#cd grpc && \
#mkdir -p build && \
#cd build && \
#cmake .. -G Ninja \
#-DgRPC_ZLIB_PROVIDER=package \
#-DgRPC_CARES_PROVIDER=package \
#-DgRPC_RE2_PROVIDER=package \
#-DgRPC_SSL_PROVIDER=package \
#-DgRPC_INSTALL=ON \
#-DgRPC_BUILD_TESTS=OFF \
#-DBUILD_SHARED_LIBS=ON \
#-DCMAKE_BUILD_TYPE=RelWithDebInfo \
#-DCMAKE_INSTALL_PREFIX=/usr/local \
#-DCMAKE_INSTALL_RPATH=/usr/local/lib && \
#ninja install && \
#cd .. && \
#rm -rf build
- name: Setup build directory
run: mkdir builds
- name: Build
shell: bash
run: |
mkdir build
/usr/bin/cmake -S . -B build -G Ninja
/usr/bin/cmake --build build --target all install -- -v -j 3
- name: Copy
run: |
/usr/bin/cmake --install build --prefix builds/libviamsdk-${{ matrix.platform }}
/usr/bin/cmake --install build --prefix builds/libviamapi-${{ matrix.platform }}
cp build/install/lib/libviam_rust_utils.a builds/libviam_rust_utils-${{ matrix.platform }}.a
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: builds
release:
needs: [prepare, build_macos, build_linux]
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.prepare.outputs.version }}
files: builds/*
draft: true
prerelease: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}