From 027df4f2a50051729702db297040abbbf939884b Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 24 Oct 2023 16:01:40 +0200 Subject: [PATCH 1/5] Workflow test --- .github/workflows/black.yaml | 1 - .github/workflows/bump_version.yaml | 3 +++ .github/workflows/industrial_ci.yaml | 11 ++++++++--- .github/workflows/spellcheck.yaml | 18 +++++++++--------- rosbot_xl_controller/setup.cfg | 2 ++ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml index ab5e1b3f..bd5a81f1 100644 --- a/.github/workflows/black.yaml +++ b/.github/workflows/black.yaml @@ -3,7 +3,6 @@ name: Black python lint on: workflow_call: - push: jobs: lint: diff --git a/.github/workflows/bump_version.yaml b/.github/workflows/bump_version.yaml index 862949d7..ed028903 100644 --- a/.github/workflows/bump_version.yaml +++ b/.github/workflows/bump_version.yaml @@ -12,6 +12,9 @@ on: types: [closed] jobs: + industrial_ci: + uses: ./.github/workflows/industrial_ci.yaml + get-bump: name: Get version bump runs-on: ubuntu-latest diff --git a/.github/workflows/industrial_ci.yaml b/.github/workflows/industrial_ci.yaml index 54304f4f..8867fdf7 100644 --- a/.github/workflows/industrial_ci.yaml +++ b/.github/workflows/industrial_ci.yaml @@ -2,12 +2,17 @@ name: Industrial CI on: workflow_call: - pull_request: + workflow_dispatch: push: - branches: - - master + jobs: + black_test: + uses: ./.github/workflows/black.yaml + + spellcheck_test: + uses: ./.github/workflows/spellcheck.yaml + industrial_ci: strategy: fail-fast: false diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml index a35fb0c1..84317935 100644 --- a/.github/workflows/spellcheck.yaml +++ b/.github/workflows/spellcheck.yaml @@ -1,14 +1,14 @@ +--- name: Spellcheck Action on: - workflow_call: - push: + workflow_call: jobs: - build: - name: Spellcheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: rojopolis/spellcheck-github-actions@0.33.1 - name: Spellcheck + build: + name: Spellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: rojopolis/spellcheck-github-actions@0.33.1 + name: Spellcheck diff --git a/rosbot_xl_controller/setup.cfg b/rosbot_xl_controller/setup.cfg index 8878b79a..cc5dfe0a 100644 --- a/rosbot_xl_controller/setup.cfg +++ b/rosbot_xl_controller/setup.cfg @@ -2,3 +2,5 @@ script_dir=$base/lib/rosbot_xl_controller [install] install_scripts=$base/lib/rosbot_xl_controller +[flake8] +max-line-length = 99 From edf0823c4cede227c611987ec1487cb34d61499c Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 24 Oct 2023 16:07:52 +0200 Subject: [PATCH 2/5] add assert msg --- rosbot_xl_controller/test/test_diff_drive_controllers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rosbot_xl_controller/test/test_diff_drive_controllers.py b/rosbot_xl_controller/test/test_diff_drive_controllers.py index dcb768c3..52e50663 100644 --- a/rosbot_xl_controller/test/test_diff_drive_controllers.py +++ b/rosbot_xl_controller/test/test_diff_drive_controllers.py @@ -60,13 +60,15 @@ def test_controllers_startup_fail(): msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) assert ( not msgs_received_flag - ), "Expected JointStates message not received. Check joint_state_broadcaster!" + ), "Received JointStates message that should not have appeared. Check whether other robots are connected to your network.!" msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) assert ( not msgs_received_flag - ), "Expected Odom message not received. Check rosbot_base_controller!" + ), "Received Odom message that should not have appeared. Check whether other robots are connected to your network.!" msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) - assert not msgs_received_flag, "Expected Imu message not received. Check imu_broadcaster!" + assert ( + not msgs_received_flag + ), "Received Imu message that should not have appeared. Check whether other robots are connected to your network.!" finally: rclpy.shutdown() From 49e00cf00652137dda7c7df5934b8772ca2e5ea3 Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 24 Oct 2023 16:22:19 +0200 Subject: [PATCH 3/5] add ignore --- rosbot_xl_controller/setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/rosbot_xl_controller/setup.cfg b/rosbot_xl_controller/setup.cfg index cc5dfe0a..d940df09 100644 --- a/rosbot_xl_controller/setup.cfg +++ b/rosbot_xl_controller/setup.cfg @@ -3,4 +3,5 @@ script_dir=$base/lib/rosbot_xl_controller [install] install_scripts=$base/lib/rosbot_xl_controller [flake8] +ignore=E501,W503 # ignore too long line and line break before binary operator - black checks it max-line-length = 99 From 2e26a4eb8b93d368a43342e0b5a79b71527ac2c7 Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 24 Oct 2023 16:23:34 +0200 Subject: [PATCH 4/5] add info --- rosbot_xl_controller/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbot_xl_controller/setup.cfg b/rosbot_xl_controller/setup.cfg index d940df09..8c47b3f2 100644 --- a/rosbot_xl_controller/setup.cfg +++ b/rosbot_xl_controller/setup.cfg @@ -3,5 +3,5 @@ script_dir=$base/lib/rosbot_xl_controller [install] install_scripts=$base/lib/rosbot_xl_controller [flake8] -ignore=E501,W503 # ignore too long line and line break before binary operator - black checks it +ignore = E501,W503 # Ignore "line too long" (E501) and "line break before binary operator" (W503) - black checks it max-line-length = 99 From de435208bbd7fed4dacf840ab13bc2f04798cae6 Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 24 Oct 2023 18:58:39 +0200 Subject: [PATCH 5/5] add black line break --- .pre-commit-config.yaml | 4 ++-- rosbot_xl_bringup/launch/bringup.launch.py | 4 +++- rosbot_xl_controller/setup.cfg | 3 --- .../test/test_diff_drive_controllers.py | 21 +++++++++++-------- .../test/test_mecanum_controllers.py | 19 ++++++++++------- rosbot_xl_gazebo/launch/simulation.launch.py | 4 +++- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0664b224..a71dc9ba 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,10 +32,10 @@ repos: files: ^.github|./\.yaml - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.10.1 hooks: - id: black - args: ["--line-length=99"] + args: ["--line-length=99", "--experimental-string-processing"] - repo: https://github.com/PyCQA/flake8 rev: 6.1.0 diff --git a/rosbot_xl_bringup/launch/bringup.launch.py b/rosbot_xl_bringup/launch/bringup.launch.py index 2bf5d487..08b7d3a8 100644 --- a/rosbot_xl_bringup/launch/bringup.launch.py +++ b/rosbot_xl_bringup/launch/bringup.launch.py @@ -30,7 +30,9 @@ def generate_launch_description(): declare_mecanum_arg = DeclareLaunchArgument( "mecanum", default_value="False", - description="Whether to use mecanum drive controller (otherwise diff drive controller is used)", + description=( + "Whether to use mecanum drive controller (otherwise diff drive controller is used)" + ), ) lidar_model = LaunchConfiguration("lidar_model") diff --git a/rosbot_xl_controller/setup.cfg b/rosbot_xl_controller/setup.cfg index 8c47b3f2..8878b79a 100644 --- a/rosbot_xl_controller/setup.cfg +++ b/rosbot_xl_controller/setup.cfg @@ -2,6 +2,3 @@ script_dir=$base/lib/rosbot_xl_controller [install] install_scripts=$base/lib/rosbot_xl_controller -[flake8] -ignore = E501,W503 # Ignore "line too long" (E501) and "line break before binary operator" (W503) - black checks it -max-line-length = 99 diff --git a/rosbot_xl_controller/test/test_diff_drive_controllers.py b/rosbot_xl_controller/test/test_diff_drive_controllers.py index 52e50663..f7d12ecc 100644 --- a/rosbot_xl_controller/test/test_diff_drive_controllers.py +++ b/rosbot_xl_controller/test/test_diff_drive_controllers.py @@ -58,17 +58,20 @@ def test_controllers_startup_fail(): node.start_node_thread() msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) - assert ( - not msgs_received_flag - ), "Received JointStates message that should not have appeared. Check whether other robots are connected to your network.!" + assert not msgs_received_flag, ( + "Received JointStates message that should not have appeared. Check whether other" + " robots are connected to your network.!" + ) msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) - assert ( - not msgs_received_flag - ), "Received Odom message that should not have appeared. Check whether other robots are connected to your network.!" + assert not msgs_received_flag, ( + "Received Odom message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) - assert ( - not msgs_received_flag - ), "Received Imu message that should not have appeared. Check whether other robots are connected to your network.!" + assert not msgs_received_flag, ( + "Received Imu message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) finally: rclpy.shutdown() diff --git a/rosbot_xl_controller/test/test_mecanum_controllers.py b/rosbot_xl_controller/test/test_mecanum_controllers.py index 484dd564..2b8a1567 100644 --- a/rosbot_xl_controller/test/test_mecanum_controllers.py +++ b/rosbot_xl_controller/test/test_mecanum_controllers.py @@ -58,15 +58,20 @@ def test_controllers_startup_fail(): node.start_node_thread() msgs_received_flag = node.joint_state_msg_event.wait(timeout=10.0) - assert ( - not msgs_received_flag - ), "Expected JointStates message not received. Check joint_state_broadcaster!" + assert not msgs_received_flag, ( + "Received JointStates message that should not have appeared. Check whether other" + " robots are connected to your network.! aaaaaaaaaaaaaaaaaaaaaaaaaaa" + ) msgs_received_flag = node.odom_msg_event.wait(timeout=10.0) - assert ( - not msgs_received_flag - ), "Expected Odom message not received. Check rosbot_base_controller!" + assert not msgs_received_flag, ( + "Received Odom message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) msgs_received_flag = node.imu_msg_event.wait(timeout=10.0) - assert not msgs_received_flag, "Expected Imu message not received. Check imu_broadcaster!" + assert not msgs_received_flag, ( + "Received Imu message that should not have appeared. Check whether other robots are" + " connected to your network.!" + ) finally: rclpy.shutdown() diff --git a/rosbot_xl_gazebo/launch/simulation.launch.py b/rosbot_xl_gazebo/launch/simulation.launch.py index c4906b1b..2a57c2a0 100644 --- a/rosbot_xl_gazebo/launch/simulation.launch.py +++ b/rosbot_xl_gazebo/launch/simulation.launch.py @@ -33,7 +33,9 @@ def generate_launch_description(): declare_mecanum_arg = DeclareLaunchArgument( "mecanum", default_value="False", - description="Whether to use mecanum drive controller (otherwise diff drive controller is used)", + description=( + "Whether to use mecanum drive controller (otherwise diff drive controller is used)" + ), ) lidar_model = LaunchConfiguration("lidar_model")