diff --git a/.github/workflows/build-publish-debian-packages.yml b/.github/workflows/build-publish-debian-packages.yml new file mode 100644 index 0000000..e1f25e1 --- /dev/null +++ b/.github/workflows/build-publish-debian-packages.yml @@ -0,0 +1,72 @@ +name: Build publish debian packages + +on: + release: + types: [published] + pull_request: + branches: + - '*' + +jobs: + build: + name: Build debian packages + runs-on: ubuntu-latest + strategy: + matrix: + platform: [linux/amd64, linux/arm64] + distro: + - ubuntu: jammy + ros2: humble + - ubuntu: jammy + ros2: rolling + - ubuntu: focal + ros2: foxy + + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set version + if: ${{ github.event_name == 'release' }} + run: sed -i "s/.*<\/version>/${{ github.event.release.tag_name }}<\/version>/" px4_ros2_cpp/package.xml + + - name: Build build environment + run: | + docker build . -f Dockerfile.debian-buildenv \ + --platform ${{ matrix.platform }} \ + --build-arg="ROS2_DISTRO=${{ matrix.distro.ros2 }}" \ + --build-arg="UBUNTU_DISTRO=${{ matrix.distro.ubuntu }}" \ + -t buildenv:current + + - name: Build debian packages + working-directory: px4_ros2_cpp + run: | + docker run --rm -v .:/work --platform ${{ matrix.platform }} buildenv:current + + - name: Upload artifacts to github actions + uses: actions/upload-artifact@v3 + with: + name: debian-packages + path: px4_ros2_cpp/output/*.deb + + + - name: Generate upload information + run: | + echo "DEBIAN_PACKAGE=$(ls px4_ros2_cpp/output/ | grep '\.deb')" >> $GITHUB_ENV + + - run: | + echo "DEBIAN PACKAGE FILE: ${{ env.DEBIAN_PACKAGE }}" + + - name: Push package to cloudsmith + if: ${{ github.event_name == 'release' }} + uses: cloudsmith-io/action@master + with: + api-key: ${{ secrets.AUTERION_CI_CLOUDSMITH_API_KEY }} + command: 'push' + format: 'deb' + owner: auterion + repo: public + distro: ubuntu + release: ${{ matrix.distro.ubuntu }} + file: px4_ros2_cpp/output/${{ env.DEBIAN_PACKAGE }} diff --git a/Dockerfile.debian-buildenv b/Dockerfile.debian-buildenv new file mode 100644 index 0000000..1607b64 --- /dev/null +++ b/Dockerfile.debian-buildenv @@ -0,0 +1,40 @@ +# Dockerfile for a build environment to build Debian packages + +ARG ROS2_DISTRO +ARG UBUNTU_DISTRO + +FROM ros:${ROS2_DISTRO}-ros-base-${UBUNTU_DISTRO} + +# Re-request ARGs to make them available in this stage +ARG ROS2_DISTRO + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA +RUN apt update && apt install -y \ + dh-make \ + python3-bloom \ + python3-rosdep \ + fakeroot \ + dh-python + +# Add auterion cloudsmith +RUN curl -1sLf \ + 'https://dl.cloudsmith.io/public/auterion/public/setup.deb.sh' \ + | bash + +RUN echo "yaml file:///work/rosdep-${ROS2_DISTRO}.yaml" > /etc/ros/rosdep/sources.list.d/99-local.list + +RUN echo "#!/bin/bash" > /build_package.sh && \ + echo "cd /work" >> /build_package.sh && \ + echo "rosdep init" >> /build_package.sh && \ + echo "rosdep update --rosdistro=$ROS2_DISTRO" >> /build_package.sh && \ + echo "rosdep install --from-paths ." >> /build_package.sh && \ + echo "bloom-generate rosdebian" >> /build_package.sh && \ + echo "fakeroot debian/rules binary" >> /build_package.sh && \ + echo "mkdir -p /work/output" >> /build_package.sh && \ + echo "cp ../*.deb /work/output" >> /build_package.sh && \ + chmod +x /build_package.sh + +WORKDIR /work + +CMD [ "/ros_entrypoint.sh", "/build_package.sh" ] diff --git a/px4_ros2_cpp/rosdep-foxy.yaml b/px4_ros2_cpp/rosdep-foxy.yaml new file mode 100644 index 0000000..30124ee --- /dev/null +++ b/px4_ros2_cpp/rosdep-foxy.yaml @@ -0,0 +1,3 @@ +px4_msgs: + ubuntu: + - ros-foxy-px4-msgs \ No newline at end of file diff --git a/px4_ros2_cpp/rosdep-humble.yaml b/px4_ros2_cpp/rosdep-humble.yaml new file mode 100644 index 0000000..12515b0 --- /dev/null +++ b/px4_ros2_cpp/rosdep-humble.yaml @@ -0,0 +1,3 @@ +px4_msgs: + ubuntu: + - ros-humble-px4-msgs \ No newline at end of file diff --git a/px4_ros2_cpp/rosdep-rolling.yaml b/px4_ros2_cpp/rosdep-rolling.yaml new file mode 100644 index 0000000..f56a488 --- /dev/null +++ b/px4_ros2_cpp/rosdep-rolling.yaml @@ -0,0 +1,3 @@ +px4_msgs: + ubuntu: + - ros-rolling-px4-msgs \ No newline at end of file