diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f20af560..716799c8 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "fantomas" ] + }, + "fsharp-analyzers": { + "version": "0.26.0", + "commands": [ + "fsharp-analyzers" + ] } } } \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9a991a75..5f489563 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -38,4 +38,30 @@ jobs: - name: Build run: dotnet build -c Release --no-restore - name: Test - run: dotnet test -c Release \ No newline at end of file + run: dotnet test -c Release + + analyzers: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - name: Restore tools + run: dotnet tool restore + - name: Build solution + run: dotnet build -c Release Giraffe.sln + + - name: Run Analyzers + run: dotnet msbuild /t:AnalyzeFSharpProject src/Giraffe/Giraffe.fsproj + # This is important, you want to continue your Action even if you found problems. + # As you always want the report to upload + continue-on-error: true + # checkout code, build, run analyzers, ... + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + with: + # You can also specify the path to a folder for `sarif_file` + sarif_file: ./src/Giraffe/analysis.sarif \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..e2e6bdfa --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,9 @@ + + + --analyzers-path "$(PkgG-Research_FSharp_Analyzers)" + $(FSharpAnalyzersOtherFlags) --analyzers-path "$(PkgIonide_Analyzers)" + $(FSharpAnalyzersOtherFlags) --configuration $(Configuration) + $(FSharpAnalyzersOtherFlags) --exclude-analyzers PartialAppAnalyzer + $(FSharpAnalyzersOtherFlags) --report "analysis.sarif" + + \ No newline at end of file diff --git a/Directory.Solution.targets b/Directory.Solution.targets new file mode 100644 index 00000000..33bbc1dd --- /dev/null +++ b/Directory.Solution.targets @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/Giraffe/Giraffe.fsproj b/src/Giraffe/Giraffe.fsproj index 85be607d..0e4c00f2 100644 --- a/src/Giraffe/Giraffe.fsproj +++ b/src/Giraffe/Giraffe.fsproj @@ -49,6 +49,20 @@ + + + build + all + + + analyzers + all + + + analyzers + all + +