Skip to content

Commit d356160

Browse files
committed
Try upload analysis
1 parent 8d44bfd commit d356160

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,26 @@ jobs:
143143
runCmd: |
144144
chmod +x ./build.sh
145145
./build.sh RunTests
146+
147+
analyze:
148+
runs-on: ubuntu-latest
149+
steps:
150+
- uses: actions/checkout@v3
151+
- name: Setup necessary dotnet SDKs
152+
uses: actions/setup-dotnet@v3
153+
with:
154+
global-json-file: global.json
155+
dotnet-version: |
156+
8.x
157+
- name: Analyze
158+
run: |
159+
chmod +x ./build.sh
160+
./build.sh Analyzers
161+
# This is important, you want to continue your Action even if you found problems.
162+
# As you always want the report to upload
163+
continue-on-error: true
164+
- name: Upload SARIF file
165+
uses: github/codeql-action/upload-sarif@v2
166+
with:
167+
# You can also specify the path to a folder for `sarif_file`
168+
sarif_file: analysisreports

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,6 @@ benchmarks/BenchmarkDotNet.Artifacts/
395395

396396
# Python Tests Output
397397
.python-tests/
398+
399+
#FSharp Analyzers
400+
analysisreports/

build/build.fs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,17 @@ let formatCode _ =
148148
let analyze _ =
149149
let analyzerPaths = !! "packages/analyzers/**/analyzers/dotnet/fs"
150150

151-
let createArgsForProject project analyzerPaths =
151+
let createArgsForProject (project: string) analyzerPaths =
152+
let projectName = Path.GetFileNameWithoutExtension project
153+
152154
[
153155
yield "--project"
154156
yield project
155157
yield "--analyzers-path"
156158
yield! analyzerPaths
159+
if isCI.Value then
160+
yield "--report"
161+
yield $"analysisreports/{projectName}-analysis.sarif"
157162
]
158163
|> String.concat " "
159164

0 commit comments

Comments
 (0)