Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable github workflows to rolling branch. (backport #52) #53

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/humble.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is workflow for humble distribution
name: humble

# Because of rcl_logging interface, rcl_logging_syslog has each distribution branch.
on:
push:
branches: [ "humble" ]
pull_request:
branches: [ "humble" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# each job goes for each ros supported distribution.
# each job description absorb the distribution dependency as much as possible,
# so that build/test verification script can be agnostic from distribution dependency.

build:
runs-on: ubuntu-latest
container:
image: ros:humble
env:
ROS_DISTRO: humble
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build and Test with ROS humble
shell: bash
run: |
./scripts/github_workflows.sh
33 changes: 33 additions & 0 deletions .github/workflows/iron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is workflow for iron distribution
name: iron

# Because of rcl_logging interface, rcl_logging_syslog has each distribution branch.
on:
push:
branches: [ "iron" ]
pull_request:
branches: [ "iron" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# each job goes for each ros supported distribution.
# each job description absorb the distribution dependency as much as possible,
# so that build/test verification script can be agnostic from distribution dependency.

build:
runs-on: ubuntu-latest
container:
image: ros:iron
env:
ROS_DISTRO: iron
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build and Test with ROS iron
shell: bash
run: |
./scripts/github_workflows.sh
33 changes: 33 additions & 0 deletions .github/workflows/jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is workflow for jazzy distribution
name: jazzy

# Because of rcl_logging interface, rcl_logging_syslog has each distribution branch.
on:
push:
branches: [ "jazzy" ]
pull_request:
branches: [ "jazzy" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# each job goes for each ros supported distribution.
# each job description absorb the distribution dependency as much as possible,
# so that build/test verification script can be agnostic from distribution dependency.

build:
runs-on: ubuntu-latest
container:
image: ros:jazzy
env:
ROS_DISTRO: jazzy
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build and Test with ROS jazzy
shell: bash
run: |
./scripts/github_workflows.sh
33 changes: 33 additions & 0 deletions .github/workflows/rolling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is workflow for rolling distribution
name: rolling

# Because of rcl_logging interface, rcl_logging_syslog has each distribution branch.
on:
push:
branches: [ "rolling" ]
pull_request:
branches: [ "rolling" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# each job goes for each ros supported distribution.
# each job description absorb the distribution dependency as much as possible,
# so that build/test verification script can be agnostic from distribution dependency.

build:
runs-on: ubuntu-latest
container:
image: ros:rolling
env:
ROS_DISTRO: rolling
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Build and Test with ROS rolling
shell: bash
run: |
./scripts/github_workflows.sh
113 changes: 113 additions & 0 deletions scripts/github_workflows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash

#####################################################################
# rcl_logging_syslog rcl logging implementation via rsyslog/syslog.
#
# This script builds and tests it within ros distro public docker images.
#
# To avoid updating and modifying the files under `.github/workflows`,
# this scripts should be adjusted workflow process accordingly.
# And `.github/workflows` just calls this script in the workflow pipeline.
# This allows us to maintain the workflow process easier for contributors.
#
#####################################################################

########################
# Function Definitions #
########################

function mark {
export $1=`pwd`;
}

function exit_trap() {
# shellcheck disable=SC2317 # Don't warn about unreachable commands in this function
if [ $? != 0 ]; then
echo "Command [$BASH_COMMAND] is failed"
exit 1
fi
}

function install_prerequisites () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: update and install dependent packages."
apt update && apt upgrade -y
apt install -y git
# TODO(@fujitatomoya) probably we should use rosdep to install dependencies to build
apt install -y ros-rolling-mimick-vendor ros-rolling-performance-test-fixture ros-rolling-test-msgs
#apt install -y ros-${ROS_DISTRO}-desktop --no-install-recommends
cd $there
}

function setup_colcon_env () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: set up colcon build environment."
mkdir -p ${COLCON_WORKSPACE}/src
# fetch rcl repository in local file system to build with rcl_logging_syslog.
# currently no dynamic loading is supported with rcl_logging, so we need to build rcl together.
# see more details for https://github.com/ros2/rcl/issues/1178
git clone -b ${ROS_DISTRO} https://github.com/ros2/rcl.git ${COLCON_WORKSPACE}/src/rcl
# move rcl_logging_syslog directory to colcon workspace
cd ${COLCON_WORKSPACE}
cp -rf $there ${COLCON_WORKSPACE}/src
}

function setup_rsyslog () {
# this is required basically only for container environment.
# for security reason, container does not have system service or daemon processes.
# just for the test with rsyslog, it installs rsyslog and start the rsyslog daemon.
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: install and setup rsyslogd."
apt update && apt upgrade -y
apt install -y rsyslog
# permission setting for rsyslog file sink for the test.
mkdir -p /var/log/ros
chown syslog:adm /var/log/ros
# copy the rsyslogd configuration file for the test
cd ${COLCON_WORKSPACE}
cp ./src/rcl_logging_syslog/config/ros2-test.conf /etc/rsyslog.d/
rsyslogd -N1
# start the rsyslogd daemon in the background process.
/usr/sbin/rsyslogd -n -iNONE &
}

function build_colcon_package () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: build rcl and rcl_logging_syslog packages."
source /opt/ros/${ROS_DISTRO}/setup.bash
cd ${COLCON_WORKSPACE}
export RCL_LOGGING_IMPLEMENTATION=rcl_logging_syslog
colcon build --symlink-install --cmake-clean-cache --packages-select rcl_logging_syslog rcl
}

function test_colcon_package () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: test rcl_logging_syslog packages."
# source local workspace projects
cd ${COLCON_WORKSPACE}
source ./install/local_setup.bash
# initiate the colcon test
colcon test --event-handlers console_direct+ --packages-select rcl_logging_syslog
}

########
# Main #
########

export DEBIAN_FRONTEND=noninteractive
export COLCON_WORKSPACE=/tmp/colcon_ws

# mark the working space root directory, so that we can come back anytime with `cd $there`
mark there

# set the trap on error
trap exit_trap ERR

# call install functions in sequence
install_prerequisites
setup_colcon_env
setup_rsyslog
build_colcon_package
test_colcon_package

exit 0
Loading