Skip to content

Commit 2bee7c8

Browse files
Fix test + Husarion 2024 + pre-commit (#100)
* Fix test + Husarion 2024 + pre-commit * fix camera * add delayed controller launch * spell fix * revert black string processing * Jakub suggestions * next suggestions * spell fix * readme * test_utils * Add * Update rosbot_gazebo/test/test_utils.py * Update .github/workflows/bump_version.yaml * Update rosbot_gazebo/test/test_utils.py Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com> --------- Co-authored-by: Jakub Delicat <109142865+delihus@users.noreply.github.com>
1 parent b8f23ed commit 2bee7c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+511
-516
lines changed

.github/workflows/bump_version.yaml

+55-55
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
---
22
name: Bump version
33
on:
4-
workflow_dispatch:
5-
inputs:
6-
name:
7-
description: Version to bump (major, minor, patch)
8-
default: patch
9-
required: true
10-
pull_request:
11-
branches: humble
12-
types: [closed]
4+
workflow_dispatch:
5+
inputs:
6+
name:
7+
description: Version to bump (major, minor, patch)
8+
default: patch
9+
required: true
10+
pull_request:
11+
branches: humble
12+
types: [closed]
1313

1414
jobs:
15-
industrial_ci:
16-
name: Industrial CI
17-
uses: ./.github/workflows/industrial_ci.yaml
15+
industrial_ci:
16+
name: Industrial CI
17+
uses: ./.github/workflows/industrial_ci.yaml
1818

19-
get-bump:
19+
get-bump:
20+
name: Get version bump
21+
runs-on: ubuntu-latest
22+
needs: industrial_ci
23+
outputs:
24+
bump: ${{ env.BUMP }}
25+
steps:
26+
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
2027
name: Get version bump
21-
runs-on: ubuntu-latest
22-
needs: industrial_ci
23-
outputs:
24-
bump: ${{ env.BUMP }}
25-
steps:
26-
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
27-
name: Get version bump
28-
id: get-version-bump
29-
uses: husarion-ci/action-get-version-bump@v0.3.0
30-
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
31-
run: echo "BUMP=${{ steps.get-version-bump.outputs.bump }}" >> $GITHUB_ENV
32-
- if: github.event_name == 'workflow_dispatch'
33-
run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV
28+
id: get-version-bump
29+
uses: husarion-ci/action-get-version-bump@v0.3.0
30+
- if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
31+
run: echo "BUMP=${{ steps.get-version-bump.outputs.bump }}" >> $GITHUB_ENV
32+
- if: github.event_name == 'workflow_dispatch'
33+
run: echo "BUMP=${{ github.event.inputs.name }}" >> $GITHUB_ENV
3434

35-
catkin-release:
36-
name: Bump version
37-
runs-on: ubuntu-latest
38-
needs: get-bump
39-
outputs:
40-
new_version: ${{ steps.catkin-release.outputs.new_version }}
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v2
44-
- name: Catkin release
45-
id: catkin-release
46-
uses: husarion-ci/action-catkin-release@v0.1.4
47-
with:
48-
bump: ${{ needs.get-bump.outputs.bump }}
49-
github_token: ${{ secrets.GH_PAT }}
50-
git_user: action-bot
51-
git_email: action-bot@action-bot.com
35+
catkin-release:
36+
name: Bump version
37+
runs-on: ubuntu-latest
38+
needs: get-bump
39+
outputs:
40+
new_version: ${{ steps.catkin-release.outputs.new_version }}
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
- name: Catkin release
45+
id: catkin-release
46+
uses: husarion-ci/action-catkin-release@v0.1.4
47+
with:
48+
bump: ${{ needs.get-bump.outputs.bump }}
49+
github_token: ${{ secrets.GH_PAT }}
50+
git_user: action-bot
51+
git_email: action-bot@action-bot.com
5252

53-
build-and-push-docker-image:
54-
name: Create new docker image
55-
runs-on: ubuntu-latest
56-
needs: catkin-release
57-
steps:
58-
- name: trigger the endpoint
59-
run: >
60-
curl -X POST
61-
-H "Accept: application/vnd.github+json"
62-
-H "Authorization: Bearer ${{ secrets.GH_PAT }}"
63-
https://api.github.com/repos/husarion/rosbot-docker/dispatches
64-
-d '{"event_type":"ros-package-update"}'
53+
build-docker-image:
54+
name: Trigger rosbot-docker to build image
55+
runs-on: ubuntu-latest
56+
needs: catkin-release
57+
steps:
58+
- name: trigger the endpoint
59+
run: >
60+
curl -X POST
61+
-H "Accept: application/vnd.github+json"
62+
-H "Authorization: Bearer ${{ secrets.GH_PAT }}"
63+
https://api.github.com/repos/husarion/rosbot-docker/dispatches
64+
-d '{"event_type":"ros-package-update"}'

.github/workflows/industrial_ci.yaml

+59-71
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,70 @@
11
---
22
name: Industrial CI
33
on:
4-
workflow_call:
5-
workflow_dispatch:
6-
push:
4+
workflow_call:
5+
workflow_dispatch:
6+
push:
77

88
jobs:
9-
black:
10-
name: Black
11-
runs-on: ubuntu-22.04
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v3
15-
- name: Black
16-
uses: psf/black@23.11.0
17-
with:
18-
options: --line-length=99
9+
black:
10+
name: Black
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Black
16+
uses: psf/black@23.11.0
17+
with:
18+
options: --line-length=99
1919

20-
spellcheck:
21-
name: Spellcheck
22-
runs-on: ubuntu-22.04
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v3
26-
- name: Spellcheck
27-
uses: rojopolis/spellcheck-github-actions@0.33.1
20+
spellcheck:
21+
name: Spellcheck
22+
runs-on: ubuntu-22.04
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
- name: Spellcheck
27+
uses: rojopolis/spellcheck-github-actions@0.33.1
2828

29-
ros_industrial_ci:
30-
name: ROS Industrial CI
31-
runs-on: ubuntu-22.04
32-
timeout-minutes: 30
33-
needs:
34-
- black
35-
- spellcheck
36-
strategy:
37-
fail-fast: false
38-
matrix:
39-
ROS_DISTRO: [humble]
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v3
29+
ros_industrial_ci:
30+
name: ROS Industrial CI
31+
runs-on: ubuntu-22.04
32+
timeout-minutes: 30
33+
needs:
34+
- black
35+
- spellcheck
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
ROS_DISTRO: [humble]
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v3
4343

44-
- name: Act + Docker fix
45-
run: |
46-
sudo chown runner:docker /var/run/docker.sock
44+
- name: Act + Docker fix
45+
run: |
46+
sudo chown runner:docker /var/run/docker.sock
4747
48-
- name: Copy to src
49-
run: |
50-
mkdir -p src
51-
find . -maxdepth 1 -not -name src -not -name . -exec mv {} src/ \;
48+
- name: Setup ROS2 Workspace and Clone Repositories
49+
run: |
50+
mkdir -p src
51+
find . -maxdepth 1 -not -name src -not -name . -exec mv {} src/ \;
52+
python3 -m pip install -U vcstool
53+
vcs import src < src/rosbot/rosbot_hardware.repos
54+
vcs import src < src/rosbot/rosbot_simulation.repos
55+
cp -r src/ros2_controllers/diff_drive_controller src/
56+
cp -r src/ros2_controllers/imu_sensor_broadcaster src/
57+
rm -rf src/ros2_controllers
5258
53-
- name: Clone installation requirements
54-
shell: bash
55-
run: |
56-
python3 -m pip install -U vcstool
57-
vcs import src < src/rosbot/rosbot_hardware.repos &&
58-
vcs import src < src/rosbot/rosbot_simulation.repos
59+
# Package micro_ros_msgs does not have industrial ci and tests does not pass.
60+
# For more information see https://github.com/micro-ROS/micro_ros_msgs/issues/7
61+
- name: Remove tests from micro_ros_msgs
62+
shell: bash
63+
run: sed '/if(BUILD_TESTING)/,/endif()/d' src/micro_ros_msgs/CMakeLists.txt -i
5964

60-
- name: Copy only diff_drive_controller and imu_sensor_broadcaster, waits for features from ros2-control
61-
shell: bash
62-
run: |
63-
cp -r src/ros2_controllers/diff_drive_controller src/
64-
cp -r src/ros2_controllers/imu_sensor_broadcaster src/
65-
rm -rf src/ros2_controllers
66-
67-
- name: Remove ign_ros2_control demo and tests
68-
shell: bash
69-
run: rm -rf src/gazebosim/gz_ros2_control/ign_ros2_control_demos src/gazebosim/gz_ros2_control/gz_ros2_control_tests
70-
71-
# Package micro_ros_msgs does not have industrial ci and tests does not pass.
72-
# For more information see https://github.com/micro-ROS/micro_ros_msgs/issues/7
73-
- name: Remove tests from micro_ros_msgs
74-
shell: bash
75-
run: sed '/if(BUILD_TESTING)/,/endif()/d' src/micro_ros_msgs/CMakeLists.txt -i
76-
77-
- name: Running ROS Industrial CI
78-
uses: ros-industrial/industrial_ci@master
79-
env:
80-
ROS_DISTRO: ${{matrix.ROS_DISTRO}}
81-
DOCKER_IMAGE: ros:${{matrix.ROS_DISTRO}}-ros-base
82-
IMMEDIATE_TEST_OUTPUT: true
65+
- name: Running ROS Industrial CI
66+
uses: ros-industrial/industrial_ci@master
67+
env:
68+
ROS_DISTRO: ${{matrix.ROS_DISTRO}}
69+
DOCKER_IMAGE: ros:${{matrix.ROS_DISTRO}}-ros-base
70+
IMMEDIATE_TEST_OUTPUT: true

.pre-commit-config.yaml

+50-48
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,62 @@
11
---
22
repos:
3-
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.5.0
5-
hooks:
6-
- id: check-merge-conflict
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-xml
11-
- id: check-added-large-files
12-
- id: check-ast
13-
- id: check-json
14-
- id: name-tests-test
15-
files: ^.*\/test\/.*$
16-
args: [--pytest-test-first]
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
5+
hooks:
6+
- id: check-merge-conflict
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-xml
11+
- id: check-added-large-files
12+
- id: check-ast
13+
- id: check-json
14+
- id: name-tests-test
15+
files: ^.*\/test\/.*$
16+
args: [--pytest-test-first]
1717

18-
- repo: https://github.com/codespell-project/codespell
19-
rev: v2.2.6
20-
hooks:
21-
- id: codespell
22-
name: codespell
23-
description: Checks for common misspellings in text files.
24-
entry: codespell *
25-
language: python
26-
types: [text]
18+
- repo: https://github.com/codespell-project/codespell
19+
rev: v2.2.6
20+
hooks:
21+
- id: codespell
22+
name: codespell
23+
description: Checks for common misspellings in text files.
24+
entry: codespell *
25+
language: python
26+
types: [text]
2727

28-
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
29-
rev: 0.2.3
30-
hooks:
31-
- id: yamlfmt
32-
files: ^.github|./\.yaml
28+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
29+
rev: 0.2.3
30+
hooks:
31+
- id: yamlfmt
32+
files: ^(?!.*compose)(?!.*ekf\.yaml$).*$
33+
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '100']
3334

34-
- repo: https://github.com/psf/black
35-
rev: 23.11.0
36-
hooks:
37-
- id: black
38-
args: ["--line-length=99", "--experimental-string-processing"]
35+
# Please keep this version until --experimental-string-processing come back or will be available by default
36+
- repo: https://github.com/psf/black
37+
rev: 23.11.0
38+
hooks:
39+
- id: black
40+
args: [--line-length=99, --experimental-string-processing]
3941

40-
- repo: https://github.com/PyCQA/flake8
41-
rev: 6.1.0
42-
hooks:
43-
- id: flake8
44-
args: ["--ignore=E501,W503"] # ignore too long line and line break before binary operator,
42+
- repo: https://github.com/PyCQA/flake8
43+
rev: 7.0.0
44+
hooks:
45+
- id: flake8
46+
args: ['--ignore=E501,W503'] # ignore too long line and line break before binary operator,
4547
# black checks it
4648

47-
- repo: local
48-
hooks:
49+
- repo: local
50+
hooks:
4951
- id: ament_lint_cmake
5052
name: ament_lint_cmake
5153
description: Check format of CMakeLists.txt files.
5254
entry: ament_lint_cmake
5355
language: system
5456
files: CMakeLists\.txt$
5557

56-
- repo: local
57-
hooks:
58+
- repo: local
59+
hooks:
5860
- id: ament_copyright
5961
name: ament_copyright
6062
description: Check if copyright notice is available in all files.
@@ -63,9 +65,9 @@ repos:
6365
language: system
6466

6567
# Docs - RestructuredText hooks
66-
- repo: https://github.com/PyCQA/doc8
67-
rev: v1.1.1
68-
hooks:
69-
- id: doc8
70-
args: ['--max-line-length=100', '--ignore=D001']
71-
exclude: ^.*\/CHANGELOG\.rst/.*$
68+
- repo: https://github.com/PyCQA/doc8
69+
rev: v1.1.1
70+
hooks:
71+
- id: doc8
72+
args: [--max-line-length=100, --ignore=D001]
73+
exclude: ^.*\/CHANGELOG\.rst/.*$

0 commit comments

Comments
 (0)