Unverified Commit 6471232a authored by Denis Štogl's avatar Denis Štogl Committed by GitHub
Browse files

Add pre-commit Checks (#77)

* add pre commit configuration

* Updated clang-format

* Added corrected files

* Revert to master

* Starting new CI configuration with pre-commit-hooks

* Add clang format config - copied from ament-clang-format

* Update action setup

* Update version of hooks

* Remove double pre-commit configuration

* Update deprecated hook.

* Update linters and formating configuration

* Braces are allways in the new line

* Updatd all line lengths to 100

* Add cpp lint option to ignore braces after else

* Put clang-format first to reduce cpplint and cppcheck errors

* Update build times and small error in setup
parent 9f09c40e
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 100
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
BreakBeforeBraces: Allman
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 2
DerivePointerAlignment: false
PointerAlignment: Middle
ReflowComments: false
IncludeBlocks: Preserve
...
name: Binary Build
on:
pull_request:
push:
branches:
- master
schedule:
# Run every day to detect flakiness and broken dependencies
- cron: '23 1 * * *'
jobs:
binary:
name: binary build
runs-on: ubuntu-latest
strategy:
matrix:
env:
- {ROS_DISTRO: foxy, ROS_REPO: main}
- {ROS_DISTRO: foxy, ROS_REPO: testing}
env:
UPSTREAM_WORKSPACE: ros2_control_demos.repos
steps:
- uses: actions/checkout@v1
- uses: 'ros-industrial/industrial_ci@master'
env: ${{matrix.env}}
name: CI
name: Coverage Build
on:
pull_request:
push:
branches:
- master
schedule:
# Run every morning to detect flakiness and broken dependencies
- cron: '28 6 * * *'
# Run every day to detect flakiness and broken dependencies
- cron: '54 1 * * *'
jobs:
ci_binary:
name: Foxy binary job
runs-on: ubuntu-latest
strategy:
matrix:
env:
- {ROS_DISTRO: foxy, ROS_REPO: main}
- {ROS_DISTRO: foxy, ROS_REPO: testing}
env:
UPSTREAM_WORKSPACE: ros2_control_demos/ros2_control_demos.repos
steps:
- uses: actions/checkout@v1
- uses: 'ros-industrial/industrial_ci@master'
env: ${{matrix.env}}
ci_source:
name: Foxy source job
coverage:
name: coverage build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
......@@ -33,18 +18,22 @@ jobs:
- uses: ros-tooling/setup-ros@0.0.26
with:
required-ros-distributions: foxy
- uses: ros-tooling/action-ros-ci@0.1.0
- uses: ros-tooling/action-ros-ci@v0.2
with:
target-ros2-distro: foxy
# build all packages listed in the meta package
package-name:
ros2_control_demo_hardware
ros2_control_demo_hardware
ros2_control_demo_robot
ros2_control_demos
ros2_control_test_nodes
vcs-repo-file-url: |
https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/ros2_control_demos/ros2_control_demos.repos
colcon-mixin-name: coverage-gcc
https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/ros2_control_demos.repos
colcon-defaults: |
{
"build": {
"mixin": ["coverage-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
- uses: codecov/codecov-action@v1.0.14
with:
......
name: Source Build
on:
push:
branches:
- master
schedule:
# Run every day to detect flakiness and broken dependencies
- cron: '43 1 * * *'
jobs:
source:
name: source build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: ros-tooling/setup-ros@0.0.26
- uses: ros-tooling/action-ros-ci@v0.2
with:
target-ros2-distro: foxy
# build all packages listed in the meta package
package-name:
ros2_control_demo_hardware
ros2_control_demo_robot
ros2_control_demos
vcs-repo-file-url: |
https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/ros2_control_demos.repos
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
- uses: actions/upload-artifact@v1
with:
name: colcon-logs-${{ matrix.os }}
path: ros_ws/log
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action
name: Format
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install clang-format-10
run: sudo apt-get install clang-format-10 cppcheck
- uses: pre-commit/action@v2.0.2
with:
extra_args: --all-files --hook-stage manual
name: Linters
name: ROS Lint
on:
pull_request:
......@@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
linter: [copyright, cppcheck, cpplint, flake8, pep257, uncrustify, xmllint]
linter: [copyright, cppcheck, lint_cmake]
steps:
- uses: actions/checkout@v1
- uses: ros-tooling/setup-ros@v0.1
......@@ -18,7 +18,26 @@ jobs:
distribution: foxy
linter: ${{ matrix.linter }}
package-name:
ros2_control_demo_hardware
ros2_control_demo_hardware
ros2_control_demo_robot
ros2_control_demos
ament_lint_cpplint:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
linter: [cpplint]
steps:
- uses: actions/checkout@v1
- uses: ros-tooling/setup-ros@v0.1
- uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: foxy
linter: cpplint
arguments: "--filter=-whitespace/newline"
package-name:
ros2_control_demo_hardware
ros2_control_demo_robot
ros2_control_demos
ros2_control_test_nodes
......@@ -29,7 +29,7 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-byte-order-marker # Forbid UTF-8 byte-order markers
- id: fix-byte-order-marker
# Python hooks
- repo: https://github.com/asottile/pyupgrade
......@@ -58,6 +58,15 @@ repos:
args: ["--ignore=E501"]
# CPP hooks
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: clang-format-10
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']
# The same options as in ament_cppcheck are used, but its not working...
#- repo: https://github.com/pocc/pre-commit-hooks
#rev: v1.1.1
......@@ -85,17 +94,7 @@ repos:
entry: ament_cpplint
language: system
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
args: ["--linelength=120"]
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: clang-format-10
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']
args: ["--linelength=100", "--filter=-whitespace/newline"]
# Cmake hooks
- repo: local
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment