Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup CI for ROS2 #122

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 41 additions & 30 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
---
BasedOnStyle: Google
ColumnLimit: 120
MaxEmptyLinesToKeep: 1
SortIncludes: false

Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
NamespaceIndentation: None
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false

AlignEscapedNewlinesLeft: false
AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false
ExperimentalAutoDetectBinPacking: false
ObjCSpaceBeforeProtocolList: true
Cpp11BracedListStyle: false

AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortCaseLabelsOnASingleLine: false

AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true

BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60

PenaltyExcessCharacter: 50
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 1000
PenaltyBreakFirstLessLess: 10
PenaltyBreakString: 100
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 70
PenaltyReturnTypeOnItsOwnLine: 50

SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping:
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
...
60 changes: 23 additions & 37 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,47 @@

name: CI

on: [push, pull_request]
on:
workflow_dispatch:
pull_request:
push:
branches:
- ros2

jobs:
default:
strategy:
fail-fast: false
matrix:
env:
- IMAGE: melodic
CCOV: true
CATKIN_LINT: true
UPSTREAM_WORKSPACE: github:PickNikRobotics/rviz_visual_tools#master
- IMAGE: noetic
CATKIN_LINT: true
- ROS_DISTRO: rolling
ROS_REPO: main
- ROS_DISTRO: rolling
ROS_REPO: testing
- ROS_DISTRO: humble
ROS_REPO: main
- ROS_DISTRO: humble
ROS_REPO: testing
env:
DOCKER_IMAGE: 'moveit/moveit:${{ matrix.env.IMAGE }}-release'
AFTER_RUN_TARGET_TEST: ${{ matrix.env.CCOV && './.ci.prepare_codecov' || '' }}
TARGET_CMAKE_ARGS: >
-DCMAKE_BUILD_TYPE=${{ matrix.env.CCOV && 'RelWithDebInfo' || 'Release'}}
${{ matrix.env.CCOV && '-DCMAKE_CXX_FLAGS="--coverage" --no-warn-unused-cli' || '' }}
CCACHE_DIR: "${{ github.workspace }}/.ccache"
BASEDIR: ${{ github.workspace }}/.work
CACHE_PREFIX: "${{ matrix.env.IMAGE }}${{ matrix.env.CCOV && '-ccov' || '' }}"
CLANG_TIDY_BASE_REF: "${{ github.base_ref || github.ref }}"
CCACHE_DIR: ~/.ccache

name: "${{ matrix.env.IMAGE }}${{ matrix.env.CATKIN_LINT && ' + catkin_lint' || ''}}${{ matrix.env.CCOV && ' + ccov' || ''}}${{ matrix.env.IKFAST_TEST && ' + ikfast' || ''}}${{ matrix.env.CLANG_TIDY && ' + clang-tidy' || '' }}"
name: ${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: cache upstream_ws
uses: pat-s/[email protected]
with:
path: ${{ env.BASEDIR }}/upstream_ws
key: upstream_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('upstream.rosinstall') }}-${{ github.run_id }}
restore-keys: |
upstream_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('upstream.rosinstall') }}
- name: cache ccache
uses: actions/cache@v2
- uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-${{ github.sha }}
restore-keys: |
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}
ccache-${{ env.CACHE_PREFIX }}
- name: industrial_ci
uses: 'ros-industrial/industrial_ci@master'
ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
- id: industrial_ci
uses: ros-industrial/industrial_ci@master
env: ${{ matrix.env }}
- name: upload test artifacts (on failure)
uses: actions/upload-artifact@v2
if: failure()
if: steps.industrial_ci.outcome != 'success'
with:
name: test-results
name: test-results-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO}}
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
- name: upload codecov report
uses: codecov/codecov-action@v1
if: ${{ matrix.env.CCOV }}
with:
files: ${{ env.BASEDIR }}/coverage.info
28 changes: 10 additions & 18 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@

# 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
name: Formatting (pre-commit)

on:
workflow_dispatch:
pull_request:
push:
branches:
- ros2

jobs:
pre-commit:
name: 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
- name: Install catkin-lint
run: |
lsb_release -sc
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get -q update
sudo apt-get -q install python3-rosdep
sudo rosdep init
rosdep update
sudo apt-get -q install catkin-lint
export ROS_DISTRO=noetic
- uses: pre-commit/[email protected]
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install clang-format-10
run: sudo apt-get install clang-format-10
- uses: pre-commit/[email protected]
20 changes: 1 addition & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ repos:
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black

Expand All @@ -42,20 +41,3 @@ repos:
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']

- repo: local
hooks:
- id: misspelled-moveit
name: misspelled-moveit
description: MoveIt should be spelled exactly as MoveIt
language: pygrep
entry: Moveit|MoveIt!
exclude: .pre-commit-config.yaml|README.md

- id: catkin_lint
name: catkin_lint
description: Check package.xml and cmake files
entry: catkin_lint .
language: system
always_run: true
pass_filenames: false
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repository. For background, see this [Github discussion](https://github.com/ros-

## GitHub Actions - Continuous Integration

[![Format](https://github.com/ros-planning/moveit_calibration/actions/workflows/format.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_calibration/actions/workflows/format.yaml?branch=master)
[![BuildAndTest](https://github.com/ros-planning/moveit_calibration/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/ros-planning/moveit_calibration/actions/workflows/ci.yaml?branch=master)
GitHub Actions:
[![Formatting (pre-commit))](https://github.com/ros-planning/moveit_resources/actions/workflows/format.yml/badge.svg?branch=ros2)](https://github.com/ros-planning/moveit_calibration/actions/workflows/format.yml?query=branch%3Aros2)
[![Build and Test](https://github.com/ros-planning/moveit_resources/actions/workflows/industrial_ci_action.yml/badge.svg?branch=ros2)](https://github.com/ros-planning/moveit_calibration/actions/workflows/industrial_ci_action.yml?query=branch%3Aros2)
[![codecov](https://codecov.io/gh/ros-planning/moveit_calibration/branch/master/graph/badge.svg?token=W7uHKcY0ly)](https://codecov.io/gh/ros-planning/moveit_calibration)