Skip to content

Commit

Permalink
fix: Support custom zenoh-{c,pico} version in Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Apr 17, 2024
1 parent f691c4d commit 6607055
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ on:
type: string
description: Release number
required: false
zenoh-c-version:
type: string
description: Release number of zenoh-c
required: false
zenoh-pico-version:
type: string
description: Release number of zenoh-pico
required: false

jobs:
tag:
Expand Down Expand Up @@ -56,6 +64,9 @@ jobs:
run: bash ci/scripts/bump-and-tag.bash
env:
VERSION: ${{ steps.create-release-branch.outputs.version }}
BRANCH: ${{ steps.create-release-branch.outputs.branch }}
ZENOH_C_BRANCH: ${{ inputs.zenoh-c-version && format('release/{0}', inputs.zenoh-c-version) || '' }}
ZENOH_PICO_BRANCH: ${{ inputs.zenoh-pico-version && format('release/{0}', inputs.zenoh-pico-version) || '' }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: [email protected]

Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.16)

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

file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zenoh-c-branch.txt zenoh_c_branch)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zenoh-pico-branch.txt zenoh_pico_branch)

project(
zenohcxx
VERSION ${version}
Expand All @@ -16,8 +19,8 @@ include(helpers)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
enable_testing()
set_default_build_type(Release)
configure_include_project(ZENOHCXX_ZENOHPICO zenohpico zenohpico "../zenoh-pico" zenohpico "https://github.com/eclipse-zenoh/zenoh-pico" "main")
configure_include_project(ZENOHCXX_ZENOHC zenohc zenohc::lib "../zenoh-c" zenohc "https://github.com/eclipse-zenoh/zenoh-c" "main")
configure_include_project(ZENOHCXX_ZENOHPICO zenohpico zenohpico "../zenoh-pico" zenohpico "https://github.com/eclipse-zenoh/zenoh-pico" ${zenoh_pico_branch})
configure_include_project(ZENOHCXX_ZENOHC zenohc zenohc::lib "../zenoh-c" zenohc "https://github.com/eclipse-zenoh/zenoh-c" ${zenoh_c_branch})
endif()

#
Expand Down
15 changes: 15 additions & 0 deletions ci/scripts/bump-and-tag.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ set -xeo pipefail

# Release number
readonly version=${VERSION:?input VERSION is required}
# Branch
readonly branch=${BRANCH:?input BRANCH is required}
# Branch of zenoh-c
readonly zenoh_c_branch=${ZENOH_C_BRANCH:-''}
# Branch of zenoh-pico
readonly zenoh_pico_branch=${ZENOH_PICO_BRANCH:-''}
# Git actor name
readonly git_user_name=${GIT_USER_NAME:?input GIT_USER_NAME is required}
# Git actor email
Expand All @@ -17,6 +23,15 @@ export GIT_COMMITTER_EMAIL=$git_user_email
# Bump CMake project version
printf '%s' "$version" > version.txt

# Set branches
printf '%s' "$branch" > zenoh-cpp-branch.txt
if [[ $zenoh_c_branch != '' ]]; then
printf '%s' "$zenoh_c_branch" > zenoh-c-branch.txt
fi
if [[ $zenoh_pico_branch != '' ]]; then
printf '%s' "$zenoh_pico_branch" > zenoh-pico-branch.txt
fi

git commit version.txt -m "chore: Bump version to $version"
git tag --force "$version" -m "v$version"
git log -10
Expand Down
12 changes: 8 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../zenoh-c-branch.txt zenoh_c_branch)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../zenoh-pico-branch.txt zenoh_pico_branch)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../zenoh-cpp-branch.txt zenoh_cpp_branch)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# Settings when 'examples' is the root projet
cmake_minimum_required(VERSION 3.16)
project(zenohcxx_examples LANGUAGES C CXX)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake ${CMAKE_MODULE_PATH})
include(helpers)
set_default_build_type(Release)
configure_include_project(ZENOHCXX_ZENOHC zenohc zenohc::lib "../../zenoh-c" zenohc "https://github.com/eclipse-zenoh/zenoh-c" "main")
configure_include_project(ZENOHPICO zenohpico zenohpico "../../zenoh-pico" zenohc "https://github.com/eclipse-zenoh/zenoh-pico" "main")
configure_include_project(ZENOHCXX zenohcxx zenohcxx ".." zenohcxx "https://github.com/eclipse-zenoh/zenoh-cpp" "main")
configure_include_project(ZENOHCXX_ZENOHC zenohc zenohc::lib "../../zenoh-c" zenohc "https://github.com/eclipse-zenoh/zenoh-c" ${zenoh_c_branch})
configure_include_project(ZENOHPICO zenohpico zenohpico "../../zenoh-pico" zenohc "https://github.com/eclipse-zenoh/zenoh-pico" ${zenoh_pico_branch})
configure_include_project(ZENOHCXX zenohcxx zenohcxx ".." zenohcxx "https://github.com/eclipse-zenoh/zenoh-cpp" ${zenoh_cpp_branch})
add_custom_target(examples ALL)
else()
message(STATUS "zenoh-cxx examples")
Expand Down Expand Up @@ -51,4 +55,4 @@ add_examples("${CMAKE_CURRENT_SOURCE_DIR}/universal/*.cxx" zenohpico zenohcxx::z
add_examples("${CMAKE_CURRENT_SOURCE_DIR}/simple/universal/z_simple.cxx" zenohpico zenohcxx::zenohpico)
add_examples("${CMAKE_CURRENT_SOURCE_DIR}/simple/universal/z_simple.cxx" zenohc zenohcxx::zenohc::lib)
add_examples("${CMAKE_CURRENT_SOURCE_DIR}/simple/zenohpico/zp_simple.cxx" zenohpico zenohcxx::zenohpico)
add_examples("${CMAKE_CURRENT_SOURCE_DIR}/simple/zenohc/zc_simple.cxx" zenohc zenohcxx::zenohc::lib)
add_examples("${CMAKE_CURRENT_SOURCE_DIR}/simple/zenohc/zc_simple.cxx" zenohc zenohcxx::zenohc::lib)
1 change: 1 addition & 0 deletions zenoh-c-branch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main
1 change: 1 addition & 0 deletions zenoh-cpp-branch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main
1 change: 1 addition & 0 deletions zenoh-pico-branch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main

0 comments on commit 6607055

Please sign in to comment.