-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.1 KB
/
codeql.yml
File metadata and controls
79 lines (69 loc) · 2.1 KB
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
73
74
75
76
77
78
79
name: "CodeQL Security Analysis"
on:
push:
branches: [ main, develop ]
paths:
- 'src/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
pull_request:
branches: [ main, develop ]
paths:
- 'src/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
jobs:
analyze:
name: Analyze C++
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# Initialize CodeQL for C++
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Override default queries to include security-and-quality
queries: security-and-quality
# Use custom configuration to limit analysis to src/ directory
config-file: ./.github/codeql/codeql-config.yml
# Install dependencies needed for C++ compilation
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential
# Build the C++ project for CodeQL analysis (focused on src directory)
- name: Build project
run: |
# Create a minimal build to satisfy CodeQL's compilation requirements
# We only need to compile the source files, not the full test suite
cd test
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
# Build only the source files needed for analysis
make -j2
# Perform CodeQL analysis
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
# Upload SARIF results (optional, for advanced workflows)
- name: Upload SARIF file
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ../results/cpp.sarif
continue-on-error: true