Skip to content

Commit 2fa6542

Browse files
committed
Add CodeQL MISRA/CERT C++ analysis workflow
1 parent 2f5bbc6 commit 2fa6542

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
name: CodeQL Static Analysis
15+
16+
on:
17+
pull_request:
18+
types: [opened, reopened, synchronize]
19+
merge_group:
20+
types: [checks_requested]
21+
push:
22+
branches:
23+
- main
24+
schedule:
25+
- cron: "0 6 * * 1"
26+
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
jobs:
31+
codeql-analysis:
32+
name: CodeQL MISRA/CERT C++ Analysis
33+
runs-on: ubuntu-latest
34+
35+
permissions:
36+
security-events: write
37+
contents: read
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4.2.2
42+
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v4
45+
with:
46+
languages: cpp
47+
packs: codeql/misra-cpp-coding-standards,codeql/cert-cpp-coding-standards
48+
- name: Setup Bazel
49+
uses: bazel-contrib/setup-bazel@0.15.0
50+
with:
51+
bazelisk-version: 1.26.0
52+
disk-cache: true
53+
repository-cache: true
54+
bazelisk-cache: true
55+
56+
- name: Build with Bazel (CodeQL traces compiler calls)
57+
run: bazel build --lockfile_mode=error --config x86_64-linux //...
58+
59+
- name: Run CodeQL analysis
60+
uses: github/codeql-action/analyze@v4
61+
with:
62+
category: cpp-misra-cert
63+
output: _sca
64+
upload: true
65+
66+
- name: Upload SARIF artifacts
67+
if: always()
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: codeql-results
71+
path: _sca/
72+
retention-days: 30

0 commit comments

Comments
 (0)