Skip to content

Commit f17e32d

Browse files
authored
Add CodeQL workflow for Python and Rust analysis
1 parent 57689f0 commit f17e32d

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '22 22 * * *'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze (${{ matrix.language }})
14+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
15+
permissions:
16+
security-events: write
17+
packages: read
18+
actions: read
19+
contents: read
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- language: python
26+
build-mode: none
27+
- language: rust
28+
build-mode: manual
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v4
36+
with:
37+
languages: ${{ matrix.language }}
38+
build-mode: ${{ matrix.build-mode }}
39+
40+
- name: Run manual build steps
41+
if: matrix.build-mode == 'manual'
42+
shell: bash
43+
run: |
44+
if [ "${{ matrix.language }}" = "rust" ]; then
45+
echo "Building Rust core for CodeQL tracing..."
46+
cargo build --verbose
47+
else
48+
echo "No manual build configured for ${{ matrix.language }}"
49+
exit 1
50+
fi
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@v4
54+
with:
55+
category: "/language:${{matrix.language}}"
56+
57+
- name: Upload SARIF as Artifact (Debug)
58+
uses: actions/upload-artifact@v4
59+
if: failure()
60+
with:
61+
name: codeql-sarif-debug-${{ matrix.language }}
62+
path: ${{ runner.temp }}/**/*.sarif

0 commit comments

Comments
 (0)