From 84e9c23f7bcd144eeb0533afa45f166c80ebe45f Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:29:08 +0100 Subject: [PATCH 1/5] Send build warnings to GitHub Advanced Security --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ Directory.Build.targets | 5 +++++ src/Directory.Build.props | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 Directory.Build.targets diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c27d7823..038a9ecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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.sln @@ -71,6 +75,35 @@ 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: + name: Roslyn analysis + 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: Build with Roslyn SARIF output + run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}' + + - name: Upload Roslyn findings + if: always() + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: '${{ runner.temp }}/*.sarif' + category: roslyn + pack: name: Create NuGet package runs-on: windows-latest diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..aa6fcf56 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,5 @@ + + + $(RoslynSarifDirectory)/$(MSBuildProjectName)-$(TargetFramework).sarif,version=2.1 + + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index eba366f1..d277da5c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,10 @@ + + true + Recommended + + + 6.3.0 6.0.0.0 From 1445d3bb838f48a7eff310ae49bfce9fe44024c8 Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:32:24 +0100 Subject: [PATCH 2/5] fixes --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 038a9ecd..bdda71b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,14 +94,17 @@ jobs: - 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 }} --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}' + run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}/roslyn' - name: Upload Roslyn findings if: always() - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: '${{ runner.temp }}/*.sarif' + sarif_file: '${{ runner.temp }}/roslyn' category: roslyn pack: From e5e6d6c7f99af67f264af0575b2fda987b97af12 Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Wed, 11 Nov 2026 01:37:27 +0100 Subject: [PATCH 3/5] project matrix and .net11 only --- .github/workflows/ci.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdda71b6..cadd1bf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,25 @@ jobs: run: dotnet publish examples/HostingExample --framework net11.0 -r ${{ matrix.aot_test_runtime }} --configuration Release --self-contained roslyn-analysis: - name: Roslyn analysis + name: Roslyn analysis (${{ matrix.name }}) + strategy: + fail-fast: false + matrix: + include: + - name: NLog.Extensions.Hosting + project: src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj + - name: NLog.Extensions.Logging + project: src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj + - name: NLog.Extensions.Hosting.Tests + project: test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj + - name: NLog.Extensions.Logging.Tests + project: test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj + - name: ConsoleExample + project: examples/ConsoleExample/ConsoleExample.csproj + - name: ConsoleExampleJsonConfig + project: examples/ConsoleExampleJsonConfig/ConsoleExampleJsonConfig.csproj + - name: HostingExample + project: examples/HostingExample/HostingExample.csproj runs-on: ubuntu-latest permissions: contents: read @@ -92,20 +110,20 @@ jobs: check-latest: false - name: Restore - run: dotnet restore ${{ env.SOLUTION }} + run: dotnet restore ${{ matrix.project }} - name: Prepare Roslyn SARIF directory run: mkdir -p '${{ runner.temp }}/roslyn' - name: Build with Roslyn SARIF output - run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}/roslyn' + run: dotnet build ${{ matrix.project }} --framework net11.0 --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}/roslyn' - name: Upload Roslyn findings if: always() uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: '${{ runner.temp }}/roslyn' - category: roslyn + sarif_file: '${{ runner.temp }}/roslyn/${{ matrix.name }}-net11.0.sarif' + category: roslyn-${{ matrix.name }} pack: name: Create NuGet package From 4b676b22465b3c11d93b363b8e412b63e7a5e4df Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Sat, 14 Nov 2026 00:28:52 +0100 Subject: [PATCH 4/5] sarif to one job --- .github/workflows/ci.yml | 72 ++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cadd1bf3..e3099448 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,25 +76,7 @@ jobs: run: dotnet publish examples/HostingExample --framework net11.0 -r ${{ matrix.aot_test_runtime }} --configuration Release --self-contained roslyn-analysis: - name: Roslyn analysis (${{ matrix.name }}) - strategy: - fail-fast: false - matrix: - include: - - name: NLog.Extensions.Hosting - project: src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj - - name: NLog.Extensions.Logging - project: src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj - - name: NLog.Extensions.Hosting.Tests - project: test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj - - name: NLog.Extensions.Logging.Tests - project: test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj - - name: ConsoleExample - project: examples/ConsoleExample/ConsoleExample.csproj - - name: ConsoleExampleJsonConfig - project: examples/ConsoleExampleJsonConfig/ConsoleExampleJsonConfig.csproj - - name: HostingExample - project: examples/HostingExample/HostingExample.csproj + name: Roslyn analysis (.NET 11) runs-on: ubuntu-latest permissions: contents: read @@ -110,20 +92,62 @@ jobs: check-latest: false - name: Restore - run: dotnet restore ${{ matrix.project }} + 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 ${{ matrix.project }} --framework net11.0 --configuration Release --no-restore -p:RoslynSarif=true -p:TreatWarningsAsErrors=false -p:RoslynSarifDirectory='${{ runner.temp }}/roslyn' + 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 + - name: Upload Roslyn findings (HostingExample) if: always() uses: github/codeql-action/upload-sarif@v4 with: - sarif_file: '${{ runner.temp }}/roslyn/${{ matrix.name }}-net11.0.sarif' - category: roslyn-${{ matrix.name }} + sarif_file: '${{ runner.temp }}/roslyn/HostingExample-net11.0.sarif' + category: roslyn-HostingExample pack: name: Create NuGet package From 70136c1d8b5f3aac9daa66d2c875b6f2a941f32e Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <5808377+304NotModified@users.noreply.github.com> Date: Sat, 14 Nov 2026 00:29:54 +0100 Subject: [PATCH 5/5] docs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3099448..f088af1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ 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: + roslyn-analysis: # Run Roslyn analysis and upload to GitHub Code Scanning name: Roslyn analysis (.NET 11) runs-on: ubuntu-latest permissions: