-
Notifications
You must be signed in to change notification settings - Fork 23
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 #11 from Auterion/ci-debian-package
Build debian packages in CI
- Loading branch information
Showing
5 changed files
with
121 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>.*<\/version>/<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 }} |
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,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" ] |
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 @@ | ||
px4_msgs: | ||
ubuntu: | ||
- ros-foxy-px4-msgs |
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 @@ | ||
px4_msgs: | ||
ubuntu: | ||
- ros-humble-px4-msgs |
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 @@ | ||
px4_msgs: | ||
ubuntu: | ||
- ros-rolling-px4-msgs |