-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,739 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Given a set of commits current script checks the style based on clang_format | ||
# on the list of changed files that exist in the commits. | ||
# | ||
# Script should be called from a travis.yml file. | ||
|
||
# Functions | ||
###################### | ||
|
||
# This is run by travis automatically from the root of the project | ||
|
||
set +e | ||
set +x | ||
|
||
DIRS_IN="modules" | ||
DIRS_OUT="demos docs modules/mp2p_icp/3rdparty" | ||
LANGS=cpp | ||
FORMAT_CODE_BIN="scripts/clang_git_format/format_code.py" | ||
|
||
function lint() { | ||
|
||
# Get list of changed files for lint to run on. Grep only .h, .cpp files and | ||
# mind the DIRS_IN, DIRS_OUT vars | ||
|
||
# Following command fails if you "git commit --amend" - Works correctly on | ||
# standard commits | ||
echo "commit_range: $TRAVIS_COMMIT_RANGE" | ||
changed_files=$(git diff --name-only $TRAVIS_COMMIT_RANGE) | ||
printf "Summary of changed files:\n\n${changed_files}\n\n" | ||
|
||
# include | ||
regexp_in= | ||
for i in $DIRS_IN; do | ||
if [ -n "${regexp_in}" ]; then | ||
regexp_in="${regexp_in}\|${i}" | ||
else | ||
regexp_in="${i}" | ||
fi | ||
done | ||
|
||
# exclude | ||
regexp_out= | ||
for i in $DIRS_OUT; do | ||
if [ -n "${regexp_out}" ]; then | ||
regexp_out="${regexp_out}\|${i}" | ||
else | ||
regexp_out="${i}" | ||
fi | ||
done | ||
|
||
echo "regexp_in: ${regexp_in}" | ||
echo "regexp_out: ${regexp_out}" | ||
|
||
valid_files=$(echo ${changed_files} \ | ||
| xargs -d' ' -n 1 \ | ||
| grep -i -e "${regexp_in}" \ | ||
| grep -v "${regexp_out}" \ | ||
| grep -ie ".*\.h$\|.*\.cpp") | ||
|
||
|
||
printf "Valid files for lint:\n\t${valid_files}\n" | ||
if [ -n "${valid_files}" ]; then | ||
${FORMAT_CODE_BIN} -g . --lint_files ${valid_files} | ||
else | ||
true | ||
fi | ||
exit $? | ||
|
||
} | ||
|
||
function lint_all() { | ||
|
||
${FORMAT_CODE_BIN} -g . --lang ${LANGS} \ | ||
-o ${DIRS_OUT} -i ${DIRS_IN} \ | ||
-l | ||
|
||
exit $? | ||
} | ||
|
||
lint_all |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Requisites for the clang-format linter script | ||
argparse | ||
colorlog |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Based on GTSAM file (by @ProfFan) | ||
name: CI ROS | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
env: | ||
CTEST_OUTPUT_ON_FAILURE: ON | ||
CTEST_PARALLEL_LEVEL: 1 | ||
VERBOSE: 1 # to show all cmake scripts debug info | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Github Actions requires a single row to be added to the build matrix. | ||
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions. | ||
name: [ | ||
ros-rolling-u22.04 | ||
] | ||
|
||
include: | ||
- name: ros-rolling-u22.04 | ||
os: ros:rolling-ros-base | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Git submodule | ||
run: | | ||
git submodule sync | ||
git submodule update --init --recursive | ||
- name: Install rosdep dependencies | ||
run: | | ||
# See bug/issue: https://github.com/orgs/community/discussions/47863 | ||
sudo apt-get -y update | ||
rosdep install --from-paths . --ignore-src -r -y | ||
- name: Build with colcon | ||
run: | | ||
source /opt/ros/*/setup.bash | ||
colcon build --symlink-install |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI Check clang-format | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Github Actions requires a single row to be added to the build matrix. | ||
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions. | ||
name: [ | ||
clang-format-check | ||
] | ||
|
||
include: | ||
- name: clang-format-check | ||
os: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Git submodule | ||
run: | | ||
git submodule sync | ||
git submodule update --init --recursive | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt install clang-format-11 -yq | ||
pip3 install --user -r .github/python_clang_format_reqs.txt | ||
- name: Check code style | ||
run: | | ||
echo "TASK=lint_all" >> $GITHUB_ENV | ||
bash .github/check_style.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
*.pyc | ||
|
||
# Packages # | ||
############ | ||
# it's better to unpack these files and commit the raw source | ||
# git has its own built in compression methods | ||
*.7z | ||
*.dmg | ||
*.gz | ||
*.iso | ||
*.jar | ||
*.rar | ||
*.tar | ||
*.zip | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
*.sql | ||
*.sqlite | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
build/ |
Oops, something went wrong.