Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/enforce-linking-issues.yml

This file was deleted.

185 changes: 81 additions & 104 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,133 +14,110 @@
name: Release

on:
release:
types: [published]
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
inputs:
live-run:
type: boolean
description: Live-run
required: false
version:
type: string
description: Release number
required: false

jobs:
preps:
name: Preparation
tag:
name: Branch, Bump & tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.create-release-branch.outputs.version }}
branch: ${{ steps.create-release-branch.outputs.branch }}
steps:
- id: create-release-branch
uses: eclipse-zenoh/ci/create-release-branch@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
# NOTE(fuzzypixelz): When the version is undefined (e.g. on schedule
# events) we cannot use git-describe as CMake doesn't support it.
# However, we still need some placeholder version to test that the
# version can be reliably bumped.
version: ${{ inputs.version || '0.0.0' }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}

- name: Clone this repository
uses: actions/checkout@v4
with:
ref: ${{ steps.create-release-branch.outputs.branch }}

- name: Environment setup
id: env
shell: bash
run: |
echo "GITHUB_REF=${GITHUB_REF}"
echo "GITHUB_SHA=${GITHUB_SHA:0:8}"
GIT_BRANCH=`[[ $GITHUB_REF =~ ^refs/heads/.* ]] && echo ${GITHUB_REF/refs\/heads\//} || true`
echo "GIT_BRANCH=${GIT_BRANCH}"
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_OUTPUT
GIT_TAG=`[[ $GITHUB_REF =~ ^refs/tags/.* ]] && echo ${GITHUB_REF/refs\/tags\//} || true`
echo "GIT_TAG=${GIT_TAG}"
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT
- name: Bump and tag project
run: bash ci/scripts/bump-and-tag.bash
env:
VERSION: ${{ steps.create-release-branch.outputs.version }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: eclipse-zenoh-bot@users.noreply.github.com

ZENOH_VERSION=$(sed -n 's/^[ \t]*VERSION \([0-9][0-9]*\.[0-9][0-9]*\.[0.9][0-9]*\.[0-9][0-9]*\).*/\1/p' CMakeLists.txt | head -n1)
echo "ZENOH_VERSION=${ZENOH_VERSION}"
echo "ZENOH_VERSION=${ZENOH_VERSION}" >> $GITHUB_OUTPUT
if [ -n "${GIT_TAG}" ]; then
IS_RELEASE="true"
echo "IS_RELEASE=${IS_RELEASE}"
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
PKG_VERSION=${ZENOH_VERSION}
elif [ -n "${GIT_BRANCH}" ]; then
PKG_VERSION=${GIT_BRANCH}-${GITHUB_SHA:0:8}
else
PKG_VERSION=${ZENOH_VERSION}-${GITHUB_SHA:0:8}
fi
echo "PKG_VERSION=${PKG_VERSION}"
echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_OUTPUT
outputs:
GIT_BRANCH: ${{ steps.env.outputs.GIT_BRANCH }}
GIT_TAG: ${{ steps.env.outputs.GIT_TAG }}
IS_RELEASE: ${{ steps.env.outputs.IS_RELEASE }}
ZENOH_VERSION: ${{ steps.env.outputs.ZENOH_VERSION }}
PKG_VERSION: ${{ steps.env.outputs.PKG_VERSION }}
linux-build:
build:
name: Build packages for Linux
needs: preps
needs: tag
runs-on: ubuntu-latest
steps:
- name: Clone this repository
uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.branch }}

- name: Make packages
shell: bash
run: |
mkdir -p build && cd build
cmake ../install -DCPACK_PACKAGE_VERSION=${{ needs.preps.outputs.PKG_VERSION }}
cmake --build . --target package
- id: build
run: bash ci/scripts/build.bash
env:
REPO: ${{ github.repository }}
VERSION: ${{ needs.tag.outputs.version }}

- name: Packaging
id: package
shell: bash
run: |
ZIP_NAME=zenoh-cpp-${{ needs.preps.outputs.PKG_VERSION }}.zip
LIB_PKG_NAME=${PWD}/${ZIP_NAME}
DEB_PKG_NAME=${PWD}/zenoh-cpp-${{ needs.preps.outputs.PKG_VERSION }}-deb-pkgs.zip
RPM_PKG_NAME=${PWD}/zenoh-cpp-${{ needs.preps.outputs.PKG_VERSION }}-rpm-pkgs.zip
echo "DEB_PKG_NAME=${DEB_PKG_NAME}" >> $GITHUB_OUTPUT
echo "RPM_PKG_NAME=${RPM_PKG_NAME}" >> $GITHUB_OUTPUT
echo "LIB_PKG_NAME=${LIB_PKG_NAME}" >> $GITHUB_OUTPUT
cd build/packages
echo "Packaging ${LIB_PKG_NAME}:"
mv ${ZIP_NAME} ${LIB_PKG_NAME}
echo "Packaging ${DEB_PKG_NAME}:"
zip ${DEB_PKG_NAME} *.deb
echo "Packaging ${RPM_PKG_NAME}:"
zip ${RPM_PKG_NAME} *.rpm
- name: Upload library archive
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.archive-lib }}
path: ${{ steps.build.outputs.archive-lib }}

- name: Upload DEB archive
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.archive-deb }}
path: ${{ steps.build.outputs.archive-deb }}

- name: "Upload packages"
uses: actions/upload-artifact@v3
- name: Upload RPM archive
uses: actions/upload-artifact@v4
with:
name: Upload packages
path: |
${{ steps.package.outputs.LIB_PKG_NAME }}
${{ steps.package.outputs.DEB_PKG_NAME }}
${{ steps.package.outputs.RPM_PKG_NAME }}
name: ${{ steps.build.outputs.archive-rpm }}
path: ${{ steps.build.outputs.archive-rpm }}

publication:
name: Publish the release
if: needs.preps.outputs.IS_RELEASE == 'true'
needs: [preps, linux-build]
eclipse:
needs: [tag, build]
runs-on: ubuntu-latest
steps:
- name: Download result of previous builds
uses: actions/download-artifact@v3
- uses: eclipse-zenoh/ci/publish-crates-eclipse@main
with:
path: ARTIFACTS
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
ssh-host: genie.zenoh@projects-storage.eclipse.org
ssh-host-path: /home/data/httpd/download.eclipse.org/zenoh/zenoh-cpp
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-passphrase: ${{ secrets.SSH_PASSPHRASE }}
archive-patterns: '.*\.zip'

- name: Publish as github release
uses: softprops/action-gh-release@v1
github:
needs: [tag, build]
runs-on: ubuntu-latest
steps:
- uses: eclipse-zenoh/ci/publish-crates-github@main
with:
files: ARTIFACTS/*/*.*

- name: Publish to download.eclipse.org/zenoh
env:
SSH_TARGET: genie.zenoh@projects-storage.eclipse.org
ECLIPSE_BASE_DIR: /home/data/httpd/download.eclipse.org/zenoh/zenoh-cpp
shell: bash
run: |
echo "--- setup ssh-agent"
eval "$(ssh-agent -s)"
echo 'echo "${{ secrets.SSH_PASSPHRASE }}"' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' | DISPLAY=NONE SSH_ASKPASS=~/.ssh_askpass ssh-add - > /dev/null 2>&1
rm -f ~/.ssh_askpass
echo "--- test ssh:"
ssh -o "StrictHostKeyChecking=no" ${SSH_TARGET} ls -al
echo "---- list artifacts to upload:"
ls -R ARTIFACTS || true
DOWNLOAD_DIR=${ECLIPSE_BASE_DIR}/${{ needs.preps.outputs.PKG_VERSION }}
echo "---- copy artifacts into ${DOWNLOAD_DIR}"
ssh -o "StrictHostKeyChecking=no" ${SSH_TARGET} mkdir -p ${DOWNLOAD_DIR}
cd ARTIFACTS
sha256sum */* > sha256sums.txt
scp -o "StrictHostKeyChecking=no" -r * ${SSH_TARGET}:${DOWNLOAD_DIR}/
echo "---- cleanup identity"
ssh-add -D
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
branch: ${{ needs.tag.outputs.branch }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-passphrase: ${{ secrets.SSH_PASSPHRASE }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
archive-patterns: '.*\.zip'
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 3.16)

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.txt version)

project(
zenohcxx
VERSION 0.11.0.0
VERSION ${version}
DESCRIPTION "C++ bindings for Zenoh"
HOMEPAGE_URL "https://github.com/eclipse-zenoh/zenoh-cpp"
LANGUAGES C CXX
Expand Down Expand Up @@ -77,4 +80,4 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(tests)
add_subdirectory(examples)
add_subdirectory(docs)
endif()
endif()
31 changes: 31 additions & 0 deletions ci/scripts/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -xeo pipefail

# Repository
readonly repo=${REPO:?input REPO is required}
# Release number
readonly version=${VERSION:-''}

readonly out=$GITHUB_WORKSPACE
readonly repo_name=${repo#*/}
readonly archive_lib=$out/$repo_name-$version.zip
readonly archive_deb=$out/$repo_name-$version-deb-pkgs.zip
readonly archive_rpm=$out/$repo_name-$version-rpm-pkgs.zip

# Make packages into build/packages
mkdir -p build
cd build
cmake ../install
cmake --build . --target package
ls -R

cd "$GITHUB_WORKSPACE"
mv "build/packages/$repo_name-$version.zip" "$archive_lib"
zip --verbose --junk-paths "$archive_deb" build/packages/*.deb
zip --verbose --junk-paths "$archive_rpm" build/packages/*.rpm

{ echo "archive-lib=$(basename "$archive_lib")";
echo "archive-deb=$(basename "$archive_deb")";
echo "archive-rpm=$(basename "$archive_rpm")";
} >> "$GITHUB_OUTPUT"
30 changes: 30 additions & 0 deletions ci/scripts/bump-and-tag.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -xeo pipefail

# Release number
readonly version=${VERSION:-''}
# Git actor name
readonly git_user_name=${GIT_USER_NAME:?input GIT_USER_NAME is required}
# Git actor email
readonly git_user_email=${GIT_USER_EMAIL:?input GIT_USER_EMAIL is required}

export GIT_AUTHOR_NAME=$git_user_name
export GIT_AUTHOR_EMAIL=$git_user_email
export GIT_COMMITTER_NAME=$git_user_name
export GIT_COMMITTER_EMAIL=$git_user_email

# Bump CMake project version
if [[ "$version" == '' ]]; then
# If no version has been specified, infer it using git-describe
printf '%s' "$(git describe)" > version.txt
else
printf '%s' "$version" > version.txt
fi

git commit version.txt -m "chore: Bump version to $version"
git tag --force "$version" -m "v$version"
git log -10
git show-ref --tags
git push origin
git push --force origin"$version"
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
project = 'zenoh-cpp'
copyright = '2017, 2023 ZettaScale Technology'
author = 'ZettaScale Zenoh team'
release = '0.11.0.0'
# Extract the release number from the version.txt file
with open("../version.txt", "rt") as f:
release = f.read()

# -- General configuration ---------------------------------------------------
master_doc = 'index'
Expand Down
5 changes: 3 additions & 2 deletions install/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../version.txt version)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# Settings when 'examples' is the root projet
cmake_minimum_required(VERSION 3.16)
project(
zenohcxx
VERSION 0.11.0.0
VERSION ${version}
DESCRIPTION "C++ bindings for Zenoh"
HOMEPAGE_URL "https://github.com/eclipse-zenoh/zenoh-cpp"
LANGUAGES C CXX
Expand Down Expand Up @@ -100,5 +102,4 @@ if(UNIX)
set(CPACK_RPM_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "")
endif()

include(CPack)
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.11.0.0