File: cppcheck-premium.yml

package info (click to toggle)
cppcheck 2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 26,412 kB
  • sloc: cpp: 272,462; python: 22,408; ansic: 8,088; sh: 1,059; makefile: 1,041; xml: 987; cs: 291
file content (72 lines) | stat: -rw-r--r-- 2,553 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: cppcheck-premium

on:
  push:
    branches:
      - 'main'
      - 'releases/**'
      - '2.*'
    tags:
      - '2.*'
  pull_request:
  workflow_dispatch:
    inputs:
      premium_version:
        description: 'Cppcheck Premium version'

permissions:
  contents: read
  security-events: write

jobs:

  build:
    runs-on: ubuntu-24.04 # run on the latest image only
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

      - name: Download cppcheckpremium release
        run: |
          premium_version=${{ inputs.premium_version }}
          if [ -z $premium_version ]; then
            premium_version=25.8.3
            #wget https://files.cppchecksolutions.com/devdrop/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz
            wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz
          else
            wget https://files.cppchecksolutions.com/$premium_version/ubuntu-24.04/cppcheckpremium-$premium_version-amd64.tar.gz -O cppcheckpremium.tar.gz
          fi
          tar xzf cppcheckpremium.tar.gz
          mv cppcheckpremium-$premium_version cppcheckpremium

      - name: Generate a license file
        run: |
          echo cppcheck > cppcheck.lic
          echo 251231 >> cppcheck.lic
          echo 80000 >> cppcheck.lic
          echo 4f8dc8e7c8bb288f >> cppcheck.lic
          echo path:lib >> cppcheck.lic

      - name: Check
        run: |
          cppcheckpremium/premiumaddon --check-loc-license cppcheck.lic > cppcheck-premium-loc
          cppcheckpremium/cppcheck --premium=safety-off -j$(nproc) -D__GNUC__ -D__CPPCHECK__ --suppressions-list=cppcheckpremium-suppressions --platform=unix64 --enable=style --premium=misra-c++-2023 --premium=cert-c++-2016 --inline-suppr lib --error-exitcode=0 --output-format=sarif 2> results.sarif

      - name: Cat results
        run: |
          #sed -i 's|"security-severity":.*||' results.sarif
          cat results.sarif

      - uses: actions/upload-artifact@v4
        with:
          name: results
          path: results.sarif

      - name: Upload report
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results.sarif
          category: cppcheckpremium