-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #781 from ZettaScaleLabs/build-packages-cpack
fix: change release workflow to build using cpack
- Loading branch information
Showing
15 changed files
with
188 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,33 +72,142 @@ jobs: | |
GIT_USER_NAME: eclipse-zenoh-bot | ||
GIT_USER_EMAIL: [email protected] | ||
|
||
build-debian: | ||
name: Build Debian packages | ||
build: | ||
name: Build packages | ||
runs-on: ${{ matrix.build.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: | ||
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 } | ||
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04 } | ||
- { target: arm-unknown-linux-gnueabi, os: ubuntu-20.04 } | ||
- { target: arm-unknown-linux-gnueabihf, os: ubuntu-20.04 } | ||
- { target: armv7-unknown-linux-gnueabihf, os: macos-14 } | ||
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04 } | ||
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04 } | ||
- { target: x86_64-apple-darwin, os: macos-14 } | ||
- { target: aarch64-apple-darwin, os: macos-14 } | ||
- { target: x86_64-pc-windows-msvc, os: windows-2019 } | ||
- { target: x86_64-pc-windows-gnu, os: ubuntu-20.04 } | ||
needs: tag | ||
uses: eclipse-zenoh/ci/.github/workflows/build-crates-debian.yml@main | ||
with: | ||
repo: ${{ github.repository }} | ||
version: ${{ needs.tag.outputs.version }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
secrets: inherit | ||
steps: | ||
- name: Checkout this repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.tag.outputs.branch }} | ||
token: ${{ secrets.BOT_TOKEN_WORKFLOW }} | ||
|
||
build-standalone: | ||
name: Build executables and libraries | ||
needs: tag | ||
uses: eclipse-zenoh/ci/.github/workflows/build-crates-standalone.yml@main | ||
with: | ||
repo: ${{ github.repository }} | ||
version: ${{ needs.tag.outputs.version }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
artifact-patterns: | | ||
^libzenohc\.(dylib|so)$ | ||
^zenohc\.dll$ | ||
^include$ | ||
secrets: inherit | ||
- name: Add rust toolchain | ||
run: | | ||
rustup target add ${{ matrix.build.target }} | ||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'x86_64-unknown-linux-musl'}} | ||
run: | | ||
sudo apt-get install -y musl-tools | ||
wget https://musl.cc/x86_64-linux-musl-cross.tgz | ||
tar xvfz x86_64-linux-musl-cross.tgz | ||
echo "$(readlink -f x86_64-linux-musl-cross)/bin" >> "$GITHUB_PATH" | ||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'arm-unknown-linux-gnueabi'}} | ||
run: sudo apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi | ||
|
||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'arm-unknown-linux-gnueabihf'}} | ||
run: sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf | ||
|
||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'armv7-unknown-linux-gnueabihf'}} | ||
run: | | ||
brew install -f messense/macos-cross-toolchains/armv7-unknown-linux-gnueabihf | ||
brew install dpkg | ||
brew install rpm | ||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'aarch64-unknown-linux-gnu'}} | ||
run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
|
||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'aarch64-unknown-linux-musl'}} | ||
run: | | ||
wget https://musl.cc/aarch64-linux-musl-cross.tgz | ||
tar xvfz aarch64-linux-musl-cross.tgz | ||
echo "$(readlink -f aarch64-linux-musl-cross)/bin" >> "$GITHUB_PATH" | ||
- name: Install build deps | ||
if: ${{ matrix.build.target == 'x86_64-pc-windows-gnu'}} | ||
run: | | ||
sudo apt-get install -y mingw-w64 | ||
- name: Compute package name | ||
id: compute-package-name | ||
shell: bash | ||
run: | | ||
if [[ "${{ matrix.build.target }}" =~ "armv7" ]]; then | ||
echo "value=zenohc-armv7" >> $GITHUB_OUTPUT | ||
elif [[ "${{ matrix.build.target }}" =~ "musl" ]]; then | ||
echo "value=zenohc-musl" >> $GITHUB_OUTPUT | ||
else | ||
echo "value=zenohc" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Build standalone | ||
id: build | ||
shell: bash | ||
run: | | ||
toolchain_file=$(readlink -f ci/toolchains/TC-${{ matrix.build.target }}.cmake) | ||
mkdir -p build && cd build | ||
cmake .. -DCPACK_PACKAGE_NAME=${{ steps.compute-package-name.outputs.value }} -DZENOHC_CUSTOM_TARGET=${{ matrix.build.target }} -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DZENOHC_BUILD_WITH_UNSTABLE_API=ON -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON | ||
cmake --build . --config Release | ||
cpack -C Release -G ZIP | ||
- name: Build distro packages (DEB/RPM) | ||
id: build-distro-packages | ||
if: ${{ contains(matrix.build.target, 'linux') }} | ||
run: | | ||
cd build | ||
cpack -G DEB | ||
cpack -G RPM | ||
- name: Prepare standalone archives | ||
shell: bash | ||
run: | | ||
zip_filename=$(readlink -f ./build/packages/*.zip) | ||
mv ${zip_filename} zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip | ||
- name: Zip deb/rpm archives | ||
shell: bash | ||
if: ${{ contains(matrix.build.target, 'linux') }} | ||
run: | | ||
zip -9 -j libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip ./build/packages/*.deb | ||
zip -9 -j libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip ./build/packages/*.rpm | ||
- name: Upload standalone archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
# Publish the artifact with zenoh-c (repo name) so it can be used by homebrew action | ||
name: zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip | ||
path: zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip | ||
|
||
- name: Upload DEB archive | ||
if: ${{ contains(matrix.build.target, 'linux') }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip | ||
path: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip | ||
|
||
- name: Upload RPM archive | ||
if: ${{ contains(matrix.build.target, 'linux') }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip | ||
path: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip | ||
|
||
debian: | ||
name: Publish Debian packages | ||
needs: [tag, build-debian] | ||
needs: [tag, build] | ||
uses: eclipse-zenoh/ci/.github/workflows/release-crates-debian.yml@main | ||
with: | ||
no-build: true | ||
|
@@ -111,7 +220,7 @@ jobs: | |
|
||
homebrew: | ||
name: Publish Homebrew formulae | ||
needs: [tag, build-standalone] | ||
needs: [tag, build] | ||
uses: eclipse-zenoh/ci/.github/workflows/release-crates-homebrew.yml@main | ||
with: | ||
no-build: true | ||
|
@@ -128,7 +237,7 @@ jobs: | |
|
||
eclipse: | ||
name: Publish artifacts to Eclipse downloads | ||
needs: [tag, build-standalone] | ||
needs: [tag, build] | ||
uses: eclipse-zenoh/ci/.github/workflows/release-crates-eclipse.yml@main | ||
with: | ||
no-build: true | ||
|
@@ -145,7 +254,7 @@ jobs: | |
|
||
github: | ||
name: Publish artifacts to GitHub Releases | ||
needs: [tag, build-standalone] | ||
needs: [tag, build] | ||
uses: eclipse-zenoh/ci/.github/workflows/release-crates-github.yml@main | ||
with: | ||
no-build: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(CMAKE_SYSTEM_NAME Darwin) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(ZENOHC_CUSTOM_TARGET aarch64-apple-darwin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(DEBARCH arm64) | ||
set(ZENOHC_CUSTOM_TARGET aarch64-unknown-linux-gnu) | ||
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) | ||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) | ||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(DEBARCH arm64) | ||
set(ZENOHC_CUSTOM_TARGET aarch64-unknown-linux-musl) | ||
set(CMAKE_C_COMPILER aarch64-linux-musl-gcc) | ||
set(CMAKE_CXX_COMPILER aarch64-linux-musl-g++) | ||
set(CMAKE_CXX_COMPILER aarch64-linux-musl-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR arm) | ||
set(DEBARCH armel) | ||
set(ZENOHC_CUSTOM_TARGET arm-unknown-linux-gnueabi) | ||
set(CMAKE_C_COMPILER arm-linux-gnueabi-gcc) | ||
set(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++) | ||
set(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR armhf) | ||
set(DEBARCH armhf) | ||
set(ZENOHC_CUSTOM_TARGET arm-unknown-linux-gnueabihf) | ||
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) | ||
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR armv7) | ||
set(DEBARCH armhf) | ||
set(ZENOHC_CUSTOM_TARGET armv7-unknown-linux-gnueabihf) | ||
set(CMAKE_C_COMPILER armv7-linux-gnueabihf-gcc) | ||
set(CMAKE_CXX_COMPILER armv7-linux-gnueabihf-g++) | ||
set(CMAKE_CXX_COMPILER armv7-linux-gnueabihf-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(CMAKE_SYSTEM_NAME Darwin) | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
set(ZENOHC_CUSTOM_TARGET x86_64-apple-darwin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
set(ZENOHC_CUSTOM_TARGET x86_64-pc-windows-msvc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
set(DEBARCH amd64) | ||
set(ZENOHC_CUSTOM_TARGET x86_64-unknown-linux-gnu) | ||
set(CMAKE_C_COMPILER x86_64-unknown-linux-gnu-gcc) | ||
set(CMAKE_CXX_COMPILER x86_64-unknown-linux-gnu-g++) | ||
set(CMAKE_C_COMPILER x86_64-linux-gnu-gcc) | ||
set(CMAKE_CXX_COMPILER x86_64-linux-gnu-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR x86_64) | ||
set(DEBARCH amd64) | ||
set(ZENOHC_CUSTOM_TARGET x86_64-unknown-linux-musl) | ||
set(CMAKE_C_COMPILER x86_64-linux-musl-gcc) | ||
set(CMAKE_CXX_COMPILER x86_64-linux-musl-g++) | ||
set(CMAKE_CXX_COMPILER x86_64-linux-musl-g++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_CMAKE_SYSTEM_PROCESSOR}") | ||
if(CPACK_GENERATOR MATCHES "DEB") | ||
# DEB package | ||
message(STATUS "Configure DEB packaging for Linux ${DEBARCH}") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ZettaScale Zenoh Team, <[email protected]>") | ||
set(CPACK_DEB_COMPONENT_INSTALL ON) | ||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||
|
@@ -14,11 +14,6 @@ if(CPACK_GENERATOR MATCHES "RPM") | |
# RPM package | ||
# rpmbuild should be installed | ||
# apt install rpm | ||
if(NOT RPMARCH) | ||
set(RPMARCH ${CMAKE_SYSTEM_PROCESSOR}) | ||
endif() | ||
message(STATUS "Configure RPM packaging for Linux ${RPMARCH}") | ||
set(CPACK_RPM_PACKAGE_ARCHITECTURE ${RPMARCH}) | ||
set(CPACK_RPM_COMPONENT_INSTALL ON) | ||
set(CPACK_RPM_FILE_NAME RPM-DEFAULT) | ||
set(CPACK_RPM_LIB_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) # avoid "-lib" suffix for "lib" package | ||
|