-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM unibeautify/clang-format:latest as clang-format-bin | ||
FROM python:3-alpine | ||
|
||
COPY --from=clang-format-bin /usr/bin/clang-format /usr/bin/ | ||
COPY run-clang-format/run-clang-format.py /run-clang-format.py | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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 +1,37 @@ | ||
# clang-format-lint-action | ||
# clang-format lint action | ||
|
||
This action check if the source code matches the .clang-format file. | ||
|
||
## Inputs | ||
|
||
### `source` | ||
|
||
**Required** Where the soruce files are located. | ||
|
||
### `exclude` | ||
|
||
What folder should be exlcuded from format checking. | ||
|
||
### `extensions` | ||
|
||
What extensions should be used from format checking. | ||
|
||
## Example usage | ||
|
||
```yml | ||
name: test-clang-format | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: ./.github/actions/test-clang-format | ||
with: | ||
source: '.' | ||
exclude: './src' | ||
extensions: 'cpp' | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'clang-format lint' | ||
author: 'DoozyX' | ||
description: 'Github Action that check if code is formatted correctly using clang-format' | ||
branding: | ||
icon: 'align-left' | ||
color: 'green' | ||
inputs: | ||
source: | ||
description: 'Source folder to check formatting' | ||
required: false | ||
default: '.' | ||
exclude: | ||
description: 'Folder to exclude from formatting check' | ||
required: false | ||
default: '' | ||
extensions: | ||
description: 'List of extensions to check' | ||
required: false | ||
default: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.source }} | ||
- ${{ inputs.exclude }} | ||
- ${{ inputs.extensions }} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh -l | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
/run-clang-format.py -r --exclude ${INPUT_EXCLUDE} --extensions ${INPUT_EXTENSIONS} ${INPUT_SOURCE} |