Skip to content

Commit b20b149

Browse files
christophfroehlichmergify[bot]
authored andcommitted
[CI] Code coverage + pre-commit (#1413)
(cherry picked from commit 1538c91) # Conflicts: # .github/workflows/ci-coverage-build.yml # .github/workflows/ci-format.yml # .github/workflows/ci-ros-lint.yml # .pre-commit-config.yaml
1 parent 3e81cee commit b20b149

13 files changed

+165
-20
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Coverage Build - Humble
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- humble
7+
pull_request:
8+
branches:
9+
- humble
10+
11+
jobs:
12+
coverage_humble:
13+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
14+
secrets: inherit
15+
with:
16+
ros_distro: humble
17+
os_name: ubuntu-22.04
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pre-Commit - Humble
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- humble
8+
9+
jobs:
10+
pre-commit:
11+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
12+
with:
13+
ros_distro: humble
14+
os_name: ubuntu-22.04
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Coverage Build - Iron
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- iron
7+
pull_request:
8+
branches:
9+
- iron
10+
11+
jobs:
12+
coverage_iron:
13+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
14+
secrets: inherit
15+
with:
16+
ros_distro: iron
17+
os_name: ubuntu-22.04

.github/workflows/iron-pre-commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pre-Commit - Iron
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- iron
8+
9+
jobs:
10+
pre-commit:
11+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
12+
with:
13+
ros_distro: iron
14+
os_name: ubuntu-22.04
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Coverage Build - Rolling
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
coverage_rolling:
13+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
14+
secrets: inherit
15+
with:
16+
ros_distro: rolling
17+
os_name: ubuntu-22.04
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pre-Commit - Rolling
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
pre-commit:
11+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
12+
with:
13+
ros_distro: rolling
14+
os_name: ubuntu-22.04
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Auto Update pre-commit
2+
# Update pre-commit config and create PR if changes are detected
3+
# author: Christoph Fröhlich <[email protected]>
4+
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '0 0 * * 0' # Run every Sunday at midnight
9+
10+
jobs:
11+
auto_update_and_create_pr:
12+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-update-pre-commit.yml@master

.pre-commit-config.yaml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
repos:
1717
# Standard hooks
1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.4.0
19+
rev: v4.5.0
2020
hooks:
2121
- id: check-added-large-files
2222
- id: check-ast
@@ -36,7 +36,11 @@ repos:
3636

3737
# Python hooks
3838
- repo: https://github.com/asottile/pyupgrade
39+
<<<<<<< HEAD
3940
rev: v3.3.1
41+
=======
42+
rev: v3.15.1
43+
>>>>>>> 1538c91 ([CI] Code coverage + pre-commit (#1413))
4044
hooks:
4145
- id: pyupgrade
4246
args: [--py36-plus]
@@ -48,13 +52,23 @@ repos:
4852
- id: pydocstyle
4953
args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"]
5054

55+
<<<<<<< HEAD
56+
=======
57+
- repo: https://github.com/psf/black
58+
rev: 24.2.0
59+
hooks:
60+
- id: black
61+
args: ["--line-length=99"]
62+
63+
>>>>>>> 1538c91 ([CI] Code coverage + pre-commit (#1413))
5164
- repo: https://github.com/pycqa/flake8
52-
rev: 6.0.0
65+
rev: 7.0.0
5366
hooks:
5467
- id: flake8
5568
args: ["--extend-ignore=E501"]
5669

5770
# CPP hooks
71+
<<<<<<< HEAD
5872
- repo: local
5973
hooks:
6074
- id: clang-format
@@ -63,25 +77,28 @@ repos:
6377
entry: clang-format-14
6478
language: system
6579
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
80+
=======
81+
- repo: https://github.com/pre-commit/mirrors-clang-format
82+
rev: v17.0.6
83+
hooks:
84+
- id: clang-format
85+
>>>>>>> 1538c91 ([CI] Code coverage + pre-commit (#1413))
6686
args: ['-fallback-style=none', '-i']
6787

6888
- repo: local
6989
hooks:
7090
- id: ament_cppcheck
7191
name: ament_cppcheck
7292
description: Static code analysis of C/C++ files.
73-
stages: [commit]
74-
entry: ament_cppcheck
93+
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
7594
language: system
7695
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
7796

78-
# Maybe use https://github.com/cpplint/cpplint instead
7997
- repo: local
8098
hooks:
8199
- id: ament_cpplint
82100
name: ament_cpplint
83101
description: Static code analysis of C/C++ files.
84-
stages: [commit]
85102
entry: ament_cpplint
86103
language: system
87104
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
@@ -93,7 +110,6 @@ repos:
93110
- id: ament_lint_cmake
94111
name: ament_lint_cmake
95112
description: Check format of CMakeLists.txt files.
96-
stages: [commit]
97113
entry: ament_lint_cmake
98114
language: system
99115
files: CMakeLists\.txt$
@@ -104,7 +120,6 @@ repos:
104120
- id: ament_copyright
105121
name: ament_copyright
106122
description: Check if copyright notice is available in all files.
107-
stages: [commit]
108123
entry: ament_copyright
109124
language: system
110125

@@ -127,8 +142,22 @@ repos:
127142
# Spellcheck in comments and docs
128143
# skipping of *.svg files is not working...
129144
- repo: https://github.com/codespell-project/codespell
145+
<<<<<<< HEAD
130146
rev: v2.2.2
147+
=======
148+
rev: v2.2.6
149+
>>>>>>> 1538c91 ([CI] Code coverage + pre-commit (#1413))
131150
hooks:
132151
- id: codespell
133-
args: ['--write-changes']
134-
exclude: CHANGELOG\.rst|\.(svg|pyc)$
152+
args: ['--write-changes', '--uri-ignore-words-list=ist', '-L manuel']
153+
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$
154+
155+
- repo: https://github.com/python-jsonschema/check-jsonschema
156+
rev: 0.28.0
157+
hooks:
158+
- id: check-github-workflows
159+
args: ["--verbose"]
160+
- id: check-github-actions
161+
args: ["--verbose"]
162+
- id: check-dependabot
163+
args: ["--verbose"]

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ As this project, by default, uses the default GitHub issue labels
5454

5555

5656
## Licensing
57-
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that [license]:
57+
Any contribution that you make to this repository will
58+
be under the Apache 2 License, as dictated by that
59+
[license](http://www.apache.org/licenses/LICENSE-2.0.html):
5860

5961
~~~
6062
5. Submission of Contributions. Unless You explicitly state otherwise,
@@ -69,4 +71,3 @@ Any contribution that you make to this repository will be under the Apache 2 Lic
6971
[issues]: https://github.com/ros-controls/ros2_control/issues
7072
[closed-issues]: https://github.com/ros-controls/ros2_control/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20
7173
[help-wanted]: https://github.com/ros-controls/ros2_control/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
72-
[license]: http://www.apache.org/licenses/LICENSE-2.0.html

controller_manager/src/controller_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void ControllerManager::robot_description_callback(const std_msgs::msg::String &
337337
RCLCPP_INFO(get_logger(), "Received robot description file.");
338338
RCLCPP_DEBUG(
339339
get_logger(), "'Content of robot description file: %s", robot_description.data.c_str());
340-
// TODO(Manuel): errors should probably be caught since we don't want controller_manager node
340+
// TODO(mamueluth): errors should probably be caught since we don't want controller_manager node
341341
// to die if a non valid urdf is passed. However, should maybe be fine tuned.
342342
try
343343
{

controller_manager/test/controller_manager_test_common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class ControllerManagerFixture : public ::testing::Test
8989
}
9090
else
9191
{
92-
// TODO(Manuel) : passing via topic not working in test setup, tested cm does
92+
// TODO(mamueluth) : passing via topic not working in test setup, tested cm does
9393
// not receive msg. Have to check this...
9494

9595
// this is just a workaround to skip passing

hardware_interface/test/test_handle.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ constexpr auto FOO_INTERFACE = "FooInterface";
2727
TEST(TestHandle, command_interface)
2828
{
2929
double value = 1.337;
30-
CommandInterface interface {
31-
JOINT_NAME, FOO_INTERFACE, &value
32-
};
30+
CommandInterface interface{JOINT_NAME, FOO_INTERFACE, &value};
3331
EXPECT_DOUBLE_EQ(interface.get_value(), value);
3432
EXPECT_NO_THROW(interface.set_value(0.0));
3533
EXPECT_DOUBLE_EQ(interface.get_value(), 0.0);
@@ -38,9 +36,7 @@ TEST(TestHandle, command_interface)
3836
TEST(TestHandle, state_interface)
3937
{
4038
double value = 1.337;
41-
StateInterface interface {
42-
JOINT_NAME, FOO_INTERFACE, &value
43-
};
39+
StateInterface interface{JOINT_NAME, FOO_INTERFACE, &value};
4440
EXPECT_DOUBLE_EQ(interface.get_value(), value);
4541
// interface.set_value(5); compiler error, no set_value function
4642
}

rqt_controller_manager/setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2024 Apache License, Version 2.0
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from glob import glob
216

317
from setuptools import setup

0 commit comments

Comments
 (0)