add precommit ci #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Code Formatting Lint | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
tags: ["*"] | |
branches: | |
- ros2 | |
jobs: | |
# ament_lint: | |
# runs-on: ubuntu-latest | |
# container: | |
# image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-desktop-latest | |
# options: -u root | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# linter: [flake8, mypy, pep8, xmllint] | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - uses: ros-tooling/action-ros-lint@master | |
# with: | |
# linter: ${{ matrix.linter }} | |
# package-name: . | |
run-linters: | |
name: Run Linters for Code Format Check | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.12 | |
- name: Install Python dependencies | |
run: pip install black flake8 cmakelang | |
- name: Install ClangFormat | |
run: sudo apt-get install -y clang-format | |
- name: Run Linters for python and C++ | |
uses: wearerequired/lint-action@v2 | |
with: | |
black: true | |
black_args: --line-length 100 | |
flake8: true | |
flake8_args: --max-line-length=100 | |
clang_format: true | |
- name: Install XML Linting tools | |
run: sudo apt-get install -y libxml2-utils | |
- name: Run XML Linter for URDF, SDF, Xacro, XML files | |
run: | | |
find . \( -iname '*.urdf' -o -iname '*.sdf' -o -iname '*.xacro' \ | |
-o -iname '*.xml' -o -iname '*.launch' \) -print0 | xargs -0 xmllint --noout | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@master | |
- name: Run Yamllint on YAML and .launch files | |
run: | | |
find . \( -iname '*.yml' -o -iname '*.yaml' \) -print0 | xargs -0 yamllint | |
- name: Lint CMake files | |
run: find . \( -iname 'CMakeLists.txt' -o -iname '*.cmake' \) -print0 | xargs -0 cmake-lint |