Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
SOLUTION: NLog.Extensions.Logging.slnx

Expand Down Expand Up @@ -71,6 +75,80 @@ jobs:
- name: Publish example (AOT/self-contained check)
run: dotnet publish examples/HostingExample --framework net11.0 -r ${{ matrix.aot_test_runtime }} --configuration Release --self-contained

roslyn-analysis: # Run Roslyn analysis and upload to GitHub Code Scanning
name: Roslyn analysis (.NET 11)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write

steps:
- uses: actions/checkout@v7

- name: Setup .NET 11 SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: 11.0.x
check-latest: false

- name: Restore
run: dotnet restore ${{ env.SOLUTION }}

- name: Prepare Roslyn SARIF directory
run: mkdir -p '${{ runner.temp }}/roslyn'

- name: Build with Roslyn SARIF output
run: dotnet build ${{ env.SOLUTION }} --framework net11.0 --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}/roslyn'

- name: Upload Roslyn findings (NLog.Extensions.Hosting)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/NLog.Extensions.Hosting-net11.0.sarif'
category: roslyn-NLog.Extensions.Hosting

- name: Upload Roslyn findings (NLog.Extensions.Logging)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/NLog.Extensions.Logging-net11.0.sarif'
category: roslyn-NLog.Extensions.Logging

- name: Upload Roslyn findings (NLog.Extensions.Hosting.Tests)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/NLog.Extensions.Hosting.Tests-net11.0.sarif'
category: roslyn-NLog.Extensions.Hosting.Tests

- name: Upload Roslyn findings (NLog.Extensions.Logging.Tests)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/NLog.Extensions.Logging.Tests-net11.0.sarif'
category: roslyn-NLog.Extensions.Logging.Tests

- name: Upload Roslyn findings (ConsoleExample)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/ConsoleExample-net11.0.sarif'
category: roslyn-ConsoleExample

- name: Upload Roslyn findings (ConsoleExampleJsonConfig)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/ConsoleExampleJsonConfig-net11.0.sarif'
category: roslyn-ConsoleExampleJsonConfig

- name: Upload Roslyn findings (HostingExample)
if: always()
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: '${{ runner.temp }}/roslyn/HostingExample-net11.0.sarif'
category: roslyn-HostingExample

validate-slnx:
name: Validate SLNX
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup Condition="'$(RoslynSarif)' == 'true'">
<ErrorLog>$(RoslynSarifDirectory)/$(MSBuildProjectName)-$(TargetFramework).sarif,version=2.1</ErrorLog>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<Project>
<PropertyGroup>
<EnableNETAnalyzers Condition="'$(RoslynSarif)' == 'true'">true</EnableNETAnalyzers>
<AnalysisMode Condition="'$(RoslynSarif)' == 'true'">Recommended</AnalysisMode>
<!-- Configure individual analyzer rule severities in .editorconfig. -->
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>6.3.0</VersionPrefix>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
Expand Down
Loading