From 1432e4441ab9e185f9d287a793120d590b2bfe6a Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 4 Jul 2023 12:31:42 +0000 Subject: [PATCH 1/9] Use dedicated build for noetic main --- .github/workflows/ci.yml | 63 ------------------------ .github/workflows/ci_format.yml | 18 +++++++ .github/workflows/noetic-binary-main.yml | 22 +++++++++ .github/workflows/reusable_ici.yml | 49 ++++++++++++++++++ ur_robot_driver/launch/ur_control.launch | 4 +- ur_robot_driver/test/driver.test | 3 ++ 6 files changed, 94 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/ci_format.yml create mode 100644 .github/workflows/noetic-binary-main.yml create mode 100644 .github/workflows/reusable_ici.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index b03c613a9..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Industrial CI pipeline -on: - push: - pull_request: - schedule: - - cron: '0 7 * * *' - - -jobs: - format_check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: 'ros-industrial/industrial_ci@master' - env: - ROS_DISTRO: melodic - CLANG_FORMAT_CHECK: file - CLANG_FORMAT_VERSION: "9" - - build: - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.env.experimental }} - strategy: - fail-fast: false - matrix: - env: - - ROS_DISTRO: melodic - ROS_REPO: main - UPSTREAM_WORKSPACE: .melodic.rosinstall - DOCKER_RUN_OPTS: --network static_test_net - BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101' - IMMEDIATE_TEST_OUTPUT: true - experimental: false - - ROS_DISTRO: noetic - ROS_REPO: main - UPSTREAM_WORKSPACE: .noetic.rosinstall - DOCKER_RUN_OPTS: --network static_test_net - BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101' - IMMEDIATE_TEST_OUTPUT: true - experimental: false - - ROS_DISTRO: melodic - ROS_REPO: testing - UPSTREAM_WORKSPACE: .melodic.rosinstall - DOCKER_RUN_OPTS: --network static_test_net - BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101' - IMMEDIATE_TEST_OUTPUT: true - experimental: true - - ROS_DISTRO: noetic - ROS_REPO: testing - UPSTREAM_WORKSPACE: .noetic.rosinstall - DOCKER_RUN_OPTS: --network static_test_net - BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101' - IMMEDIATE_TEST_OUTPUT: true - experimental: true - - steps: - - uses: actions/checkout@v1 - - name: start ursim - run: | - .github/dockerursim/build_and_run_docker_ursim.sh - - uses: 'ros-industrial/industrial_ci@master' - env: ${{matrix.env}} diff --git a/.github/workflows/ci_format.yml b/.github/workflows/ci_format.yml new file mode 100644 index 000000000..073a6f280 --- /dev/null +++ b/.github/workflows/ci_format.yml @@ -0,0 +1,18 @@ +name: Clang-Format check +on: + push: + pull_request: + branches: + - main + +jobs: + format_check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: 'ros-industrial/industrial_ci@master' + env: + ROS_DISTRO: noetic + CLANG_FORMAT_CHECK: file + CLANG_FORMAT_VERSION: "9" diff --git a/.github/workflows/noetic-binary-main.yml b/.github/workflows/noetic-binary-main.yml new file mode 100644 index 000000000..e2303d0cd --- /dev/null +++ b/.github/workflows/noetic-binary-main.yml @@ -0,0 +1,22 @@ +name: Noetic Binary Build Main +on: + workflow_dispatch: + branches: + - master + pull_request: + branches: + - master + push: + branches: + - master + schedule: + # Run every morning to detect flakiness and broken dependencies + - cron: '32 5 * * *' + +jobs: + binary: + uses: ./.github/workflows/reusable_ici.yml + with: + ros_distro: noetic + ros_repo: main + ref_for_scheduled_build: master diff --git a/.github/workflows/reusable_ici.yml b/.github/workflows/reusable_ici.yml new file mode 100644 index 000000000..05aa2227c --- /dev/null +++ b/.github/workflows/reusable_ici.yml @@ -0,0 +1,49 @@ +name: Reusable industrial_ci workflow +# original author: Denis Štogl + +on: + workflow_call: + inputs: + ref_for_scheduled_build: + description: 'Reference on which the repo should be checkout for scheduled build. Usually is this name of a branch or a tag.' + default: '' + required: false + type: string + + upstream_workspace: + description: 'UPSTREAM_WORKSPACE variable for industrial_ci. Usually path to local .repos file.' + default: '' + required: false + type: string + ros_distro: + description: 'ROS_DISTRO variable for industrial_ci' + required: false + type: string + ros_repo: + description: 'ROS_REPO to run for industrial_ci. Possible values: "main", "testing"' + default: 'main' + required: false + type: string + +jobs: + reusable_ici: + name: ${{ inputs.ros_distro }} ${{ inputs.ros_repo }} ${{ inputs.os_code_name }} + runs-on: ubuntu-latest + env: + DOCKER_RUN_OPTS: '-v /var/run/docker.sock:/var/run/docker.sock --network ursim_net' + steps: + - name: Checkout ${{ inputs.ref }} when build is not scheduled + if: ${{ github.event_name != 'schedule' }} + uses: actions/checkout@v3 + - name: Checkout ${{ inputs.ref }} on scheduled build + if: ${{ github.event_name == 'schedule' }} + uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref_for_scheduled_build }} + - run: docker network create --subnet=192.168.56.0/24 ursim_net + - uses: 'ros-industrial/industrial_ci@master' + env: + UPSTREAM_WORKSPACE: ${{ inputs.upstream_workspace }} + ROS_DISTRO: ${{ inputs.ros_distro }} + ROS_REPO: ${{ inputs.ros_repo }} + CMAKE_ARGS: -DUR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS=ON diff --git a/ur_robot_driver/launch/ur_control.launch b/ur_robot_driver/launch/ur_control.launch index 161b4cc43..c98baf09b 100644 --- a/ur_robot_driver/launch/ur_control.launch +++ b/ur_robot_driver/launch/ur_control.launch @@ -75,11 +75,11 @@ + output="screen" args="$(arg controllers) --timeout 600" /> + output="screen" args="--stopped $(arg stopped_controllers) --timeout 600" unless="$(eval arg('stopped_controllers') == '')"/> diff --git a/ur_robot_driver/test/driver.test b/ur_robot_driver/test/driver.test index e8ec1f72c..c96aa0b43 100644 --- a/ur_robot_driver/test/driver.test +++ b/ur_robot_driver/test/driver.test @@ -12,6 +12,9 @@ + + + From 9503132c79775fdb50022a420e0b220bcdf8d2f8 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 4 Jul 2023 12:42:53 +0000 Subject: [PATCH 2/9] Add docker.io as test dependency --- ur_robot_driver/package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ur_robot_driver/package.xml b/ur_robot_driver/package.xml index 73f67fba1..5f346ae95 100644 --- a/ur_robot_driver/package.xml +++ b/ur_robot_driver/package.xml @@ -57,6 +57,7 @@ ur_description velocity_controllers + docker.io rostest From b5a2e9a5bf28967a3ede1f18f37ef11c81a4ac5b Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Wed, 5 Jul 2023 05:29:03 +0000 Subject: [PATCH 3/9] Fix branch for ci_format job --- .github/workflows/ci_format.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_format.yml b/.github/workflows/ci_format.yml index 073a6f280..a9bc5adaa 100644 --- a/.github/workflows/ci_format.yml +++ b/.github/workflows/ci_format.yml @@ -1,9 +1,11 @@ name: Clang-Format check on: push: + branches: + - master pull_request: branches: - - main + - master jobs: format_check: From e0c23cc5adf4fa58fef4868c14a89a4d0cb7f891 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Wed, 5 Jul 2023 08:46:13 +0000 Subject: [PATCH 4/9] pass rosinstall file to ci job --- .github/workflows/noetic-binary-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/noetic-binary-main.yml b/.github/workflows/noetic-binary-main.yml index e2303d0cd..d05c3874d 100644 --- a/.github/workflows/noetic-binary-main.yml +++ b/.github/workflows/noetic-binary-main.yml @@ -20,3 +20,4 @@ jobs: ros_distro: noetic ros_repo: main ref_for_scheduled_build: master + upstream_workspace: .noetic.rosinstall From 3a6d571c2d3f471c45a28b67478e42b5227f7cf8 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 6 Jul 2023 04:17:50 +0000 Subject: [PATCH 5/9] Increase timeout waiting for first action server --- ur_robot_driver/test/integration_test.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ur_robot_driver/test/integration_test.py b/ur_robot_driver/test/integration_test.py index c15a8cdf4..1de325dbf 100755 --- a/ur_robot_driver/test/integration_test.py +++ b/ur_robot_driver/test/integration_test.py @@ -53,42 +53,45 @@ def init_robot(self): """Make sure the robot is booted and ready to receive commands""" rospy.init_node('ur_robot_driver_integration_test') + # In CI we pull the docker image when this test is started. So, we wait a little longer for + # the first service... + initial_timeout = rospy.Duration(300) timeout = rospy.Duration(30) self.set_mode_client = actionlib.SimpleActionClient( '/ur_hardware_interface/set_mode', SetModeAction) - if not self.set_mode_client.wait_for_server(timeout): + if not self.set_mode_client.wait_for_server(initial_timeout): self.fail( "Could not reach set_mode action. Make sure that the driver is actually running." - " Msg: {}".format(err)) + ) self.trajectory_client = actionlib.SimpleActionClient( 'follow_joint_trajectory', FollowJointTrajectoryAction) if not self.trajectory_client.wait_for_server(timeout): self.fail( "Could not reach controller action. Make sure that the driver is actually running." - " Msg: {}".format(err)) + ) self.cartesian_passthrough_trajectory_client = actionlib.SimpleActionClient( 'forward_cartesian_trajectory', FollowCartesianTrajectoryAction) if not self.cartesian_passthrough_trajectory_client.wait_for_server(timeout): self.fail( "Could not reach cartesian passthrough controller action. Make sure that the driver is actually running." - " Msg: {}".format(err)) + ) self.joint_passthrough_trajectory_client = actionlib.SimpleActionClient( 'forward_joint_trajectory', FollowJointTrajectoryAction) if not self.joint_passthrough_trajectory_client.wait_for_server(timeout): self.fail( "Could not reach joint passthrough controller action. Make sure that the driver is actually running." - " Msg: {}".format(err)) + ) self.cartesian_trajectory_client = actionlib.SimpleActionClient( 'follow_cartesian_trajectory', FollowCartesianTrajectoryAction) if not self.cartesian_trajectory_client.wait_for_server(timeout): self.fail( "Could not reach cartesian controller action. Make sure that the driver is actually running." - " Msg: {}".format(err)) + ) self.set_io_client = rospy.ServiceProxy('/ur_hardware_interface/set_io', SetIO) try: From ffbb9dc68819fb046e26dafd363660563c16ec71 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 6 Jul 2023 05:07:52 +0000 Subject: [PATCH 6/9] Add full noetic build matrix --- .github/workflows/noetic-binary-main.yml | 1 - .github/workflows/noetic-binary-testing.yml | 22 ++++++++++++++++++ .github/workflows/noetic-semi-binary-main.yml | 23 +++++++++++++++++++ .../workflows/noetic-semi-binary-testing.yml | 23 +++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/noetic-binary-testing.yml create mode 100644 .github/workflows/noetic-semi-binary-main.yml create mode 100644 .github/workflows/noetic-semi-binary-testing.yml diff --git a/.github/workflows/noetic-binary-main.yml b/.github/workflows/noetic-binary-main.yml index d05c3874d..e2303d0cd 100644 --- a/.github/workflows/noetic-binary-main.yml +++ b/.github/workflows/noetic-binary-main.yml @@ -20,4 +20,3 @@ jobs: ros_distro: noetic ros_repo: main ref_for_scheduled_build: master - upstream_workspace: .noetic.rosinstall diff --git a/.github/workflows/noetic-binary-testing.yml b/.github/workflows/noetic-binary-testing.yml new file mode 100644 index 000000000..16e2dc075 --- /dev/null +++ b/.github/workflows/noetic-binary-testing.yml @@ -0,0 +1,22 @@ +name: Noetic Binary Build Main +on: + workflow_dispatch: + branches: + - master + pull_request: + branches: + - master + push: + branches: + - master + schedule: + # Run every morning to detect flakiness and broken dependencies + - cron: '32 5 * * *' + +jobs: + binary: + uses: ./.github/workflows/reusable_ici.yml + with: + ros_distro: noetic + ros_repo: testing + ref_for_scheduled_build: master diff --git a/.github/workflows/noetic-semi-binary-main.yml b/.github/workflows/noetic-semi-binary-main.yml new file mode 100644 index 000000000..d05c3874d --- /dev/null +++ b/.github/workflows/noetic-semi-binary-main.yml @@ -0,0 +1,23 @@ +name: Noetic Binary Build Main +on: + workflow_dispatch: + branches: + - master + pull_request: + branches: + - master + push: + branches: + - master + schedule: + # Run every morning to detect flakiness and broken dependencies + - cron: '32 5 * * *' + +jobs: + binary: + uses: ./.github/workflows/reusable_ici.yml + with: + ros_distro: noetic + ros_repo: main + ref_for_scheduled_build: master + upstream_workspace: .noetic.rosinstall diff --git a/.github/workflows/noetic-semi-binary-testing.yml b/.github/workflows/noetic-semi-binary-testing.yml new file mode 100644 index 000000000..7c38513d2 --- /dev/null +++ b/.github/workflows/noetic-semi-binary-testing.yml @@ -0,0 +1,23 @@ +name: Noetic Binary Build Main +on: + workflow_dispatch: + branches: + - master + pull_request: + branches: + - master + push: + branches: + - master + schedule: + # Run every morning to detect flakiness and broken dependencies + - cron: '32 5 * * *' + +jobs: + binary: + uses: ./.github/workflows/reusable_ici.yml + with: + ros_distro: noetic + ros_repo: testing + ref_for_scheduled_build: master + upstream_workspace: .noetic.rosinstall From 961311315d8f3f6c2f12ba760d1ce108d3c3cc65 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 6 Jul 2023 05:10:14 +0000 Subject: [PATCH 7/9] Fix workflow names --- .github/workflows/noetic-binary-testing.yml | 2 +- .github/workflows/noetic-semi-binary-main.yml | 2 +- .github/workflows/noetic-semi-binary-testing.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/noetic-binary-testing.yml b/.github/workflows/noetic-binary-testing.yml index 16e2dc075..033cc814e 100644 --- a/.github/workflows/noetic-binary-testing.yml +++ b/.github/workflows/noetic-binary-testing.yml @@ -1,4 +1,4 @@ -name: Noetic Binary Build Main +name: Noetic Binary Build Testing on: workflow_dispatch: branches: diff --git a/.github/workflows/noetic-semi-binary-main.yml b/.github/workflows/noetic-semi-binary-main.yml index d05c3874d..96f506889 100644 --- a/.github/workflows/noetic-semi-binary-main.yml +++ b/.github/workflows/noetic-semi-binary-main.yml @@ -1,4 +1,4 @@ -name: Noetic Binary Build Main +name: Noetic Semi-Binary Build Main on: workflow_dispatch: branches: diff --git a/.github/workflows/noetic-semi-binary-testing.yml b/.github/workflows/noetic-semi-binary-testing.yml index 7c38513d2..f4b1f45cb 100644 --- a/.github/workflows/noetic-semi-binary-testing.yml +++ b/.github/workflows/noetic-semi-binary-testing.yml @@ -1,4 +1,4 @@ -name: Noetic Binary Build Main +name: Noetic Semi-Binary Build Testing on: workflow_dispatch: branches: From 370b41092b9b1606fa1f81753d02ee944144b03b Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 10 Oct 2023 11:36:17 +0000 Subject: [PATCH 8/9] Make the integration test behind a compile flag Since for our integration tests we would require docker being able to spawn a new container that can't necessarily be expected in any usecase. Also, with making this optional we don't require docker as a test dependency which also makes the package a lot more lightweight. --- ur_robot_driver/CMakeLists.txt | 12 +++++++++++- ur_robot_driver/package.xml | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ur_robot_driver/CMakeLists.txt b/ur_robot_driver/CMakeLists.txt index f1e2ff82b..6921fe09a 100644 --- a/ur_robot_driver/CMakeLists.txt +++ b/ur_robot_driver/CMakeLists.txt @@ -8,6 +8,14 @@ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo) endif() +# Default to off as this only works in environments where a new docker container can be started with the appropriate networking, which +# might not be possible e.g. inside the buildfarm +option( + UR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS + "Build integration tests using the start_ursim script" + OFF +) + find_package(catkin REQUIRED COMPONENTS actionlib @@ -127,7 +135,9 @@ target_link_libraries(controller_stopper_node if(CATKIN_ENABLE_TESTING) find_package(rostest REQUIRED) - add_rostest(test/driver.test) + if(${UR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS}) + add_rostest(test/driver.test) + endif() endif() diff --git a/ur_robot_driver/package.xml b/ur_robot_driver/package.xml index 5f346ae95..73f67fba1 100644 --- a/ur_robot_driver/package.xml +++ b/ur_robot_driver/package.xml @@ -57,7 +57,6 @@ ur_description velocity_controllers - docker.io rostest From fe9bcfeee7960b2f726f6feec2d20aa9e78283b3 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 10 Oct 2023 12:15:08 +0000 Subject: [PATCH 9/9] Install docker.io inside ci container --- .github/workflows/reusable_ici.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reusable_ici.yml b/.github/workflows/reusable_ici.yml index 05aa2227c..0e7548979 100644 --- a/.github/workflows/reusable_ici.yml +++ b/.github/workflows/reusable_ici.yml @@ -31,6 +31,7 @@ jobs: runs-on: ubuntu-latest env: DOCKER_RUN_OPTS: '-v /var/run/docker.sock:/var/run/docker.sock --network ursim_net' + ADDITIONAL_DEBS: 'docker.io' steps: - name: Checkout ${{ inputs.ref }} when build is not scheduled if: ${{ github.event_name != 'schedule' }}