Run PVS-Studio static analyzer as part of CI/CD

This commit is contained in:
Nikolaj Schlej 2022-09-02 22:09:47 +02:00
parent 3977fcaed9
commit 787e02181a
2 changed files with 49 additions and 4 deletions

View File

@ -192,13 +192,13 @@ jobs:
JOB_TYPE: COVERITY JOB_TYPE: COVERITY
HAS_QT: 1 HAS_QT: 1
if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request' if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request'
name: Coverity name: Coverity Static Analysis
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
with: with:
version: '6.2.4' version: '6.3.1'
host: 'linux' host: 'linux'
target: 'desktop' target: 'desktop'
@ -215,3 +215,47 @@ jobs:
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }} COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
COVERITY_BUILD_COMMAND: ./unixbuild.sh --build COVERITY_BUILD_COMMAND: ./unixbuild.sh --build
analyze_pvs_studio:
if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request'
name: PVS-Studio Static Analysis
runs-on: ubuntu-latest
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.3.1'
host: 'linux'
target: 'desktop'
- name: Check out
uses: actions/checkout@v2
- name: Install PVS-Studio
run: |
wget -q -O - https://files.pvs-studio.com/etc/pubkey.txt \
| sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/viva64.list \
https://files.pvs-studio.com/etc/viva64.list
sudo apt update
sudo apt install pvs-studio
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
- name: Build
run: |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=On -B build UEFITool
cmake --build build -j
- name: Analyze
run: |
pvs-studio-analyzer analyze -f build/compile_commands.json -j
- name: Convert report
run: |
plog-converter -t sarif -o pvs-report.sarif PVS-Studio.log
- name: Publish report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: pvs-report.sarif
category: PVS-Studio

View File

@ -148,4 +148,5 @@ TARGET_LINK_LIBRARIES(UEFITool PRIVATE Qt6::Widgets)
SET_TARGET_PROPERTIES(UEFITool PROPERTIES SET_TARGET_PROPERTIES(UEFITool PROPERTIES
WIN32_EXECUTABLE ON WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON MACOSX_BUNDLE ON
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/Info.plist"
)