From 8ed21e3c58095e39621c9a592da300d2a472955b Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Tue, 4 Jun 2024 23:48:41 +0200 Subject: [PATCH 1/2] Add deb builder for ArduPilot version --- .gitignore | 3 +++ ap-microxrceddsgen/DEBIAN/control | 12 ++++++++++ .../ardupilot/Micro-XRCE-DDS-Gen/bin/.gitkeep | 0 .../share/microxrceddsgen/java/.gitkeep | 0 .../share/doc/ap-microxrceddsgen/copyright | 9 ++++++++ build-ap-microxrceddsgen-deb.sh | 23 +++++++++++++++++++ 6 files changed, 47 insertions(+) create mode 100644 ap-microxrceddsgen/DEBIAN/control create mode 100644 ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/.gitkeep create mode 100644 ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/share/microxrceddsgen/java/.gitkeep create mode 100644 ap-microxrceddsgen/usr/share/doc/ap-microxrceddsgen/copyright create mode 100755 build-ap-microxrceddsgen-deb.sh diff --git a/.gitignore b/.gitignore index 7b94849..cbe127b 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,6 @@ gradle-app.setting # VSC .devcontainer + +# deb +*.deb diff --git a/ap-microxrceddsgen/DEBIAN/control b/ap-microxrceddsgen/DEBIAN/control new file mode 100644 index 0000000..6350955 --- /dev/null +++ b/ap-microxrceddsgen/DEBIAN/control @@ -0,0 +1,12 @@ +Package: ap-microxrceddsgen +Version: 0.0.1 +Priority: optional +Architecture: all +Section: misc +Depends: default-jre | openjdk-11-jre +Maintainer: ArduPilot +Description: eProsima Fast DDS Gen ArduPilot patched + eProsima Fast DDS Gen with ArduPilot Patch +Homepage: https://github.com/ArduPilot/Micro-XRCE-DDS-Gen +Conflicts: ap-microxrceddsgen +Provides: ap-microxrceddsgen diff --git a/ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/.gitkeep b/ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/share/microxrceddsgen/java/.gitkeep b/ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/share/microxrceddsgen/java/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ap-microxrceddsgen/usr/share/doc/ap-microxrceddsgen/copyright b/ap-microxrceddsgen/usr/share/doc/ap-microxrceddsgen/copyright new file mode 100644 index 0000000..9b6403d --- /dev/null +++ b/ap-microxrceddsgen/usr/share/doc/ap-microxrceddsgen/copyright @@ -0,0 +1,9 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: * +Copyright: 2022, Proyectos y Sistemas de Mantenimiento SL (eProsima) +License: Apache-2.0 + +License: Apache-2.0 + On Debian systems, the full text of the Apache-2.0 license + can be found in the file '/usr/share/common-licenses/Apache-2.0' diff --git a/build-ap-microxrceddsgen-deb.sh b/build-ap-microxrceddsgen-deb.sh new file mode 100755 index 0000000..81db26a --- /dev/null +++ b/build-ap-microxrceddsgen-deb.sh @@ -0,0 +1,23 @@ +#!/bin/sh +VERSION="0.0.1" + +echo "Copying launcher" +cp scripts/microxrceddsgen ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/microxrceddsgen + +echo "Setting permissions for the launcher" +chmod 755 ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/microxrceddsgen + +echo "Copying jar" +cp share/microxrceddsgen/java/microxrceddsgen.jar ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/share/microxrceddsgen/java + +echo "Setting permissions for the jar" +chmod 644 ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/share/microxrceddsgen/java/microxrceddsgen.jar + +echo "Generating .deb" +dpkg-deb --root-owner-group --build ap-microxrceddsgen "ap_microxrceddsgen_${VERSION}_all.deb" + +echo "Package information:" +dpkg-deb --info "ap_microxrceddsgen_${VERSION}_all.deb" + +echo "Package contents:" +dpkg-deb --contents "ap_microxrceddsgen_${VERSION}_all.deb" From 8a8de452aafab6421b3a45f7fe4f55f5aa59f821 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Wed, 5 Jun 2024 00:03:56 +0200 Subject: [PATCH 2/2] add release builder --- .github/workflows/release.yml | 66 +++++++++++++++++++++++++++++++++ build-ap-microxrceddsgen-deb.sh | 11 +++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2503cda --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +# This workflow will build deb binary + +name: Build deb binary + +on: + release: + types: [published] + + workflow_dispatch: + +jobs: + get-ref-name: + runs-on: ubuntu-latest + outputs: + ref_name: ${{ steps.get-ref-name.outputs.ref_name }} + steps: + - name: Get ref_name + id: get-ref-name + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + sanitized_ref=$(echo ${{ github.head_ref }} | sed 's/[^a-zA-Z0-9.]/-/g') + else + sanitized_ref=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9.]/-/g') + fi + echo "ref_name=$sanitized_ref" + echo "ref_name=$sanitized_ref" >> $GITHUB_OUTPUT || exit 1 + build: + needs: get-ref-name + name: Build deb + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + path: src/microxrceddsgen + submodules: recursive + + - uses: ./src/microxrceddsgen/.github/actions/install-apt-packages + + - name: Get minimum supported version of CMake + uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.16.3 + - name: Use cmake + run: cmake --version + + - name: Build microxrceddsgen + run: | + cd src/microxrceddsgen + ./gradlew assemble + + - name: Test microxrceddsgen + run: | + cd src/microxrceddsgen + ./gradlew test -Dbranch=v2.3.0 + + - name : Build deb + run: | + cd src/microxrceddsgen + rm -rf .github + ./build-ap-microxrceddsgen-deb.sh ${{ needs.get-ref-name.outputs.ref_name }} + + - name: "Publish to GitHub" + uses: softprops/action-gh-release@v2 + with: + files: src/microxrceddsgen/ap_microxrceddsgen_*.deb diff --git a/build-ap-microxrceddsgen-deb.sh b/build-ap-microxrceddsgen-deb.sh index 81db26a..baa78d7 100755 --- a/build-ap-microxrceddsgen-deb.sh +++ b/build-ap-microxrceddsgen-deb.sh @@ -1,5 +1,14 @@ #!/bin/sh -VERSION="0.0.1" + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +VERSION="$1" + +echo "Updating control file with version $VERSION" +sed -i "s/^Version: .*/Version: $VERSION/" ap-microxrceddsgen/DEBIAN/control echo "Copying launcher" cp scripts/microxrceddsgen ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/microxrceddsgen