Skip to content

Commit

Permalink
[CI] Code coverage + pre-commit (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Feb 26, 2024
1 parent 93cf616 commit f21e5da
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 157 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/ci-coverage-build.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/ci-format.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/ci-ros-lint.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/humble-coverage-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Coverage Build - Humble
on:
workflow_dispatch:
push:
branches:
- humble
pull_request:
branches:
- humble

jobs:
coverage_humble:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
secrets: inherit
with:
ros_distro: humble
os_name: ubuntu-22.04
14 changes: 14 additions & 0 deletions .github/workflows/humble-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pre-Commit - Humble

on:
workflow_dispatch:
pull_request:
branches:
- humble

jobs:
pre-commit:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
with:
ros_distro: humble
os_name: ubuntu-22.04
17 changes: 17 additions & 0 deletions .github/workflows/iron-coverage-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Coverage Build - Iron
on:
workflow_dispatch:
push:
branches:
- iron
pull_request:
branches:
- iron

jobs:
coverage_iron:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
secrets: inherit
with:
ros_distro: iron
os_name: ubuntu-22.04
14 changes: 14 additions & 0 deletions .github/workflows/iron-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pre-Commit - Iron

on:
workflow_dispatch:
pull_request:
branches:
- iron

jobs:
pre-commit:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
with:
ros_distro: iron
os_name: ubuntu-22.04
17 changes: 17 additions & 0 deletions .github/workflows/rolling-coverage-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Coverage Build - Rolling
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
coverage_rolling:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-build-coverage.yml@master
secrets: inherit
with:
ros_distro: rolling
os_name: ubuntu-22.04
14 changes: 14 additions & 0 deletions .github/workflows/rolling-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Pre-Commit - Rolling

on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
pre-commit:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
with:
ros_distro: rolling
os_name: ubuntu-22.04
12 changes: 12 additions & 0 deletions .github/workflows/update-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto Update pre-commit
# Update pre-commit config and create PR if changes are detected
# author: Christoph Fröhlich <christoph.froehlich@ait.ac.at>

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight

jobs:
auto_update_and_create_pr:
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-update-pre-commit.yml@master
34 changes: 20 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -36,7 +36,7 @@ repos:

# Python hooks
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand All @@ -49,40 +49,38 @@ repos:
args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"]

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.2.0
hooks:
- id: black
args: ["--line-length=99"]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
args: ["--extend-ignore=E501"]

# CPP hooks
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v17.0.6
hooks:
- id: clang-format
args: ['-fallback-style=none', '-i']

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

# Maybe use https://github.com/cpplint/cpplint instead
- repo: local
hooks:
- id: ament_cpplint
name: ament_cpplint
description: Static code analysis of C/C++ files.
stages: [commit]
entry: ament_cpplint
language: system
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
Expand All @@ -94,7 +92,6 @@ repos:
- id: ament_lint_cmake
name: ament_lint_cmake
description: Check format of CMakeLists.txt files.
stages: [commit]
entry: ament_lint_cmake
language: system
files: CMakeLists\.txt$
Expand All @@ -105,7 +102,6 @@ repos:
- id: ament_copyright
name: ament_copyright
description: Check if copyright notice is available in all files.
stages: [commit]
entry: ament_copyright
language: system

Expand All @@ -128,8 +124,18 @@ repos:
# Spellcheck in comments and docs
# skipping of *.svg files is not working...
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.6
hooks:
- id: codespell
args: ['--write-changes']
exclude: CHANGELOG\.rst|\.(svg|pyc)$
args: ['--write-changes', '--uri-ignore-words-list=ist', '-L manuel']
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-github-workflows
args: ["--verbose"]
- id: check-github-actions
args: ["--verbose"]
- id: check-dependabot
args: ["--verbose"]
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ As this project, by default, uses the default GitHub issue labels


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

~~~
5. Submission of Contributions. Unless You explicitly state otherwise,
Expand All @@ -69,4 +71,3 @@ Any contribution that you make to this repository will be under the Apache 2 Lic
[issues]: https://github.com/ros-controls/ros2_control/issues
[closed-issues]: https://github.com/ros-controls/ros2_control/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20
[help-wanted]: https://github.com/ros-controls/ros2_control/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
[license]: http://www.apache.org/licenses/LICENSE-2.0.html
2 changes: 1 addition & 1 deletion controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void ControllerManager::robot_description_callback(const std_msgs::msg::String &
RCLCPP_INFO(get_logger(), "Received robot description from topic.");
RCLCPP_DEBUG(
get_logger(), "'Content of robot description file: %s", robot_description.data.c_str());
// TODO(Manuel): errors should probably be caught since we don't want controller_manager node
// TODO(mamueluth): errors should probably be caught since we don't want controller_manager node
// to die if a non valid urdf is passed. However, should maybe be fine tuned.
try
{
Expand Down
2 changes: 1 addition & 1 deletion controller_manager/test/controller_manager_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ControllerManagerFixture : public ::testing::Test
}
else
{
// TODO(Manuel) : passing via topic not working in test setup, tested cm does
// TODO(mamueluth) : passing via topic not working in test setup, tested cm does
// not receive msg. Have to check this...

// this is just a workaround to skip passing
Expand Down
Loading

0 comments on commit f21e5da

Please sign in to comment.