-
Notifications
You must be signed in to change notification settings - Fork 156
64 lines (52 loc) · 1.93 KB
/
codeql-analysis.yml
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
name: CodeQL Analysis
permissions:
security-events: write
on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
queries: security-and-quality
languages: csharp
- name: Build solution
shell: pwsh
run: |
$pathToSolution = "src/BinSkim.sln"
$buildConfiguration = "Release"
$useSharedCompilation = "false"
$testProjects = "src/Test.FunctionalTests.BinSkim.Rules/Test.FunctionalTests.BinSkim.Rules.csproj", "src/Test.FunctionalTests.BinSkim.Driver/Test.FunctionalTests.BinSkim.Driver.csproj", "src/Test.UnitTests.BinaryParsers/Test.UnitTests.BinaryParsers.csproj", "src/Test.UnitTests.BinSkim.Rules/Test.UnitTests.BinSkim.Rules.csproj", "src/Test.UnitTests.BinSkim.Driver/Test.UnitTests.BinSkim.Driver.csproj"
dotnet nuget locals all --clear
# remove one or more test projects,
# so that CodeQL only analyzes the source code
dotnet sln $pathToSolution remove $testProjects
dotnet clean $pathToSolution `
--configuration $buildConfiguration
dotnet restore $pathToSolution
dotnet build $pathToSolution `
-property:UseSharedCompilation=$useSharedCompilation `
--configuration $buildConfiguration `
--no-incremental `
--no-restore
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)