Skip to content

Commit e0e93bf

Browse files
authored
#20 add imgs & update readme and workflow file (#21)
* feat: add images & update readme and workflow file * Create LICENSE * Add badges
1 parent b5a6a32 commit e0e93bf

File tree

6 files changed

+57
-23
lines changed

6 files changed

+57
-23
lines changed

.github/workflows/test.yml renamed to .github/workflows/cpp-linter.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
name: Test action
1+
name: cpp-linter
22

33
on:
44
push:
55
pull_request:
66
types: [opened]
77

88
jobs:
9-
test:
9+
cpp-linter:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- uses: shenxianpeng/cpp-linter-action@master
13+
- name: C/C++ Lint Action
14+
uses: shenxianpeng/cpp-linter-action@master
1415
id: linter
1516
env:
1617
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 shenxianpeng
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+32-20
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
# C/C++ Lint Action
1+
<p align="center">
2+
<img src="demo/image/logo.png" alt="icon">
3+
</p>
24

3-
Github Actions for linting the C/C++ code. Integrated clang-tidy, clang-format checks.
5+
# C/C++ Lint Action <sub><sup>| clang-format & clang-tidy</sup></sub>
46

5-
## Integration with GitHub Actions
7+
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/shenxianpeng/cpp-linter-action)
8+
[![cpp-linter](https://github.com/shenxianpeng/cpp-linter-action/actions/workflows/cpp-linter.yml/badge.svg)](https://github.com/shenxianpeng/cpp-linter-action/actions/workflows/cpp-linter.yml)
9+
![GitHub](https://img.shields.io/github/license/shenxianpeng/cpp-linter-action)
610

7-
Just create a `yml` file under your GitHub repository. For example `.github/workflows/cpp-linter.yml`
11+
Github Actions for linting C/C++ code. Integrated clang-tidy, clang-format check.
812

9-
!!! Requires `secrets.GITHUB_TOKEN` set to an environment variable named `GITHUB_TOKEN`.
13+
## Usage
1014

11-
```yml
15+
Create a new GitHub Actions workflow in your project, e.g. at `.github/workflows/cpp-linter.yml`
16+
17+
The conetent of the file should be in the following format.
18+
19+
```yaml
1220
name: cpp-linter
1321

1422
# Triggers the workflow on push or pull request events
@@ -28,30 +36,34 @@ jobs:
2836
with:
2937
style: 'file'
3038
```
31-
## Optional Inputs
3239
33-
| Input name | default value | Description |
40+
`GITHUB_TOKEN` - Provided by Github (see [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow))
41+
42+
### Optional Inputs
43+
44+
| Name | Default | Description |
3445
|------------|---------------|-------------|
35-
| style | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
36-
| extensions | 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | The file extensions to run the action against. This is a comma-separated string. |
37-
| tidy-checks | 'boost-\*,bugprone-\*,performance-\*,<br>readability-\*,portability-\*,<br>modernize-\*,clang-analyzer-\*,<br>cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
38-
| repo-root | '.' | The relative path to the repository root directory. This path is relative to path designated by the runner's GITHUB_WORKSPACE environment variable. |
39-
| version | '10' | The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, 12. |
46+
| `style` | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
47+
| `extensions` | 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | The file extensions to run the action against. This is a comma-separated string. |
48+
| `tidy-checks` | 'boost-\*,bugprone-\*,performance-\*,<br>readability-\*,portability-\*,<br>modernize-\*,clang-analyzer-\*,<br>cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
49+
| `repo-root` | '.' | The relative path to the repository root directory. This path is relative to path designated by the runner's GITHUB_WORKSPACE environment variable. |
50+
| `version` | '10' | The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, 12. |
4051

4152
### Outputs
4253

4354
This action creates 1 output variable named `checks-failed`. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's output to exit the workflow early if that is desired.
4455

45-
## Results of GitHub Actions
56+
## Example
57+
58+
![github-actions bot](./demo/image/result.png)
4659

47-
![github-actions bot](./demo/result.png)
60+
Example comment is [here](https://github.com/shenxianpeng/cpp-linter-action/pull/5#commitcomment-55252014).
4861

49-
Behind the scenes, this is because this repository has added `test.yml` under `.github/workflows/`. When an unformatted C/C++ source file was committed and create a Pull Request will automatically recognize and add warning comments.
62+
## Have question or feedback?
5063

51-
Please feel free to commit code to the `test` branch of this repository or create a Pull Request to see how the process works.
64+
To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/shenxianpeng/cpp-linter-action/issues).
5265

53-
For example, this test PR [#6](https://github.com/shenxianpeng/cpp-linter-action/pull/5) and github-actions bot comments [link](https://github.com/shenxianpeng/cpp-linter-action/pull/5#commitcomment-55252014).
5466

55-
## Contribution
67+
## License
5668

57-
If you have any suggestions or contributions, welcome to PR [here](https://github.com/shenxianpeng/cpp-linter-action).
69+
The scripts and documentation in this project are released under the [MIT License](LICENSE)

demo/image/icon.png

4.25 KB
Loading

demo/image/logo.png

4.69 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)