Skip to content

Commit

Permalink
Workflow + pre commit (#76)
Browse files Browse the repository at this point in the history
* Workflow + pre commit

* Update test_diff_drive_controllers.py

* Update test_mecanum_controllers.py

* Update .github/workflows/industrial_ci.yaml
  • Loading branch information
rafal-gorecki authored Oct 25, 2023
1 parent 6c0a865 commit 0e2b860
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 57 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/black.yaml

This file was deleted.

17 changes: 9 additions & 8 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: Trigger rosbot-docker to build an image and bump version

name: Bump version
on:
workflow_dispatch:
inputs:
Expand All @@ -13,10 +12,14 @@ on:
types: [closed]

jobs:
industrial_ci:
name: Industrial CI
uses: ./.github/workflows/industrial_ci.yaml

get-bump:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
name: Get version bump
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: industrial_ci
outputs:
bump: ${{ env.BUMP }}
steps:
Expand All @@ -30,9 +33,8 @@ jobs:
run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV

catkin-release:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
name: Bump version
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: get-bump
outputs:
new_version: ${{ steps.catkin-release.outputs.new_version }}
Expand All @@ -49,9 +51,8 @@ jobs:
git_email: [email protected]

build-and-push-docker-image:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
name: Create new docker image
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs: catkin-release
steps:
- name: trigger the endpoint
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/industrial_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@
name: Industrial CI
on:
workflow_call:
workflow_dispatch:
push:


jobs:
industrial_ci:
black:
name: Black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: --line-length=99

spellcheck:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rojopolis/[email protected]
name: Spellcheck

ros_industrial_ci:
name: ROS Industrial CI
needs:
- black
- spellcheck
strategy:
fail-fast: false
matrix:
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/spellcheck.yaml

This file was deleted.

7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ 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
hooks:
- id: flake8
args: ["--ignore=E501"] # ignore too long line, black checks it
args: ["--ignore=E501,W503"] # ignore too long line and line break before binary operator,
# black checks it

- repo: local
hooks:
Expand Down
19 changes: 12 additions & 7 deletions rosbot_controller/test/test_diff_drive_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.!"
)
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()

Expand Down
19 changes: 12 additions & 7 deletions rosbot_controller/test/test_mecanum_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.!"
)
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()

Expand Down
2 changes: 1 addition & 1 deletion rosbot_gazebo/launch/simulation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def generate_launch_description():
declare_headless_arg = DeclareLaunchArgument(
"headless",
default_value="False",
description=("Run Gazebo Ignition in the headless mode"),
description="Run Gazebo Ignition in the headless mode",
)

headless_cfg = PythonExpression(
Expand Down

0 comments on commit 0e2b860

Please sign in to comment.