|
74 | 74 |
|
75 | 75 | #### `version`
|
76 | 76 |
|
77 |
| -- **Description**: The desired version of the [clang-tools](https://hub.docker.com/r/xianpengshen/clang-tools) to use. Accepted options are strings which can be 14, 13, 12, 11, 10, 9, or 8. |
| 77 | +- **Description**: The desired version of the [clang-tools](https://github.com/cpp-linter/clang-tools-pip) to use. Accepted options are strings which can be 14, 13, 12, 11, 10, 9, 8,7, 6, 5, 4 or 3.9. |
78 | 78 | - Set this option to a blank string (`''`) to use the platform's default installed version.
|
79 |
| - - This value can also be a path to where the clang tools are installed (if using a custom install location). Because all paths specified here are converted to absolute, using a relative path as a value may not be compatible when using the docker environment (see [Running without the docker container](#running-without-the-docker-container)). |
| 79 | + - This value can also be a path to where the clang tools are installed (if using a custom install location). |
80 | 80 | - Default: '12'
|
81 | 81 |
|
82 | 82 | #### `verbosity`
|
@@ -130,106 +130,12 @@ jobs:
|
130 | 130 | #### `database`
|
131 | 131 |
|
132 | 132 | - **Description**: The directory containing compilation database (like compile_commands.json) file.
|
133 |
| - - This option doesn't seems to work properly from the docker environment. Instead we recommend using this option when see [running without the docker container](#running-without-the-docker-container). |
134 | 133 | - Default: ''
|
135 | 134 |
|
136 | 135 | ### Outputs
|
137 | 136 |
|
138 | 137 | 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.
|
139 | 138 |
|
140 |
| -## Running without the docker container |
141 |
| - |
142 |
| -Some Continuous Integration environments require access to non-default compilers |
143 |
| -and/or non-standard libraries. To do this properly, the docker container should |
144 |
| -not be used due to it's isolated file system. Instead, you should use this action's |
145 |
| -python source code as an installed python package (see below). |
146 |
| - |
147 |
| -### Using the python source code |
148 |
| - |
149 |
| -This action was originally designed to only be used on a runner with the Ubuntu |
150 |
| -Operating System. However, this action's source code (essentially a python package) |
151 |
| -can be used on any runner using the Windows, Ubuntu, or possibly even MacOS (untested) |
152 |
| -virtual environments. |
153 |
| - |
154 |
| -Note, some runners already ship with clang-format and/or clang-tidy. As of this writing, the following versions of clang-format and clang-tidy are already available: |
155 |
| - |
156 |
| -- `ubuntu-latest` ships with v10, v11, and v12. [More details](https://github.com/actions/virtual-environments/blob/ubuntu20/20220508.1/images/linux/Ubuntu2004-Readme.md). |
157 |
| -- `windows-latest` ships with v13. [More details](https://github.com/actions/virtual-environments/blob/win22/20220511.2/images/win/Windows2022-Readme.md). |
158 |
| -- `macos-latest` ships with v13. [More details](https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md). |
159 |
| - |
160 |
| -This example makes use of another action |
161 |
| -([KyleMayes/install-llvm-action](https://github.com/KyleMayes/install-llvm-action)) |
162 |
| -to install a certain version of clang-tidy and clang-format. |
163 |
| - |
164 |
| -```yml |
165 |
| -on: |
166 |
| - pull_request: |
167 |
| - types: [opened, reopened] # let PR-synchronize events be handled by push events |
168 |
| - push: |
169 |
| - |
170 |
| -jobs: |
171 |
| - cpp-linter: |
172 |
| - runs-on: windows-latest |
173 |
| - |
174 |
| - steps: |
175 |
| - - uses: actions/checkout@v3 |
176 |
| - - uses: actions/setup-python@v4 |
177 |
| - |
178 |
| - # this step can be skipped if the desired |
179 |
| - # version already comes with the runner's OS |
180 |
| - - name: Install clang-tools |
181 |
| - uses: KyleMayes/install-llvm-action@v1 |
182 |
| - with: |
183 |
| - # v13 is the recommended minimum for the Visual Studio compiler (on Windows) |
184 |
| - version: 14 |
185 |
| - # specifying an install path is required (on Windows) because installing |
186 |
| - # multiple versions on Windows runners needs non-default install paths. |
187 |
| - directory: ${{ runner.temp }}/llvm |
188 |
| - |
189 |
| - - name: Install linter python package |
190 |
| - run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1 |
191 |
| - |
192 |
| - - name: run linter as a python package |
193 |
| - id: linter |
194 |
| - # Pass the installed path to the '--version' argument. |
195 |
| - # Alternatively, pass the version number. |
196 |
| - # Example. run: cpp-linter --version=14 |
197 |
| - # Omit the version option if using the default version available in the OS. |
198 |
| - run: cpp-linter --version=${{ runner.temp }}/llvm |
199 |
| - |
200 |
| - - name: Fail fast?! |
201 |
| - if: steps.linter.outputs.checks-failed > 0 |
202 |
| - run: echo "Some files failed the linting checks!" |
203 |
| - # for actual deployment |
204 |
| - # run: exit 1 |
205 |
| -``` |
206 |
| - |
207 |
| -All input options listed above are specified by pre-pending a `--`. You can also install this repo locally and run `cpp-linter -h` for more detail. For example: |
208 |
| - |
209 |
| -```yaml |
210 |
| - - uses: cpp-linter/cpp-linter-action@v1 |
211 |
| - with: |
212 |
| - style: file |
213 |
| - tidy-checks: '-*' |
214 |
| - files-changed-only: false |
215 |
| - ignore: 'dist/third-party-lib' |
216 |
| -``` |
217 |
| -
|
218 |
| -is equivalent to |
219 |
| -
|
220 |
| -```yaml |
221 |
| - - name: Install linter python package |
222 |
| - run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1 |
223 |
| - |
224 |
| - - name: run linter as a python package |
225 |
| - run: | |
226 |
| - cpp-linter \ |
227 |
| - --style=file \ |
228 |
| - --tidy-checks='-*' \ |
229 |
| - --files-changed-only=false \ |
230 |
| - --ignore='dist/third-party-lib' |
231 |
| -``` |
232 |
| -
|
233 | 139 | ## Example
|
234 | 140 |
|
235 | 141 | <!--intro-end-->
|
|
0 commit comments