-
Notifications
You must be signed in to change notification settings - Fork 1
Add a cmakelint GitHub action #67
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ae9fba1
Add a cmake-lint GitHub action
derobins dc828a3
Fix typo
derobins f1305d5
Try setting up Python a different way
derobins 37566e2
Use xargs
derobins 8264bff
Correct error return code
derobins e67b8ac
Fix indenting
derobins 15e25b5
Pin to Python 3.10
derobins b236e73
Add SHA
derobins 919ad49
Install cmakelang
derobins b2d6100
Oops python package, fix xargs
derobins 8a4bbd8
Use cmakelint instead of cmake-lint
derobins 9d2e6da
Fix cmakelint setup
derobins c53cbb0
Remove obsolete comment
derobins bcc5fc4
Rename cmake-lint to cmakelint
derobins 08592ff
Filter action based on CMake files changing
derobins 581eb53
CUfile --> cuFile in root CMakeLists.txt
derobins 4c35fc8
Fix file filter
derobins 26676bd
Fix quoting
derobins 9c5ec8b
Unquote files
derobins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
| # Run cmakelint over all the repo's CMake files | ||
| name: cmakelint | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '**.cmake' | ||
| - '**/CMakeLists.txt' | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| cmake-lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 #v4.1.7 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 | ||
|
|
||
| - name: Set up cmakelint | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install cmakelint | ||
|
|
||
| - name: Lint all CMake files | ||
| run: | | ||
| FILES=$(find . -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)) | ||
| if [ -z "$FILES" ]; then | ||
| echo "No CMake files found!" | ||
| exit 1 | ||
| fi | ||
| echo "Linting the following files:" | ||
| echo "$FILES" | ||
| cmakelint $FILES | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command
cmakelint $FILESwill fail if any file paths contain spaces because FILES is not quoted. This causes word splitting. Usecmakelint $FILESwith proper quoting or pass files via xargs to handle paths with spaces correctly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No