Skip to content

Add Board Header Check Action #2519

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

Open
wants to merge 8 commits into
base: develop
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
27 changes: 27 additions & 0 deletions .github/workflows/check_board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Board Headers

on:
push:
paths:
- 'src/boards/include/boards/**'
- 'tools/check_board_header.py'
- 'tools/check_all_board_headers.sh'
- '.github/workflows/check_board.yml'
pull_request:
paths:
- 'src/boards/include/boards/**'
- 'tools/check_board_header.py'
- 'tools/check_all_board_headers.sh'
- '.github/workflows/check_board.yml'

jobs:
check-board-headers:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check Board Headers
run: |
tools/check_all_board_headers.sh
7 changes: 6 additions & 1 deletion tools/check_all_board_headers.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash

EXIT_CODE=0

for HEADER in src/boards/include/boards/*.h; do
tools/check_board_header.py $HEADER
if [[ $? -ne 0 ]]; then
break
EXIT_CODE=1
fi
done

exit $EXIT_CODE
139 changes: 84 additions & 55 deletions tools/check_board_header.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tools/extract_build_defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
class ExceptionGroup(Exception):
def __init__(self, message, errors):
message += "\n" + "\n".join(e.__str__() for e in errors)
message += "\n" + "\n".join(str(e) for e in errors)
super().__init__(message)

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tools/extract_cmake_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
class ExceptionGroup(Exception):
def __init__(self, message, errors):
message += "\n" + "\n".join(e.__str__() for e in errors)
message += "\n" + "\n".join(str(e) for e in errors)
super().__init__(message)

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tools/extract_cmake_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
class ExceptionGroup(Exception):
def __init__(self, message, errors):
message += "\n" + "\n".join(e.__str__() for e in errors)
message += "\n" + "\n".join(str(e) for e in errors)
super().__init__(message)

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tools/extract_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Python <3.11 doesn't have ExceptionGroup, so define a simple one
class ExceptionGroup(Exception):
def __init__(self, message, errors):
message += "\n" + "\n".join(e.__str__() for e in errors)
message += "\n" + "\n".join(str(e) for e in errors)
super().__init__(message)

logger = logging.getLogger(__name__)
Expand Down
Loading