Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: |
npm install
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- run: |
npm install
- run: |
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Depending on the project type and the build system you are using (Make, CMake, e
```yaml
# Runs code analysis with C/C++test.
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
input: build/compile_commands.json
testConfig: 'builtin://MISRA C 2012'
Expand Down Expand Up @@ -68,7 +68,7 @@ To upload reports in other formats, modify your workflow by adding the `upload-
# Uploads an archive that includes all report files (.xml, .html, .sarif).
- name: Archive reports
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: CpptestReports
path: reports/*.*
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:

# Checks out your repository under $GITHUB_WORKSPACE, so that your job can access it.
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

# Configures your CMake project. Be sure the compile_commands.json file is created.
- name: Configure project
Expand All @@ -128,7 +128,7 @@ jobs:
# Runs code analysis with C/C++test.
- name: Run C/C++test
# Use the 'run-cpptest-action' GitHub action.
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
# Optional parameters for 'run-cpptest-action'.
with:
# For CMake-based projects, use a compile_commands.json file as the input for analysis.
Expand All @@ -147,7 +147,7 @@ jobs:
# Uploads an archive that includes all report files (.xml, .html, .sarif).
- name: Archive reports
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: CpptestReports
path: reports/*.*
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:

# Checks out your repository under $GITHUB_WORKSPACE, so that your job can access it.
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

# Builds your Make project using 'cpptesttrace' to collect input data for code analysis.
# Be sure 'cpptesttrace' is available on $PATH.
Expand All @@ -202,7 +202,7 @@ jobs:
# Runs code analysis with C/C++test.
- name: Run C/C++test
# Use the 'run-cpptest-action' GitHub action.
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
# Uncomment if you are using C/C++test 2020.2 to generate a SARIF report:
# with:
# reportFormat: xml,html,custom
Expand All @@ -218,7 +218,7 @@ jobs:
# Uploads an archive that includes all report files (.xml, .html, .sarif).
- name: Archive reports
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: CpptestReports
path: reports/*.*
Expand All @@ -237,7 +237,7 @@ If `cpptestcli` executable is not on `$PATH`, you can configure the path to the

```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
installDir: '/opt/parasoft/cpptest'
```
Expand All @@ -246,7 +246,7 @@ If `cpptestcli` executable is not on `$PATH`, you can configure the path to the
You can configure the `input` parameter to provide the path to a file that defines the scope of analysis (includes a list of source files and compile commands). This parameter depends on the project type and the build system you are using. See the [C/C++test User Guide](https://docs.parasoft.com/display/CPPTEST20251/Running+Static+Analysis+1) for details.
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
input: 'build/compile_commands.json'
```
Expand All @@ -256,7 +256,7 @@ Code analysis with C/C++test is performed by using a test configuration - a set
To specify a test configuration directly in your workflow, add the `testConfig` parameter to the `Run C/C++test` action and specify the URL of the test configuration you want to use:
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
testConfig: 'builtin://MISRA C 2012'
```
Expand All @@ -265,7 +265,7 @@ To specify a test configuration directly in your workflow, add the `testConfig`
In order to run analysis, C/C++test needs to be configured for a specific compiler. You need to specify the configuration that matches your compiler with the `compilerConfig` parameter. See [Supported Compilers](https://docs.parasoft.com/display/CPPTEST20251/Supported+Compilers) for information about supported compilers.
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
compilerConfig: 'clang_10_0'
```
Expand All @@ -274,7 +274,7 @@ In order to run analysis, C/C++test needs to be configured for a specific compil
Generating reports in the SARIF format is available in C/C++test since version 2021.1. If you are using an earlier C/C++test version, you need to customize the `Run C/C++test` action to enable generating SARIF reports:
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
reportFormat: xml,html,custom
additionalParams: '-property report.custom.extension=sarif -property report.custom.xsl.file=${PARASOFT_SARIF_XSL}'
Expand Down Expand Up @@ -321,7 +321,7 @@ This section describes how to customize the `Run C/C++test` action to run code a
Use the `commandLinePattern` parameter to modify the command line for `cpptestcli` executable. The command line pattern depends on your project and the setup of the workspace. Example:
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
# C/C++test workspace will be created in '../workspace'.
# C/C++test will create a new project based on the provided .bdf file.
Expand All @@ -333,7 +333,7 @@ Note: The `compilerConfig` and `reportFormat` action parameters are not directly
Create a `config.properties` file with additional configuration options for C/C++test Professional, such as reporting options, compiler configuration etc. Then pass the configuration file to `cpptestcli` with the `-localsettings config.properties` option:
```yaml
- name: Run C/C++test
uses: parasoft/run-cpptest-action@2.0.2
uses: parasoft/run-cpptest-action@2.0.3
with:
# C/C++test will use options from 'config.properties'.
additionalParams: '-localsettings config.properties'
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ inputs:
description: 'Command line pattern for running C/C++test.'
required: false
default: '${cpptestcli} -compiler "${compilerConfig}" -config "${testConfig}" -property report.format=${reportFormat} -report "${reportDir}" -module . -input "${input}" ${additionalParams}'
outputs:
exitCode:
description: 'Exit code from the C/C++test analysis run.'
hasViolations:
description: 'Whether static analysis violations were found.'
Copy link
Copy Markdown

@pkrukp pkrukp May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we explicitly what are the possible values? (i.e. "true", "false")
So that user won't consider things like "0", "1".

Suggested change
description: 'Whether static analysis violations were found.'
description: '"true" if static analysis violations were found, "false" otherwise.'

runs:
using: 'node20'
using: 'node24'
main: 'dist/index.js'
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,9 @@ async function run() {
core.info(messages_1.messages.run_started + runOptions.workingDir);
const theRunner = new runner.AnalysisRunner();
const outcome = await theRunner.run(runOptions);
const hasViolations = (outcome.exitCode & 2) === 2;
core.setOutput("exitCode", outcome.exitCode.toString());
core.setOutput("hasViolations", hasViolations.toString());
if (outcome.exitCode != 0) {
core.setFailed(messages_1.messages.failed_run_non_zero + outcome.exitCode);
}
Expand Down
Loading