-
Notifications
You must be signed in to change notification settings - Fork 1
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
15 changed files
with
1,770 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="." | ||
DIRS_OUT="scripts" | ||
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,40 @@ | ||
name: CI 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-14 -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,74 @@ | ||
# Based on GTSAM file (by @ProfFan) | ||
name: CI Build colcon | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build_docker: # On Linux, iterates on all ROS 1 and ROS 2 distributions. | ||
runs-on: ubuntu-latest | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
strategy: | ||
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. | ||
# ros_distribution: | ||
# - humble | ||
# - iron | ||
# - rolling | ||
|
||
# Define the Docker image(s) associated with each ROS distribution. | ||
# The include syntax allows additional variables to be defined, like | ||
# docker_image in this case. See documentation: | ||
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build | ||
# | ||
# Platforms are defined in REP 3 and REP 2000: | ||
# https://ros.org/reps/rep-0003.html | ||
# https://ros.org/reps/rep-2000.html | ||
include: | ||
# Humble Hawksbill (May 2022 - May 2027) | ||
- docker_image: ubuntu:jammy | ||
ros_distribution: humble | ||
ros_version: 2 | ||
|
||
# Iron Irwini (May 2023 - November 2024) | ||
- docker_image: ubuntu:jammy | ||
ros_distribution: iron | ||
ros_version: 2 | ||
|
||
# Jazzy (2024 - ??) | ||
- docker_image: ubuntu:noble | ||
ros_distribution: jazzy | ||
ros_version: 2 | ||
|
||
# Rolling Ridley (No End-Of-Life) | ||
# - docker_image: ubuntu:noble | ||
# ros_distribution: rolling | ||
# ros_version: 2 | ||
|
||
container: | ||
image: ${{ matrix.docker_image }} | ||
|
||
steps: | ||
- name: Checkout | ||
run: | | ||
apt-get -y update | ||
apt-get -y install git | ||
git clone https://github.com/$GITHUB_REPOSITORY.git --recursive "$GITHUB_WORKSPACE" | ||
- name: setup ROS environment | ||
uses: ros-tooling/[email protected] | ||
with: | ||
required-ros-distributions: ${{ matrix.ros_distribution }} | ||
|
||
- name: Install rosdep dependencies | ||
run: | | ||
. /opt/ros/*/setup.sh | ||
rosdep update | ||
rosdep install --from-paths . --ignore-src -r -y | ||
- name: Build with colcon | ||
run: | | ||
. /opt/ros/*/setup.sh | ||
env | ||
MAKEFLAGS="-j2" colcon build --symlink-install --parallel-workers 2 --event-handlers console_direct+ |
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
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.