Skip to content

output path

output path #142

Workflow file for this run

name: Linting pipeline
on:
workflow_call:
# push:
# branches-ignore:
# - main
jobs:
lint-python:
runs-on: self-hosted
id: python
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Format Python Code with Black
run: |
black .
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Apply Black formatting" || echo "No changes to commit"
git push origin HEAD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for main branch should verify the ros package gets built sucessfully, unit tests run
# for this, if the normal cpp format dont work with I() then use the ament_lint from ros
lint-cpp:
runs-on: self-hosted
id: cpp
steps:
- name: Checkout Code
uses: actions/checkout@v3
# path agnostic ros2 colcon build
- name: Run Colcon build
- name: Locate and Run Clang-Tidy
run: |
COMPILE_COMMANDS_PATH=$(find build/ -name compile_commands.json | head -n 1)
if [ -z "$COMPILE_COMMANDS_PATH" ]; then
echo "Error: compile_commands.json not found!"
exit 1
fi
echo "Using compile_commands.json located at: $COMPILE_COMMANDS_PATH"
find src/ -name "*.cpp" | xargs clang-tidy --fix --fix-errors -p $(dirname $COMPILE_COMMANDS_PATH)
# Format C++ files with clang-format
- name: Auto-fix C++ Formatting Issues
run: |
find . -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i
- name: Commit and Push Changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Auto-format code with clang-tidy/clang-format" || echo "No changes to commit"
git push origin HEAD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# bug checks
# compilation
# linting/formatting
# Ament_flake8
# Ament_lint_cmake
# Ament_xmllint
# Black
# Clang-tidy
# Isort
# flake8 --fix or autopep8 --in-place --aggressive --aggressive
# git config --global user.email "[email protected]"
# how to run inside container, need to make linting/formatting container w/ git, python, etc.
# git config --global user.name "github-actions"
# git config --global user.email "[email protected]"