Skip to content

Commit f44c52f

Browse files
committed
Document SARIF reporting for older versions of C/C++test
1 parent c5f2aa8 commit f44c52f

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ Depending on the project type and the build system used (Make, CMake, etc.), you
2929
The following examples show simple workflows made up of one job "Analyze project with C/C++test" for Make and CMake based projects. The example assumes that C/C++test is run on a self-hosted runner and the path to `cpptestcli` executable is available on `$PATH`.
3030

3131
### Uploading Analysis Results to GitHub
32-
By default, the `Run C/C++test` action generates analysis reports in SARIF, XML and HTML format.
32+
By default, the `Run C/C++test` action generates analysis reports in SARIF, XML and HTML format (see also: [Enabling SARIF reports for older versions of C/C++test](#enabling-sarif-reports-for-older-versions-of-cctest)).
3333

3434
When you upload the SARIF report to GitHub, the results will be presented as GitHub code scanning alerts. This allows you to review the results of code analysis with Parasoft C/C++test directly on GitHub as part of your project.
3535
To upload the SARIF report to GitHub, modify your workflow to add the `upload-sarif` action.
3636

37+
38+
39+
3740
You can also upload other reports (XML, HTML) to GitHub and link them with your workflow by using the `upload-artifact` action.
3841

3942
### Examples
@@ -85,6 +88,9 @@ jobs:
8588
with:
8689
# For CMake-based projects, use compile_commands.json file as the input to analysis.
8790
input: build/compile_commands.json
91+
# Uncomment for C/C++test 2020.2 to generate SARIF report:
92+
# reportFormat: xml,html,custom
93+
# additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
8894

8995
# Upload analysis results in SARIF format, so they are available as GitHub code scanning alerts.
9096
- name: Upload results (SARIF)
@@ -142,6 +148,10 @@ jobs:
142148
- name: Run C/C++test
143149
# Use dedicated 'run-cpptest-action' GitHub Action.
144150
uses: parasoft/run-cpptest-action@1.0.0
151+
# Uncomment for C/C++test 2020.2 to generate SARIF report:
152+
# with:
153+
# reportFormat: xml,html,custom
154+
# additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
145155

146156
# Upload analysis results in SARIF format, so they are available as GitHub code scanning alerts.
147157
- name: Upload results (SARIF)
@@ -203,6 +213,17 @@ In order to run analysis, C/C++test needs to be configured for specific compiler
203213
compilerConfig: 'clang_10_0'
204214
```
205215

216+
#### Enabling SARIF reports for older versions of C/C++test
217+
Ability to generate SARIF reports is available for C/C++test 2021.1 or newer.
218+
For older versions, the following customization will enable SARIF-format reporting:
219+
```yaml
220+
- name: Run C/C++test
221+
uses: parasoft/run-cpptest-action@1.0.0
222+
with:
223+
reportFormat: xml,html,custom
224+
additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
225+
```
226+
206227
## Optional Parameters
207228
The following inputs are available for this action:
208229
| Input | Description |

samples/cpptest-cmake.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
uses: parasoft/run-cpptest-action@0.1.7-alpha
2828
with:
2929
input: build/compile_commands.json
30+
# Uncomment for C/C++test 2020.2 to generate SARIF report:
31+
# reportFormat: xml,html,custom
32+
# additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
3033

3134
- name: Upload results (Sarif)
3235
uses: github/codeql-action/upload-sarif@v1

samples/cpptest-make.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222

2323
- name: Run C/C++test
2424
uses: parasoft/run-cpptest-action@0.1.7-alpha
25+
# Uncomment for C/C++test 2020.2 to generate SARIF report:
26+
# with:
27+
# reportFormat: xml,html,custom
28+
# additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
2529

2630
- name: Upload results (Sarif)
2731
uses: github/codeql-action/upload-sarif@v1

0 commit comments

Comments
 (0)