-
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.
Fully intraged Github Action with the python script to check cmake fo…
…rmatting (#2) * list files on entry point * Test with script run * Remove default value for inplace input * Set inplace default value to False * Remove all inputs except for source dir * install pip package * Delegate cmakelang package to the Dockerfile * Fix source input to support multiple values * Fix config inplace flag * Fix exclude/source parsing * Parse exclude dirs the same way as source dirs * Update Action README
- Loading branch information
Genci Berisha
authored
Oct 14, 2023
1 parent
5687f9f
commit e07a16b
Showing
8 changed files
with
82 additions
and
59 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
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 |
---|---|---|
@@ -1,9 +1,43 @@ | ||
# cmake-format with diff output | ||
# cmake-format lint GitHub Action | ||
|
||
This action checks if the cmake files matches the .cmake-format file. | ||
GitHub Action to check if your code is formatted correctly using cmake-format. | ||
|
||
``` | ||
$ python3 cmake_format_runner.py ./ | ||
``` | ||
This action also provides a Git diff display, making it easy to review code formatting changes. | ||
|
||
TBA | ||
|
||
## Usage | ||
|
||
### Inputs | ||
|
||
- `source` (optional): Source file/folder to check formatting or directory path. Defaults to "." (current directory). You can specify multiple values separated by spaces. | ||
- `exclude` (optional): Folders to exclude from the formatting check. Defaults to "none." You can specify multiple values separated by spaces. | ||
- `config` (optional): Use .cmake-format style. Defaults to False. | ||
- `inplace` (optional): Just fix files (`cmake-format -i`) instead of returning a diff. Defaults to False. | ||
|
||
### Example Workflow | ||
|
||
Here's an example of how to use this action in your GitHub Actions workflow: | ||
|
||
```yaml | ||
name: Check Code Formatting | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
format-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: cmake-format lint | ||
uses: neg-c/[email protected] | ||
with: | ||
source: "src/module1 src/module2" | ||
exclude: "thirdparty external" | ||
config: true | ||
inplace: true | ||
|
||
``` |
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
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
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
cd "$GITHUB_WORKSPACE" | ||
|
||
python3 cmake-format/main.py | ||
python3 /cmake-format/main.py "$@" |