diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml new file mode 100644 index 0000000..ff6fbe8 --- /dev/null +++ b/.github/workflows/colcon.yml @@ -0,0 +1,74 @@ +--- +name: colcon build/test + +on: + pull_request: + push: + branches: [humble] + +concurrency: + group: ci-${{github.workflow}}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-test: + runs-on: ubuntu-22.04 + container: ardupilot/ardupilot-dev-ros:latest + strategy: + fail-fast: false # don't cancel if a job from the matrix fails + steps: + # git checkout the PR + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + path: src/ardupilot_ros + # https://ardupilot.org/dev/docs/ros2.html#installation-ubuntu + - name: Pull in repos with vcs + run: | + cd src + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget python3-pip + wget --progress=dot:giga https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos + vcs import --recursive --debug --shallow --skip-existing < ros2_gz.repos + - name: Add Gazebo Apt Sources from packages.osrfoundation.org/gazebo + run: | + wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null + - name: Install rosdep dependencies + shell: 'bash' + run: | + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3 + # Rosdep sources for non-standard versions + # https://gazebosim.org/docs/garden/ros_installation#using-an-specific-gazebo-version-with-ros-2 + wget https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list -O /etc/ros/rosdep/sources.list.d/00-gazebo.list + rosdep update + # Workaround for flake8 attribute error + # https://github.com/ArduPilot/ardupilot/pull/24277#issuecomment-1632833433 + python3 -m pip install flake8==3.7.9 + source /opt/ros/humble/setup.bash + export GZ_VERSION=harmonic + rosdep install --from-paths src --ignore-src --default-yes --skip-keys "gz-sim7 gz-plugin2 gz-common5" + - name: Install MAVProxy + run: | + # Install this specific version just to prevent rolling updates. + # These are the latest available + python3 -m pip install MAVProxy==1.8.67 + - name: Install local pymavlink + working-directory: ./src/ardupilot/modules/mavlink/pymavlink + run: | + pip install . -U --user + - name: Build with colcon + shell: 'bash' + run: | + source /opt/ros/humble/setup.bash + export GZ_VERSION=harmonic + colcon build --packages-up-to ardupilot_ros ardupilot_gz_bringup --cmake-args -DBUILD_TESTING=ON + - name: Test with colcon + shell: 'bash' + run: | + source install/setup.bash + colcon test --packages-select ardupilot_ros --event-handlers=console_cohesion+ + - name: Report colcon test results + run: | + colcon test-result --all --verbose