Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
feat: add clang-format version parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
DoozyX committed Dec 7, 2019
1 parent 4db613f commit 0138140
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 7 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ARG CLANG_VERSION=9.0.0

FROM doozy/clang-format:${CLANG_VERSION} as clang-format-bin
FROM python:3-alpine

COPY --from=clang-format-bin /usr/bin/clang-format /usr/bin/
COPY run-clang-format.py /run-clang-format.py
COPY entrypoint.sh /entrypoint.sh
COPY clang-format/ /clang-format/

ENTRYPOINT ["/entrypoint.sh"]
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ What filename extensions should be used for format checking.\
Default: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'\
Example: 'cpp,h'

### `clangFormatVersion`

What clang-format version should be used.\
Available version are from 5 to 9.\
Default: 9\
Example: 9

## Example usage

```yml
Expand All @@ -35,9 +42,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: DoozyX/clang-format-lint-action@v0.4.1
- uses: DoozyX/clang-format-lint-action@v0.5
with:
source: '.'
exclude: './third_party'
extensions: 'h,cpp'
clangFormatVersion: 9
```
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ inputs:
description: 'List of extensions to check'
required: false
default: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
clangFormatVersion:
description: 'Version of clang-format'
required: false
default: '9'
runs:
using: 'docker'
image: 'docker://doozy/clang-format-lint:0.4'
image: 'docker://doozy/clang-format-lint:0.5'
args:
- ${{ inputs.source }}
- ${{ inputs.exclude }}
- ${{ inputs.extensions }}
- ${{ inputs.extensions }}
- ${{ inputs.clangFormatVersion }}
Binary file added clang-format/clang-format5
Binary file not shown.
Binary file added clang-format/clang-format6
Binary file not shown.
Binary file added clang-format/clang-format7
Binary file not shown.
Binary file added clang-format/clang-format8
Binary file not shown.
Binary file added clang-format/clang-format9
Binary file not shown.
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh -l

cd "$GITHUB_WORKSPACE"

ln -s /clang-format/clang-format${INPUT_CLANGFORMATVERSION} /usr/bin/clang-format
/run-clang-format.py -r --exclude ${INPUT_EXCLUDE} --extensions ${INPUT_EXTENSIONS} ${INPUT_SOURCE}

0 comments on commit 0138140

Please sign in to comment.