Skip to content

add ci config

add ci config #30

Workflow file for this run

#TODO fix file name and "name:" like "build and test"
name: build_and_test
on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize ]
jobs:
build_and_test:
runs-on: ubuntu-latest
container:
image: osrf/ros:${{ matrix.ros_distribution }}-desktop
timeout-minutes: 3
strategy:
fail-fast: false
matrix:
ros_distribution: [humble]
comm-target: [native , mros]
comm-data-type: [string, twist]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: update
run: sudo apt-get update
- name: setup and install tools
run: >
sudo apt-get install -y iproute2 git wget build-essential gcc g++ libssl-dev libreadline-dev
zlib1g-dev make autoconf automake cmake pkg-config curl net-tools netcat python3-jinja2
- name: Clone Test Stub
uses: actions/checkout@v3
with:
repository: mROS-base/mros2-host-examples
path: ws_host/src/mros2-host-examples
- name: Update IP address
run: |
chmod +x update_ip.sh
./update_ip.sh
- name: Generate Twist Header files
if: matrix.comm-data-type == 'twist'
shell: bash
run: |
cd workspace
python3 ../mros2/mros2_header_generator/header_generator.py geometry_msgs/msg/Twist.msg
cd -
- name: Build mROS
shell: bash
run: |
bash build.bash clean
bash build.bash all test/mros2/test_echoback_${{ matrix.comm-data-type }}
mv cmake_build/ test_echoback_${{ matrix.comm-data-type }}/
- name: Build Native ROS responder
if: matrix.comm-target == 'native'
shell: bash
run: |
cd ws_host/
source /opt/ros/humble/setup.bash
colcon build --packages-select mros2_echoreply_${{ matrix.comm-data-type }}
- name: Build mROS responder
if: matrix.comm-target == 'mros'
shell: bash
run: |
bash build.bash clean
bash build.bash all test/mros2/test_echoback_${{ matrix.comm-data-type }}_responder
- name: Run Testing mROS and Native ROS
if: matrix.comm-target == 'native'
shell: bash
run : |
./test_echoback_${{ matrix.comm-data-type }}/mros2-posix &
mros_pid=$! # get mROS process id
# Run Native ROS in background
cd ws_host/
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 run mros2_echoreply_${{ matrix.comm-data-type }} echoreply_node &
# Wait until mROS finishes
wait $mros_pid
mros_status=$?
# Judge CI success based on results
if [ $mros_status -eq 0 ] ;then
echo "Succeed pub/sub test process between mros2 and Native ROS"
exit 0
else
echo "Fail pub/sub test process between mros2 and Native ROS"
exit 1
fi
- name: Run mROS and mROS
if: matrix.comm-target == 'mros'
shell: bash
run : |
./test_echoback_${{ matrix.comm-data-type }}/mros2-posix &
mros_pid=$! # get mROS process id
# Run mROS responder in background
./cmake_build/mros2-posix &
# Wait until mROS finishes
wait $mros_pid
mros_status=$?
# Judge CI success based on results
if [ $mros_status -eq 0 ] ;then
echo "Succeed pub/sub test process between mros2 and mros2"
exit 0
else
echo "Fail pub/sub test process between mros2 and mros2"
exit 1
fi