From 9cbcd440eb1c0e44c954e069eac4ad62f9680e76 Mon Sep 17 00:00:00 2001 From: Fernando Cladera Date: Thu, 14 Mar 2024 17:11:12 -0400 Subject: [PATCH] build_and_test action for both ROS 1 and ROS 2 code --- .github/workflows/build_and_test.yml | 36 +++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 93802fdb..fe15a75c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -2,12 +2,14 @@ name: build-and-test on: push: - branches: [master] + branches: [master, devel/humble, devel/humble_pranav] pull_request: - branches: [master] + branches: [master, devel/humble] jobs: - build: + + ros1-build: + if: github.ref == 'refs/heads/master' strategy: matrix: ros_distro: [melodic, noetic] @@ -40,3 +42,31 @@ jobs: catkin build -j4 --no-status -DCMAKE_BUILD_TYPE=Release . ${RUNNER_WORKSPACE}/catkin_ws/devel/setup.sh catkin test + + ros2-build: + if: github.ref == 'refs/heads/devel/humble_pranav' + strategy: + matrix: + ros_distro: [humble] + + runs-on: ubuntu-latest + container: osrf/ros:${{ matrix.ros_distro }}-desktop + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + apt-get update + apt-get install -qy python3-colcon-common-extensions + rosdep update + rosdep install --from-paths . --ignore-src -y -r --rosdistro ${{ matrix.ros_distro }} + + - name: Build workspace and run tests + run: | + . /opt/ros/${{ matrix.ros_distro }}/setup.sh + mkdir -p ${RUNNER_WORKSPACE}/colcon_ws/src + cd ${RUNNER_WORKSPACE}/colcon_ws/src + ln -s ${GITHUB_WORKSPACE} + colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release + . ${RUNNER_WORKSPACE}/colcon_ws/install/setup.sh + colcon test