tempx #75
This file contains hidden or 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
| name: Build-Test | |
| # Run this workflow every time a new commit pushed to your repository | |
| on: push | |
| jobs: | |
| # Set the job key. The key is displayed as the job name | |
| # when a job name is not provided | |
| build-test: | |
| name: Build Test (${{ matrix.ros_distro }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ROS1 Noetic on x64 | |
| - ros_distro: noetic | |
| arch: amd64 | |
| runner: ubuntu-22.04 | |
| container: ros:noetic | |
| # ROS2 Humble on x64 | |
| - ros_distro: humble | |
| arch: amd64 | |
| runner: ubuntu-22.04 | |
| container: ros:humble | |
| container: ${{ matrix.container }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| # Run package update | |
| - name: Run package update | |
| run: | | |
| apt update | |
| apt dist-upgrade -y | |
| # Install dependencies (ROS1 Noetic) | |
| - name: Install dependencies (ROS1 Noetic) | |
| if: matrix.ros_distro == 'noetic' | |
| run: | | |
| apt-get install -y git qt5-default libqt5websockets5-dev \ | |
| ros-noetic-angles ros-noetic-tf ros-noetic-xmlrpcpp python-is-python3 \ | |
| libgtest-dev libgoogle-glog-dev cmake build-essential \ | |
| libgflags-dev libyaml-cpp-dev liblua5.1-0-dev \ | |
| libeigen3-dev | |
| # Install GCC 12 for ROS2 Humble | |
| - name: Install GCC 12 (ROS2 Humble) | |
| if: matrix.ros_distro == 'humble' | |
| run: | | |
| apt-get update | |
| apt-get install -y g++-12 gcc-12 | |
| update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 | |
| update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 | |
| gcc --version | |
| g++ --version | |
| # Install dependencies (ROS2 Humble) | |
| - name: Install dependencies (ROS2 Humble) | |
| if: matrix.ros_distro == 'humble' | |
| run: | | |
| apt-get install -y git qtbase5-dev libqt5websockets5-dev \ | |
| ros-humble-angles ros-humble-tf2 python3 python3-pip \ | |
| libgtest-dev libgoogle-glog-dev cmake build-essential \ | |
| libgflags-dev libyaml-cpp-dev liblua5.1-0-dev \ | |
| libeigen3-dev | |
| pip3 install colcon-common-extensions | |
| # ROSDep (ROS1) | |
| - name: ROSDep Update (ROS1) | |
| if: matrix.ros_distro == 'noetic' | |
| run: | | |
| apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential | |
| rm -f /etc/ros/rosdep/sources.list.d/20-default.list | |
| rosdep init || true | |
| rosdep update | |
| # ROSDep (ROS2) | |
| - name: ROSDep Update (ROS2) | |
| if: matrix.ros_distro == 'humble' | |
| run: | | |
| apt install -y python3-rosdep | |
| rm -f /etc/ros/rosdep/sources.list.d/20-default.list | |
| rosdep init || true | |
| rosdep update | |
| # Checkout code | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: 'recursive' | |
| # Get amrl_msgs (ROS1) | |
| - name: Get amrl_msgs (ROS1) | |
| if: matrix.ros_distro == 'noetic' | |
| run: | | |
| source /opt/ros/noetic/setup.bash | |
| export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_msgs | |
| cd $GITHUB_WORKSPACE/.. | |
| git clone https://github.com/ut-amrl/amrl_msgs.git | |
| cd amrl_msgs | |
| make | |
| # Get and build amrl_msgs (ROS2) | |
| - name: Get amrl_msgs (ROS2) | |
| if: matrix.ros_distro == 'humble' | |
| run: | | |
| source /opt/ros/humble/setup.bash | |
| cd $GITHUB_WORKSPACE/.. | |
| git clone https://github.com/ut-amrl/amrl_msgs.git | |
| cd amrl_msgs | |
| colcon build | |
| echo "AMENT_PREFIX_PATH=$GITHUB_WORKSPACE/../amrl_msgs/install:$AMENT_PREFIX_PATH" >> $GITHUB_ENV | |
| # Build webviz (ROS1) | |
| - name: Build webviz (ROS1) | |
| if: matrix.ros_distro == 'noetic' | |
| run: | | |
| source /opt/ros/noetic/setup.bash | |
| export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_msgs | |
| cd $GITHUB_WORKSPACE | |
| make | |
| # Build webviz (ROS2) | |
| - name: Build webviz (ROS2) | |
| if: matrix.ros_distro == 'humble' | |
| run: | | |
| source /opt/ros/humble/setup.bash | |
| source $GITHUB_WORKSPACE/../amrl_msgs/install/setup.bash | |
| cd $GITHUB_WORKSPACE | |
| make | |
| # Test binary execution | |
| - name: Test binary execution | |
| run: | | |
| if [ "${{ matrix.ros_distro }}" == "noetic" ]; then | |
| source /opt/ros/noetic/setup.bash | |
| export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$GITHUB_WORKSPACE:$GITHUB_WORKSPACE/../amrl_msgs | |
| elif [ "${{ matrix.ros_distro }}" == "humble" ]; then | |
| source /opt/ros/humble/setup.bash | |
| source $GITHUB_WORKSPACE/../amrl_msgs/install/setup.bash | |
| fi | |
| cd $GITHUB_WORKSPACE | |
| # Check if binary exists and is executable | |
| if [ ! -f "./bin/websocket" ]; then | |
| echo "Error: ./bin/websocket not found" | |
| exit 1 | |
| fi | |
| if [ ! -x "./bin/websocket" ]; then | |
| echo "Error: ./bin/websocket is not executable" | |
| exit 1 | |
| fi | |
| # Test binary with proper exit code handling | |
| echo "Testing websocket --help..." | |
| ./bin/websocket --help > help_output.txt 2>&1 | |
| RC=$? | |
| if [ $RC -eq 0 ] || [ $RC -eq 1 ]; then | |
| echo "✓ websocket --help completed (exit code $RC)" | |
| cat help_output.txt | |
| else | |
| echo "✗ websocket --help failed with unexpected exit code $RC" | |
| echo "--- Help output ---" | |
| cat help_output.txt | |
| echo "--- Library dependencies ---" | |
| ldd ./bin/websocket || echo "ldd failed" | |
| echo "--- Environment ---" | |
| env | grep -E "(ROS|AMENT|CONFIG)" || echo "No ROS env vars" | |
| exit $RC | |
| fi | |
| # Architecture-specific validation | |
| - name: Validate architecture build | |
| run: | | |
| cd $GITHUB_WORKSPACE | |
| file ./bin/websocket | |
| ldd ./bin/websocket || true |