Skip to content

Commit cbeccd6

Browse files
authored
Clean up builds, pre-commit, and add workflows (#1)
* Add initial cleanup pass and update cmakelists for more appropriate building * Add pre-commit * Run pre-commit and clean-up * Update to catch2withmain style * Remove unnecessary stuff in gitignore * Move into the right folder for workflows * Don't have a repos file! * Remove visibility control, we don't use it. Also clean up namespacing * Remove ament lint because it's extremely constraining and conflicting at times * Change versioning to prep for bloom and fix bad copyright * Add magic humble vs jazzy and rolling builder * Include the right catch versions for humble vs non * Further clean up branching * Add cleanup removing unnecessary packages and bad copypasta * Revert package.xml and fix pre-commit * Fix missing rclcpp components * Fix missing rclcpp components
1 parent ed05b8c commit cbeccd6

24 files changed

+891
-944
lines changed

.config/clang-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
3+
# See https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormatStyleOptions.html for documentation of these options
4+
BasedOnStyle: Google
5+
IndentWidth: 2
6+
ColumnLimit: 120
7+
8+
AccessModifierOffset: -2
9+
AlignAfterOpenBracket: AlwaysBreak
10+
AlignConsecutiveAssignments: None
11+
AlignConsecutiveDeclarations: None
12+
AlignEscapedNewlines: Left
13+
AlignTrailingComments: false
14+
AllowAllArgumentsOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortBlocksOnASingleLine: Empty
17+
AllowShortFunctionsOnASingleLine: false
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BraceWrapping:
21+
AfterClass: true
22+
AfterControlStatement: MultiLine
23+
AfterEnum: true
24+
AfterFunction: true
25+
AfterNamespace: true
26+
AfterStruct: true
27+
AfterUnion: true
28+
AfterExternBlock: true
29+
BeforeCatch: false
30+
BeforeElse: false
31+
BeforeLambdaBody: false
32+
BeforeWhile: false
33+
IndentBraces: false
34+
SplitEmptyFunction: false
35+
SplitEmptyRecord: false
36+
SplitEmptyNamespace: false
37+
BreakBeforeBraces: Custom
38+
BreakConstructorInitializers: BeforeComma
39+
CompactNamespaces: false
40+
ContinuationIndentWidth: 2
41+
ConstructorInitializerIndentWidth: 0
42+
DerivePointerAlignment: false
43+
EmptyLineAfterAccessModifier: Never
44+
EmptyLineBeforeAccessModifier: LogicalBlock
45+
FixNamespaceComments: true
46+
IncludeBlocks: Regroup
47+
IncludeCategories:
48+
# Headers in <> with .h extension (best guess at C system headers)
49+
- Regex: '<([A-Za-z0-9\Q/-_\E])+\.h>'
50+
Priority: 1
51+
# Headers in <> without extension (C++ system headers)
52+
- Regex: '<([A-Za-z0-9\Q/-_\E])+>'
53+
Priority: 2
54+
# Headers in <> with other extensions.
55+
- Regex: '<([A-Za-z0-9.\Q/-_\E])+>'
56+
Priority: 3
57+
# Headers in ""
58+
- Regex: '"([A-Za-z0-9.\Q/-_\E])+"'
59+
Priority: 4
60+
IndentAccessModifiers: false
61+
IndentPPDirectives: BeforeHash
62+
PackConstructorInitializers: Never
63+
PointerAlignment: Middle
64+
ReferenceAlignment: Middle
65+
ReflowComments: false
66+
SeparateDefinitionBlocks: Always
67+
SortIncludes: CaseInsensitive
68+
SpacesBeforeTrailingComments: 2

.config/copyright.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2025-present Polymath Robotics, Inc. All rights reserved
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.

.cpplint.cfg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Because of cpplint's config file assumptions, this can't be contained in .config/ directory
2+
linelength=256
3+
4+
# TODO(emerson) we need to apply a copyright check, maybe not via this tool though
5+
filter=-legal/copyright
6+
# TODO(emerson) we want these, but the style as enforced here is probably not quite right for us
7+
filter=-build/header_guard
8+
filter=-build/c++17
9+
10+
# Per our style guide, we want to allow the use of non-const reference passing for output parameters
11+
filter=-runtime/references
12+
13+
# Disable all formatting checks, this is handled by clang-format
14+
filter=-readability/braces
15+
filter=-whitespace/braces
16+
filter=-whitespace/indent
17+
filter=-whitespace/newline
18+
filter=-whitespace/parens
19+
filter=-whitespace/semicolon

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
3+
name: Build and test
4+
"on":
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build_and_test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- ros: humble
18+
ubuntu: jammy
19+
- ros: jazzy
20+
ubuntu: noble
21+
- ros: rolling
22+
ubuntu: noble
23+
name: ROS 2 ${{ matrix.ros }}
24+
container:
25+
image: ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-ubuntu-${{ matrix.ubuntu }}:latest
26+
env:
27+
ROS_DISTRO: ${{ matrix.ros }}
28+
PIP_BREAK_SYSTEM_PACKAGES: 1
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: ros-tooling/[email protected]
32+
with:
33+
target-ros2-distro: ${{ matrix.ros }}
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
name: colcon-logs-${{ matrix.ros }}
37+
path: ros_ws/log

.github/workflows/pre-commit.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: pre-commit
3+
4+
"on":
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.10"
17+
- run: sudo apt-get update && sudo apt-get install libxml2-utils
18+
- uses: pre-commit/[email protected]

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Colcon
2+
/build/
3+
/install/
4+
/log/

.gitlab-ci.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# See https://pre-commit.com for more information on these settings
3+
repos:
4+
# Generally useful checks provided by pre-commit
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v5.0.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-ast
10+
- id: check-case-conflict
11+
- id: check-merge-conflict
12+
- id: check-shebang-scripts-are-executable
13+
- id: check-symlinks
14+
- id: check-toml
15+
- id: check-xml
16+
- id: end-of-file-fixer
17+
- id: forbid-submodules
18+
- id: mixed-line-ending
19+
- id: trailing-whitespace
20+
# Python
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
rev: v0.11.5
23+
hooks:
24+
- id: ruff-format
25+
- id: ruff
26+
args: [--fix]
27+
# C++ formatting
28+
- repo: https://github.com/pre-commit/mirrors-clang-format
29+
rev: v19.1.7
30+
hooks:
31+
- id: clang-format
32+
args: ["--style=file:.config/clang-format"]
33+
# C++ linting
34+
- repo: https://github.com/cpplint/cpplint
35+
rev: 2.0.0
36+
hooks:
37+
- id: cpplint
38+
args: ["--config=.cpplint.cfg", --quiet, --output=sed]
39+
# Markdown
40+
- repo: https://github.com/jackdewinter/pymarkdown
41+
rev: v0.9.28
42+
hooks:
43+
- id: pymarkdown
44+
args: [-d, MD013, fix]
45+
# XML
46+
- repo: https://github.com/emersonknapp/ament_xmllint
47+
rev: v0.1
48+
hooks:
49+
- id: ament_xmllint
50+
# YAML
51+
- repo: https://github.com/adrienverge/yamllint.git
52+
rev: v1.29.0
53+
hooks:
54+
- id: yamllint
55+
args: [-d, "{extends: default, rules: {line-length: {max: 256}, commas: false}}"]
56+
# CMake
57+
- repo: https://github.com/cmake-lint/cmake-lint
58+
rev: 1.4.3
59+
hooks:
60+
- id: cmakelint
61+
args: [--linelength=140]
62+
- repo: https://github.com/Lucas-C/pre-commit-hooks
63+
rev: v1.5.5
64+
hooks:
65+
- id: insert-license
66+
types_or: [python, cmake, shell]
67+
name: Copyright headers for Python/CMake
68+
args: [
69+
--license-filepath, .config/copyright.txt,
70+
--comment-style, '#',
71+
--allow-past-years,
72+
--no-extra-eol,
73+
]
74+
- id: insert-license
75+
types_or: [c++, c]
76+
name: Copyright headers for C/C++
77+
args: [
78+
--license-filepath, .config/copyright.txt,
79+
--comment-style, '//',
80+
--allow-past-years,
81+
]

.ruff.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
line-length = 120
2+
indent-width = 4
3+
4+
[format]
5+
preview = true
6+
quote-style = "single"
7+
indent-style = "space"
8+
skip-magic-trailing-comma = false
9+
line-ending = "lf"
10+
11+
[lint]
12+
select = ["E4", "E7", "E9", "F", "I"]
13+
# Rules intended for future application
14+
# select = ["N", "D", "C90", "PTH", "UP", "PERF", "RUF"]
15+
ignore = []
16+
fixable = ["ALL"]
17+
unfixable = []
18+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release Notes
22

3-
## v0.1.0
3+
## v0.0.0
44
__INITIAL RELEASE__
55

66
### Features

0 commit comments

Comments
 (0)