Skip to content

Commit 3f46991

Browse files
committed
add clang scan-build analysis
1 parent 37bd977 commit 3f46991

File tree

2 files changed

+56
-41
lines changed

2 files changed

+56
-41
lines changed
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/usr/bin/env bash
22

3-
sudo apt install -y cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev
4-
mkdir build && cd build
5-
cmake ..
6-
make -j`nproc`
3+
sudo apt-get install -y --no-install-recommends \
4+
git cmake pkg-config ninja-build clang clang-tools \
5+
libgl-dev libgles-dev libegl-dev libvulkan-dev libdrm-dev libgbm-dev libsystemd-dev libinput-dev libudev-dev libxkbcommon-dev \
6+
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
7+
8+
$WRAPPER cmake \
9+
-S . -B build \
10+
-GNinja \
11+
-DCMAKE_BUILD_TYPE=Debug \
12+
-DBUILD_GSTREAMER_VIDEO_PLAYER_PLUGIN=ON \
13+
-DBUILD_GSTREAMER_AUDIO_PLAYER_PLUGIN=ON \
14+
-DENABLE_VULKAN=ON \
15+
-DENABLE_SESSION_SWITCHING=ON
16+
17+
$WRAPPER cmake --build build

.github/workflows/codeql.yml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,13 @@ on:
2222
jobs:
2323
analyze:
2424
name: Analyze
25-
# Runner size impacts CodeQL analysis time. To learn more, please see:
26-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27-
# - https://gh.io/supported-runners-and-hardware-resources
28-
# - https://gh.io/using-larger-runners
29-
# Consider using larger runners for possible analysis time improvements.
30-
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-20.04' }}
31-
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
25+
runs-on: ubuntu-latest
26+
3227
permissions:
3328
actions: read
3429
contents: read
3530
security-events: write
3631

37-
strategy:
38-
fail-fast: false
39-
matrix:
40-
language: [ 'cpp' ]
41-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
42-
# Use only 'java' to analyze code written in Java, Kotlin or both
43-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
44-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
45-
4632
steps:
4733
- name: Checkout repository
4834
uses: actions/checkout@v3
@@ -54,33 +40,16 @@ jobs:
5440
uses: github/codeql-action/init@v2
5541
with:
5642
languages: ${{ matrix.language }}
57-
# If you wish to specify custom queries, you can do so here or in a config file.
58-
# By default, queries listed here will override any specified in a config file.
59-
# Prefix the list here with "+" to use these queries and those in the config file.
60-
61-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
62-
# queries: security-extended,security-and-quality
6343
queries: security-and-quality
6444

65-
66-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
67-
# If this step fails, then you should remove it and run the build manually (see below)
68-
#- name: Autobuild
69-
# uses: github/codeql-action/autobuild@v2
70-
71-
# ℹ️ Command-line programs to run using the OS shell.
72-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
73-
74-
# If the Autobuild fails above, remove it and uncomment the following three lines.
75-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
76-
77-
- run: |
45+
- name: Install Deps, Configure and Build
46+
run: |
7847
./.github/workflows/codeql-buildscript.sh
7948
8049
- name: Perform CodeQL Analysis
8150
uses: github/codeql-action/analyze@v2
8251
with:
83-
category: "/language:${{matrix.language}}"
52+
category: "/language:cpp"
8453
upload: false
8554
id: step1
8655

@@ -110,7 +79,7 @@ jobs:
11079
uses: github/codeql-action/upload-sarif@v2
11180
with:
11281
sarif_file: ${{ steps.step1.outputs.sarif-output }}
113-
category: "/language:${{matrix.language}}"
82+
category: "/language:cpp"
11483

11584
- name: Upload CodeQL results as an artifact
11685
if: success() || failure()
@@ -124,3 +93,38 @@ jobs:
12493
run: |
12594
./.github/workflows/fail_on_error.py \
12695
${{ steps.step1.outputs.sarif-output }}/cpp.sarif
96+
97+
scan-build:
98+
name: Clang Static Analysis
99+
runs-on: ubuntu-latest
100+
101+
permissions:
102+
actions: read
103+
contents: read
104+
security-events: write
105+
106+
steps:
107+
- name: Checkout repository
108+
uses: actions/checkout@v3
109+
with:
110+
submodules: recursive
111+
112+
- name: Install Deps, Configure and Build
113+
env:
114+
WRAPPER: "scan-build --use-cc=cc --use-c++=c++ -sarif -o build/sarif"
115+
run: |
116+
./.github/workflows/codeql-buildscript.sh
117+
118+
- name: Bundle sarif
119+
run: |
120+
npx -y @microsoft/sarif-multitool merge build/sarif/*/*.sarif -o build/sarif/
121+
122+
- name: Upload results to code scanning
123+
uses: github/codeql-action/upload-sarif@v2
124+
with:
125+
category: "scan-build"
126+
sarif_file: build/sarif/merged.sarif
127+
128+
- name: Fail if an error is found
129+
run: |
130+
./.github/workflows/fail_on_error.py build/sarif/merged.sarif

0 commit comments

Comments
 (0)