Skip to content

Commit 83b910c

Browse files
committed
feat(ci): add pre-commit workflow and update CI config
1 parent 055a5f9 commit 83b910c

File tree

6 files changed

+90
-20
lines changed

6 files changed

+90
-20
lines changed

.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
BasedOnStyle: Chromium
32
AccessModifierOffset: -1
43
AlignAfterOpenBracket: Align

.github/issue_template/task-template.md

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

.github/workflows/pre-commit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: pre-commit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened, ready_for_review ]
9+
workflow_dispatch:
10+
jobs:
11+
pre-commit:
12+
uses: vortexntnu/vortex-ci/.github/workflows/reusable-pre-commit.yml@main
13+
with:
14+
ros_distro: 'humble'
15+
config_path: '.pre-commit-config.yaml'

.github/workflows/semantic-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ on:
55
branches:
66
- main
77
jobs:
8-
call_reusable_workflow:
8+
semantic-release:
99
uses: vortexntnu/vortex-ci/.github/workflows/reusable-semantic-release.yml@main

.pre-commit-config.yaml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ repos:
3535
- id: requirements-txt-fixer
3636
# Python hooks
3737
- repo: https://github.com/astral-sh/ruff-pre-commit
38-
rev: v0.9.2
38+
rev: v0.11.4
3939
hooks:
4040
- id: ruff-format
4141
- id: ruff
@@ -70,16 +70,46 @@ repos:
7070
pass_filenames: true
7171
# C++ hooks
7272
- repo: https://github.com/pre-commit/mirrors-clang-format
73-
rev: v19.1.7
73+
rev: v20.1.0
7474
hooks:
7575
- id: clang-format
7676
args: [--style=file]
77+
- repo: local
78+
hooks:
79+
- id: ament_cppcheck
80+
name: ament_cppcheck
81+
description: Static code analysis of C/C++ files.
82+
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
83+
language: system
84+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
85+
exclude: (^|/)(test|tests)/.* # exclude test dirs since ament_cppcheck misparses GTest macros and throws false syntax errors
86+
- repo: local
87+
hooks:
88+
- id: ament_cpplint
89+
name: ament_cpplint
90+
description: Static code analysis of C/C++ files.
91+
entry: ament_cpplint
92+
language: system
93+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
94+
args: [
95+
"--linelength=120",
96+
"--filter=-whitespace/newline,-legal/copyright,-build/include_order" # ignore build/include_order since it conflicts with .clang-format
97+
]
98+
# CMake hooks
99+
- repo: local
100+
hooks:
101+
- id: ament_lint_cmake
102+
name: ament_lint_cmake
103+
description: Check format of CMakeLists.txt files.
104+
entry: ament_lint_cmake
105+
language: system
106+
files: CMakeLists\.txt$
77107
# Spellcheck in comments and docs
78108
- repo: https://github.com/codespell-project/codespell
79-
rev: v2.3.0
109+
rev: v2.4.1
80110
hooks:
81111
- id: codespell
82-
args: ['--write-changes', '--ignore-words-list=theses,fom']
112+
args: ['--write-changes', '--ignore-words-list=theses,fom,NED,ENU']
83113

84114
ci:
85115
autoupdate_schedule: quarterly

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1+
# Introduction
12

3+
```
4+
TODO: Write a simple description / introduction to the repository
5+
```
6+
7+
# Setup
8+
9+
```
10+
TODO: Write a setup guide
11+
```
12+
13+
## Using pre-commit
14+
15+
This project uses [pre-commit](https://github.com/pre-commit/pre-commit) to manage automated checks.
16+
17+
### Install pre-commit
18+
```bash
19+
pip install pre-commit
20+
```
21+
22+
### Run all hooks manually
23+
```bash
24+
pre-commit run --a
25+
```
26+
27+
### Install the git hook
28+
This will make the checks run automatically every time you `git commit`:
29+
```bash
30+
pre-commit install
31+
```
32+
33+
### Update pre-commit hooks
34+
```bash
35+
pre-commit autoupdate
36+
```
37+
38+
## GitHub Actions CI
39+
- This project uses GitHub Actions for CI.
40+
- Workflows are located in [`.github/workflows`](.github/workflows/).
41+
- For more information, see [vortex-ci](https://github.com/vortexntnu/vortex-ci).

0 commit comments

Comments
 (0)