-
-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (75 loc) · 2.73 KB
/
codeql-csharp.yml
File metadata and controls
89 lines (75 loc) · 2.73 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
# Advanced CodeQL for C# (manual build). If GitHub Security still shows
# "build-mode: none" for language:csharp, disable duplicate "Default setup"
# under Settings → Code security → Code scanning, or this workflow will run twice.
name: "CodeQL CSharp"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
permissions:
actions: read
contents: read
security-events: write
jobs:
analyze:
runs-on: windows-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v4
# Install SDKs before CodeQL init so traced builds resolve targets and packages.
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
9.0.x
- name: Install MAUI workload (WorkshopUploader)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
dotnet workload install maui --disable-parallel
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: csharp
build-mode: manual
config-file: .github/codeql/codeql-config.yml
- name: Restore and build C# projects
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$projects = @(
'WorkshopUploader/WorkshopUploader.csproj',
'framework/FrikaMF.csproj',
'References/il2cpp-unpack/Assembly-CSharp/Assembly-CSharp.csproj',
'mods/FMF.Mod.HexLabelMod/FMF.HexLabelMod.csproj',
'mods/FMF.Mod.GregifyEmployees/FMF.GregifyEmployees.csproj',
'mods/FMF.ConsoleInputGuard/FMF.ConsoleInputGuard.csproj',
'mods/FMF.Plugin.LangCompatBridge/FMF.JoniMLCompatMod.csproj',
'Templates/StandaloneModTemplate/StandaloneModTemplate.csproj'
)
foreach ($project in $projects) {
if (-not (Test-Path -LiteralPath $project)) {
Write-Host "Skipping missing project: $project"
continue
}
Write-Host "Restoring $project"
dotnet restore $project --no-cache
if ($LASTEXITCODE -ne 0) {
Write-Warning "Restore failed for $project (exit $LASTEXITCODE); skipping build."
continue
}
Write-Host "Building $project"
dotnet build $project `
--configuration Release `
--no-restore `
/p:CI=true
if ($LASTEXITCODE -ne 0) {
Write-Warning "Build failed for $project (exit $LASTEXITCODE). Continuing with other projects."
}
}
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3