changed to single thread extermination #165
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
name: Linting pipeline | |
run-name: Linting pipeline triggered by ${{ github.actor }} | |
on: | |
workflow_call: | |
# push: | |
# branches-ignore: | |
# - main | |
jobs: | |
lint-python: | |
runs-on: self-hosted | |
id: python | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Print branch | |
run: | | |
echo "Checked out branch: ${{ github.head_ref }}" | |
- name: Show directory contents | |
run: | | |
echo "Current directory: $(pwd)" | |
echo "Directory contents:" | |
ls -la | |
- name: List files in the repository | |
run: | | |
echo "github workspace folder" | |
ls ${{ github.workspace }} | |
- name: Check current directory | |
run: pwd | |
- name: List files in current directory | |
run: ls -la | |
- name: List root directory | |
run: ls -la / | |
- name: List runner's work directory | |
run: ls -la /home/runner/work | |
- name: List GitHub workspace directory | |
run: ls -la ${{ github.workspace }} | |
- name: Show environment variables | |
run: env | |
- 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]" |