Skip to content

Commit f2331e0

Browse files
fix(ci): configure CodeQL to scan only JEngine source code (#562)
Add CodeQL configuration to exclude third-party packages and focus analysis on JEngine-specific code: Included paths: - UnityProject/Packages/com.jasonxudeveloper.jengine.core - UnityProject/Packages/com.jasonxudeveloper.jengine.util - UnityProject/Assets/HotUpdate/Code Excluded: - Third-party packages (HybridCLR, YooAsset, UniTask, etc.) - Unity generated folders (Library, Temp, obj) - Build outputs and samples This improves code quality metrics by focusing on our own code and reduces noise from third-party dependencies. Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9685bfd commit f2331e0

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/codeql/codeql-config.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "JEngine CodeQL Configuration"
2+
3+
# Only analyze JEngine source code, exclude third-party dependencies
4+
paths:
5+
# JEngine Core package
6+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.core'
7+
# JEngine Util package
8+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.util'
9+
# Hot update code
10+
- 'UnityProject/Assets/HotUpdate/Code'
11+
12+
paths-ignore:
13+
# Third-party packages
14+
- 'UnityProject/Packages/com.code-philosophy.hybridclr'
15+
- 'UnityProject/Packages/com.focus-creative-games.*'
16+
- 'UnityProject/Packages/com.tuyoogame.*'
17+
- 'UnityProject/Packages/com.unity.*'
18+
- 'UnityProject/Packages/com.cysharp.*'
19+
# Unity generated files
20+
- 'UnityProject/Library'
21+
- 'UnityProject/Temp'
22+
- 'UnityProject/Logs'
23+
- 'UnityProject/obj'
24+
# Build outputs
25+
- 'UnityProject/Builds'
26+
- 'UnityProject/ServerData'
27+
# Test files (optional - remove if you want tests scanned)
28+
- 'UnityProject/Assets/Tests'
29+
# Third-party assets
30+
- 'UnityProject/Assets/Plugins'
31+
# Samples
32+
- 'UnityProject/Assets/Samples'
33+
34+
# Query configuration
35+
queries:
36+
- uses: security-and-quality

.github/workflows/codeql.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CodeQL Security Analysis
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
# Only run when JEngine code changes
8+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.core/**'
9+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.util/**'
10+
- 'UnityProject/Assets/HotUpdate/Code/**'
11+
- '.github/codeql/**'
12+
- '.github/workflows/codeql.yml'
13+
pull_request:
14+
branches: [master]
15+
paths:
16+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.core/**'
17+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.util/**'
18+
- 'UnityProject/Assets/HotUpdate/Code/**'
19+
- '.github/codeql/**'
20+
- '.github/workflows/codeql.yml'
21+
schedule:
22+
# Run weekly on Sunday at 00:00 UTC
23+
- cron: '0 0 * * 0'
24+
workflow_dispatch:
25+
26+
jobs:
27+
analyze:
28+
name: Analyze C# Code
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v3
41+
with:
42+
languages: csharp
43+
config-file: ./.github/codeql/codeql-config.yml
44+
# Use security-and-quality queries for comprehensive analysis
45+
queries: security-and-quality
46+
47+
# Build step for C# - CodeQL needs to observe the build
48+
# For Unity projects, we set up a minimal build environment
49+
- name: Setup .NET
50+
uses: actions/setup-dotnet@v4
51+
with:
52+
dotnet-version: '6.0.x'
53+
54+
# Autobuild attempts to build the project automatically
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v3
57+
58+
- name: Perform CodeQL Analysis
59+
uses: github/codeql-action/analyze@v3
60+
with:
61+
category: "/language:csharp"

0 commit comments

Comments
 (0)