Repository navigation
136 lines (122 loc) · 4.71 KB
/
Copy pathcodeql-analysis.yml
File metadata and controls
136 lines (122 loc) · 4.71 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CodeQL
on:
push:
branches:
- main
- v8.x
pull_request:
types: [
opened,
synchronize,
reopened,
labeled,
unlabeled,
ready_for_review,
converted_to_draft,
]
branches:
- main
- v8.x
schedule:
- cron: "40 4 * * 6" # Weekly scheduled run to catch issues regardless of changes
# Concurrency configuration:
# - We use workflow-specific concurrency groups to prevent multiple CodeQL security analysis runs,
# as these are comprehensive security scans that shouldn't run simultaneously.
# - For pull requests, we cancel in-progress runs when new commits are pushed since only the
# latest security analysis results matter for identifying potential vulnerabilities.
# - For main branch pushes and scheduled runs, we never cancel security analysis to ensure
# complete security validation and maintain our security baseline with weekly scheduled scans.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
run-full-ci-gate:
name: CI eligibility
uses: ./.github/workflows/run-full-ci-workflow.yml
files-changed:
needs: run-full-ci-gate
if: needs.run-full-ci-gate.outputs.run_ci == 'true'
name: Detect File Changes
runs-on: ubuntu-latest
outputs:
run_codeql_analysis_for_prs: ${{ steps.changes.outputs.run_codeql_analysis_for_prs }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Get changed files
id: changes
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
analyze:
if: github.event_name != 'pull_request' ||
needs.files-changed.outputs.run_codeql_analysis_for_prs == 'true'
needs: files-changed
name: Analyze (${{ matrix.language }})
runs-on: macos-26
strategy:
fail-fast: false
matrix:
language: ["cpp"]
steps:
- name: Warm CoreSimulator
id: warm-coresimulator
background: true
continue-on-error: true
run: xcrun simctl list runtimes -j > /dev/null
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Git access
uses: ./.github/actions/setup-git-access
with:
ssh-key-base64: ${{ secrets.GIT_SSH_PRIVATE_KEY_BASE64 }}
ssh-key-passphrase: ${{ secrets.GIT_SSH_KEY_PASSPHRASE }}
- name: Initialize CodeQL
uses: github/codeql-action/init@38112626f97ac1fd7acf3df7ebca51f4677c1b38 # v4
with:
languages: ${{ matrix.language }}
- name: Wait for CoreSimulator warmup
wait: warm-coresimulator
- name: Setup Xcode
id: setup-xcode
uses: ./.github/actions/setup-xcode
with:
version: "26"
- name: Resolve test destination
id: resolve-test-destination
uses: ./.github/actions/resolve-test-destination
with:
platform: iOS
- run: |
set -o pipefail && NSUnbufferedIO=YES xcodebuild \
-workspace Sentry.xcworkspace \
-scheme Sentry \
-configuration Release \
-destination "platform=iOS Simulator,OS=$IOS_SIMULATOR_OS,name=$IOS_DEVICE_NAME" \
build 2>&1 |
tee raw-analyze-output.log |
xcbeautify --preserve-unbeautified
env:
IOS_SIMULATOR_OS: ${{ steps.resolve-test-destination.outputs.TEST_OS }}
IOS_DEVICE_NAME: ${{ steps.resolve-test-destination.outputs.TEST_DEVICE }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@38112626f97ac1fd7acf3df7ebca51f4677c1b38 # v4
- name: Run CI Diagnostics
uses: ./.github/actions/ci-diagnostics
if: failure()
# This check validates that either analyze passed or was skipped, which allows us
# to make CodeQL analysis a required check with only running the analysis when required.
# So, we don't have to run CodeQL analysis, for example, for unrelated changes.
codeql_analysis-required-check:
needs: [run-full-ci-gate, files-changed, analyze]
name: Analyze
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
if: always()
runs-on: ubuntu-latest
steps:
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
# Skipped jobs are not considered failures.
- name: Check for failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One of the CodeQL analysis jobs has failed." && exit 1