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

Pull Request: Add Option for Building a Specific Package #34

Closed
wants to merge 7 commits into from
Closed
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
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'ROS 2 CI'
name: 'mjlee111 ROS 2 CI'
description: 'Continuous integration for ROS 2 project'
author: "ICHIRO ITS"
author: "mjlee111"
branding:
icon: "activity"
color: "gray-dark"
Expand Down Expand Up @@ -36,6 +36,9 @@ inputs:
post-test:
description: "The command to be run after the test process."
required: false
specific-package:
description: "The command to only build specified package."
required: false
runs:
using: 'docker'
image: 'dind/Dockerfile'
Expand All @@ -50,3 +53,4 @@ runs:
- '${{ inputs.post-build }}'
- '${{ inputs.pre-test }}'
- '${{ inputs.post-test }}'
- '${{ inputs.specific-package }}'
3 changes: 2 additions & 1 deletion dind/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PRE_BUILD="${7}"
POST_BUILD="${8}"
PRE_TEST="${9}"
POST_TEST="${10}"

SPECIFIC_PACKAGE="${11}"
echo ''
echo '======== Running the Docker daemon ========'
echo ''
Expand Down Expand Up @@ -43,4 +43,5 @@ docker run \
--env POST_BUILD="${POST_BUILD}" \
--env PRE_TEST="${PRE_TEST}" \
--env POST_TEST="${POST_TEST}" \
--env SPECIFIC_PACKAGE="${SPECIFIC_PACKAGE}" \
--rm ros2-ci:latest || exit $?
72 changes: 55 additions & 17 deletions dind/ros2/entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,30 @@ then
cd /ws/repo && echo "$PRE_BUILD" && eval "$PRE_BUILD" || exit $?
fi

echo ''
echo '======== Building the workspace ========'
echo ''
if [ -z "$SPECIFIC_PACKAGE" ]
then
echo ''
echo '======== Building the workspace ========'
echo ''

cd /ws && colcon build \
--event-handlers console_cohesion+ \
--cmake-args || exit $?
cd /ws && colcon build \
--event-handlers console_cohesion+ \
--cmake-args || exit $?

source install/setup.bash || exit $?
source install/setup.bash || exit $?
fi

if [ ! -z "$SPECIFIC_PACKAGE" ]
then
echo ''
echo '======== Building the specific package ========'
echo ''

cd /ws && colcon build \
--packages-select $SPECIFIC_PACKAGE \
--event-handlers console_cohesion+ \
--cmake-args || exit $?
fi

if [ ! -z "$POST_BUILD" ]
then
Expand All @@ -114,20 +129,43 @@ then
cd /ws/repo && echo "$PRE_TEST" && eval "$PRE_TEST" || exit $?
fi

echo ''
echo '======== Testing the workspace ========'
echo ''
if [ ! -z "$SPECIFIC_PACKAGE" ]
then
echo ''
echo '======== Running the specific package command ========'
echo ''

cd /ws && colcon test \
--packages-select $SPECIFIC_PACKAGE \
--event-handlers console_cohesion+ \
--pytest-with-coverage \
--return-code-on-test-failure || exit $?

mkdir /ws/repo/.ws \
&& cp -r /ws/build /ws/repo/.ws \
&& cp -r /ws/log /ws/repo/.ws \
&& cp -r /ws/install /ws/repo/.ws \
|| exit $?
fi

cd /ws && colcon test \
--event-handlers console_cohesion+ \
if [ -z "$SPECIFIC_PACKAGE" ]
then

echo ''
echo '======== Testing the workspace ========'
echo ''

cd /ws && colcon test \
--event-handlers console_cohesion+ \
--pytest-with-coverage \
--return-code-on-test-failure || exit $?

mkdir /ws/repo/.ws \
&& cp -r /ws/build /ws/repo/.ws \
&& cp -r /ws/log /ws/repo/.ws \
&& cp -r /ws/install /ws/repo/.ws \
|| exit $?
mkdir /ws/repo/.ws \
&& cp -r /ws/build /ws/repo/.ws \
&& cp -r /ws/log /ws/repo/.ws \
&& cp -r /ws/install /ws/repo/.ws \
|| exit $?
fi

if [ ! -z "$POST_TEST" ]
then
Expand Down
Loading