91 lines
3.0 KiB
YAML
91 lines
3.0 KiB
YAML
name: Run PVS-Studio Analysis
|
|
inputs:
|
|
pvsUsername:
|
|
description: PVS-Studio License Username
|
|
required: true
|
|
pvsKey:
|
|
description: PVS-Studio License Key
|
|
required: true
|
|
target:
|
|
description: Build Target
|
|
required: true
|
|
config:
|
|
description: Build Configuration
|
|
required: true
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Setup PVS-Studio
|
|
shell: pwsh
|
|
run: |
|
|
choco install pvs-studio --version=7.30.81185.980 -y --no-progress
|
|
|
|
- name: Activate PVS-Studio
|
|
shell: pwsh
|
|
run: |
|
|
. ${env:GITHUB_ACTION_PATH}\Invoke-External.ps1
|
|
Invoke-External "C:\Program Files (x86)\PVS-Studio\PVS-Studio_Cmd.exe" credentials -u ${{ inputs.pvsUsername }} -n ${{ inputs.pvsKey }}
|
|
|
|
- name: Run PVS-Studio Analysis
|
|
shell: pwsh
|
|
run: |
|
|
[flags()] Enum PVSErrorCodes {
|
|
Success = 0
|
|
AnalyzerCrash = 1
|
|
GenericError = 2
|
|
InvalidCommandLine = 4
|
|
FileNotFound = 8
|
|
ConfigurationNotFound = 16
|
|
InvalidProject = 32
|
|
InvalidExtension = 64
|
|
LicenseInvalid = 128
|
|
CodeErrorsFound = 256
|
|
SuppressionFailed = 512
|
|
LicenseExpiringSoon = 1024
|
|
}
|
|
|
|
$pvsParams = @(
|
|
"--progress"
|
|
"--disableLicenseExpirationCheck"
|
|
"-p", "${{ inputs.target }}"
|
|
"-c", "${{ inputs.config }}"
|
|
"-t", "${{ github.workspace }}\build_x64\obs-studio.sln"
|
|
"-o", "${{ github.workspace }}\analysis.plog"
|
|
"-C", "${env:GITHUB_ACTION_PATH}\obs.pvsconfig"
|
|
)
|
|
& "C:\Program Files (x86)\PVS-Studio\PVS-Studio_Cmd.exe" @pvsParams
|
|
|
|
# Success, LicenseExpiringSoon, and CodeErrorsFound are fine as error codes, we only care if it is anything but those
|
|
$pvs_result = $LASTEXITCODE -band (-bnot ([PVSErrorCodes]::CodeErrorsFound -bor [PVSErrorCodes]::LicenseExpiringSoon))
|
|
if ($pvs_result -ne 0) {
|
|
Write-Output "PVS-Studio Errors: $([PVSErrorCodes]$pvs_result)"
|
|
}
|
|
exit $pvs_result
|
|
|
|
- name: Convert Analysis to SARIF
|
|
shell: pwsh
|
|
run: |
|
|
. ${env:GITHUB_ACTION_PATH}\Invoke-External.ps1
|
|
|
|
$conversionParams = @(
|
|
"-a", "GA:1,2",
|
|
"-d", "V1042,Renew"
|
|
"-t", "Sarif"
|
|
"${{ github.workspace }}\analysis.plog"
|
|
)
|
|
Invoke-External "C:\Program Files (x86)\PVS-Studio\PlogConverter.exe" @conversionParams
|
|
|
|
- name: Upload PVS-Studio Logs
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: 'pvs-analysis-log'
|
|
path: |
|
|
${{ github.workspace }}/analysis.plog
|
|
${{ github.workspace }}/analysis.plog.sarif
|
|
|
|
- name: Upload PVS-Studio Report
|
|
uses: github/codeql-action/upload-sarif@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
|
|
with:
|
|
sarif_file: "${{ github.workspace }}/analysis.plog.sarif"
|
|
category: 'PVS-Studio (Windows)'
|