-
Notifications
You must be signed in to change notification settings - Fork 34
100 lines (87 loc) · 3.47 KB
/
Copy path_codeql.yml
File metadata and controls
100 lines (87 loc) · 3.47 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
name: "CodeQL Analysis"
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
workflow_call:
inputs:
fetch-only:
description: "When true, runs --nobuild to fetch dependencies only."
type: string
default: "false"
jobs:
codeql-linux:
name: Run CodeQL analysis (Linux)
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
security-events: write
steps:
- uses: actions/checkout@v7
- name: Setup Bazel with shared caching
uses: eclipse-score/cicd-actions/setup-bazel-cache@cache
with:
disk-cache-key: ${{ github.job }}-codeql
enable-profiling: false
- name: Fetch dependencies (--nobuild)
if: inputs.fetch-only == 'true'
run: bazel build --config=x86_64-linux --nobuild //...
- name: Run CodeQL analysis (Linux)
if: inputs.fetch-only != 'true'
id: run-codeql
run: |
set -euo pipefail
# As a first step, we only active the non-misra ruleset
bazel run --config=x86_64-linux //quality/static_analysis:codeql_lint -- \
--output-dir /tmp/codeql-results/linux \
--output-prefix codeql-nightly \
--report cert-cpp-l1 cert-c-l1 cpp-code-scanning code-complexity \
--target $(bazel query 'kind("cc_library|cc_binary", //score/...)')
- name: Deduplicate and upload SARIF
if: ${{ !cancelled() && inputs.fetch-only != 'true' && steps.run-codeql.outcome == 'success' }}
id: merge-codeql
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
mkdir -p /tmp/codeql-results/publish
# Deduplicate SARIF results using the SARIF Multitool
bazel run --config=x86_64-linux @sarif_multitool//:sarif_multitool_cli -- \
merge /tmp/codeql-results/linux/codeql-nightly.sarif \
--merge-empty-logs \
--output-file /tmp/codeql-results/publish/codeql-nightly.sarif
- name: Upload SARIF to GitHub Code Scanning
if: ${{ !cancelled() && steps.merge-codeql.outcome == 'success' }}
continue-on-error: true
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: /tmp/codeql-results/publish/codeql-nightly.sarif
category: codeql-nightly
- name: Upload SARIF results
if: ${{ !cancelled() && steps.merge-codeql.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: codeql-sarif-results
path: /tmp/codeql-results/publish/codeql-nightly.sarif
retention-days: 30
- name: Upload compliance reports
if: ${{ !cancelled() && inputs.fetch-only != 'true' }}
uses: actions/upload-artifact@v7
with:
name: codeql-compliance-reports
path: /tmp/codeql-results/linux/analysis_reports/
retention-days: 30
if-no-files-found: warn