Skip to content

Commit 871ca7a

Browse files
authored
feat(infra): added codeql workflow file (#177)
* feat #164: added codeql analysis file Signed-off-by: sushant-suse <[email protected]> * feat #164: updated CodeQL version 4 Signed-off-by: sushant-suse <[email protected]> * fragment #164: updated fragment file Signed-off-by: sushant-suse <[email protected]> --------- Signed-off-by: sushant-suse <[email protected]>
1 parent 980bd8e commit 871ca7a

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
paths:
7+
- 'src/**'
8+
- 'tests/**'
9+
- '.github/workflows/codeql-analysis.yml'
10+
pull_request:
11+
branches: [ "main" ]
12+
paths:
13+
- 'src/**'
14+
- 'tests/**'
15+
- '.github/workflows/codeql-analysis.yml'
16+
schedule:
17+
- cron: '30 18 * * 1' # Runs every Monday at 18:30 UTC
18+
19+
# Centralize the Python version here for easy updates
20+
env:
21+
PYTHON_VERSION: '3.12'
22+
23+
permissions:
24+
contents: read
25+
security-events: write
26+
actions: read
27+
28+
jobs:
29+
analyze:
30+
name: Analyze
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 36
33+
permissions:
34+
actions: read
35+
contents: read
36+
security-events: write
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
language: [ 'python' ]
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v6
46+
47+
- name: Set up Python ${{ env.PYTHON_VERSION }}
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: ${{ env.PYTHON_VERSION }}
51+
52+
- name: Setup uv
53+
uses: astral-sh/setup-uv@v7
54+
with:
55+
enable-cache: true
56+
cache-dependency-glob: "uv.lock"
57+
58+
- name: Install dependencies
59+
run: uv sync --frozen --group github-action
60+
61+
# Updated to v4 to avoid deprecation of v3 in late 2026
62+
- name: Initialize CodeQL
63+
uses: github/codeql-action/init@v4
64+
with:
65+
languages: ${{ matrix.language }}
66+
# Extended suites catch more complex vulnerabilities and code quality smells
67+
queries: security-extended,security-and-quality
68+
# Explicitly set the source root to ensure Python files are picked up
69+
source-root: src
70+
71+
# Updated to v4 to match initialization
72+
- name: Perform Analysis
73+
uses: github/codeql-action/analyze@v4
74+
with:
75+
category: "/language:${{matrix.language}}"

changelog.d/164.infra.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Integrated GitHub CodeQL for automated security scanning and data-flow analysis of Python source code.

0 commit comments

Comments
 (0)