From 2bf27577bcb1fd0e9a8cf9ec4bb6ae061b77715e Mon Sep 17 00:00:00 2001 From: jcguo Date: Mon, 24 Mar 2025 18:31:26 +0800 Subject: [PATCH 01/11] add snk file --- NullFX.CRC/NullFX.CRC.csproj | 2 ++ NullFX.CRC/NullFX.CRC.snk | Bin 0 -> 596 bytes 2 files changed, 2 insertions(+) create mode 100644 NullFX.CRC/NullFX.CRC.snk diff --git a/NullFX.CRC/NullFX.CRC.csproj b/NullFX.CRC/NullFX.CRC.csproj index 060d3f6..da90a0b 100644 --- a/NullFX.CRC/NullFX.CRC.csproj +++ b/NullFX.CRC/NullFX.CRC.csproj @@ -27,6 +27,8 @@ #{RELEASE_VERSION}#.0 #{RELEASE_VERSION}# #{RELEASE_VERSION}# + True + NullFX.CRC.snk diff --git a/NullFX.CRC/NullFX.CRC.snk b/NullFX.CRC/NullFX.CRC.snk new file mode 100644 index 0000000000000000000000000000000000000000..e85a14be6c3be432ecff1ba2c1a3cfb22e277433 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096c={m{PVXO<&fpg}NG}1y22A;#n1#J6; z7A4h7{-?Bu2@?l7anq})^A(v(^aIDeB_cMw_XrD_&8m$!mbs8DF&+qfmPiN&Oxqwd z30Ku)9W>tV;a+AvvEU(rEca^Uv=G+QRh0ra;${b>>c0(8ory0tUG*=6iCq?;OS{v% zzG$Yf{$Td1;zlaq_X%BM?$GCjg%T>$^gxif5lXeTGK(Bdf)~n{q5JZ1N9ZM4jnJZX zJv0u~tQqB|)%)?EsTp`v?7%=m&5N_zl1Vf?$%ow;|BduG?wGgakMQE(Yc>%+N=BfS z=IXNTb6eMs;I$ERmzv)BrmW)j;Qrs??-#y};1-G{qpPID#?^nac4TnrivIO}^v^$) zv*bTwQ|6@sSUOa3f|_TfJxCNW;+m0LTzUz?XiVmrGd2iO)n;4$VMG&79(LmS&E(d2 zl2S*_|1{61>Web-=`GRMnI>e6hv7{egL9~K+w@E}NI#{WpS0m%ivoKtH#^AL_O_{| zxfsDo$y9imeq@us^b9L`NNh27cX2F1YN^SBUhIt%s!H?^1g(vn{rD6`YXh0i!~`bY z7PG&b>9m#oTK~$BK#F%KL~gcnI_KA}QF8$GxPJBSmNMY?%6qMR1Nhe~klMe1H%(V& z>v8L8oDCxT1iw$QQGetQN}^5jh1^m`_#rA=4eIt%|K1*pkY>x~)*;cBJT@)BWE~Iu igED0ZfCdj$isgcGg$a4&Cicdxn5i`l~(k Date: Fri, 9 Oct 2026 02:29:51 -0500 Subject: [PATCH 02/11] build: add net8.0 and net10.0 target frameworks Keeps the existing net40, net6.0 and net7.0 targets and adds the requested modern targets (netstandard2.0, netcoreapp3.1, net45-net48 were already present). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU --- NullFX.CRC/NullFX.CRC.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NullFX.CRC/NullFX.CRC.csproj b/NullFX.CRC/NullFX.CRC.csproj index da90a0b..531c195 100644 --- a/NullFX.CRC/NullFX.CRC.csproj +++ b/NullFX.CRC/NullFX.CRC.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net40;net45;net46;net47;net48;netcoreapp3.1;net6.0;net7.0 + netstandard2.0;netcoreapp3.1;net40;net45;net46;net47;net48;net6.0;net7.0;net8.0;net10.0 NullFX.CRC NullFX CRC is a small set of CRC utilities (crc8, crc16, and crc32) written in C# and released under the MIT License 2023 Steve Whitley From a9bf957ce9d0c691622fbba9e90155c3499b63f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 02:30:12 -0500 Subject: [PATCH 03/11] release: break version into major/minor/revision and compute RELEASE_VERSION - Add Directory.Build.props holding RELEASE_MAJOR=1, RELEASE_MINOR=1, RELEASE_REVISION=10 as the checked-in version source of truth. - RELEASE_VERSION is computed as MAJOR.MINOR.REVISION unless passed explicitly (e.g. -p:RELEASE_VERSION=0.0.0 for CI/PR builds). - Version, PackageVersion, AssemblyVersion, FileVersion and InformationalVersion all derive from RELEASE_VERSION. - Remove the #{RELEASE_VERSION}# replace-tokens placeholders from the library csproj; no hard-coded version remains in the project file. - Turn off GeneratePackageOnBuild: packing is now an explicit 'dotnet pack' step so builds and test runs no longer emit packages. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU --- Directory.Build.props | 28 ++++++++++++++++++++++++++++ NullFX.CRC/NullFX.CRC.csproj | 13 ++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..e254536 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,28 @@ + + + + 1 + 1 + 10 + + $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_REVISION) + + $(RELEASE_VERSION) + $(RELEASE_VERSION) + $(RELEASE_VERSION).0 + $(RELEASE_VERSION).0 + $(RELEASE_VERSION) + + diff --git a/NullFX.CRC/NullFX.CRC.csproj b/NullFX.CRC/NullFX.CRC.csproj index 531c195..17e9855 100644 --- a/NullFX.CRC/NullFX.CRC.csproj +++ b/NullFX.CRC/NullFX.CRC.csproj @@ -5,7 +5,7 @@ NullFX.CRC NullFX CRC is a small set of CRC utilities (crc8, crc16, and crc32) written in C# and released under the MIT License 2023 Steve Whitley - true + false Steve Whitley NullFX Software CRC8 CRC16 CRC32 @@ -21,12 +21,11 @@ MIT Release;Debug True - - #{RELEASE_VERSION}# - #{RELEASE_VERSION}#.0 - #{RELEASE_VERSION}#.0 - #{RELEASE_VERSION}# - #{RELEASE_VERSION}# + True NullFX.CRC.snk From 34a2dfc0938b892fc4a5c4f573c4bc6b36dd3369 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 02:30:22 -0500 Subject: [PATCH 04/11] test: run unit tests on net10.0 and pin test dependencies - Retarget NullFX.CRC.Tests from net7.0 (EOL) to net10.0, the common test/benchmark runtime. - Pin previously floating (*) package versions so CI is reproducible. FluentAssertions is held on 7.2.0 (Apache-2.0); 8.x is commercially licensed. - Drop the redundant xunit.assert reference (included by the xunit metapackage), the replace-tokens ReleaseVersion property and the SonarQubeExclude marker. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU --- NullFX.CRC.Tests/NullFX.CRC.Tests.csproj | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/NullFX.CRC.Tests/NullFX.CRC.Tests.csproj b/NullFX.CRC.Tests/NullFX.CRC.Tests.csproj index 002216d..9efa339 100644 --- a/NullFX.CRC.Tests/NullFX.CRC.Tests.csproj +++ b/NullFX.CRC.Tests/NullFX.CRC.Tests.csproj @@ -1,28 +1,22 @@ - net7.0 + + net10.0 false false - - #{RELEASE_VERSION}# - true + true - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - - \ No newline at end of file + From 80eb4b3d08d953a8ccd72777f74e8d4c25357967 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 02:30:32 -0500 Subject: [PATCH 05/11] bench: run benchmarks on net10.0 and accept CLI arguments - Retarget NullFX.CRC.Benchmarks from netstandard2.0/net47/net48/ netcoreapp3.1/net6.0/net7.0 to the common net10.0 runtime. The netstandard2.0 Exe target could never run, and BenchmarkDotNet is started from a single host runtime anyway. - Update BenchmarkDotNet 0.13.5 -> 0.15.8 (0.13.x predates .NET 10). - Forward args to BenchmarkRunner so CI can choose a short job and JSON/GitHub-markdown exporters. No-arg behaviour is unchanged. - Drop the replace-tokens ReleaseVersion property and SonarQubeExclude. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU --- NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj | 11 +++++------ NullFX.CRC.Benchmarks/Program.cs | 5 ++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj b/NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj index e903639..2a2e3f2 100644 --- a/NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj +++ b/NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj @@ -2,14 +2,13 @@ Exe - netstandard2.0;net47;net48;netcoreapp3.1;net6.0;net7.0 + + net10.0 false - - #{RELEASE_VERSION}# - true - + false + - + diff --git a/NullFX.CRC.Benchmarks/Program.cs b/NullFX.CRC.Benchmarks/Program.cs index ac13ea0..ac0b0b6 100644 --- a/NullFX.CRC.Benchmarks/Program.cs +++ b/NullFX.CRC.Benchmarks/Program.cs @@ -6,7 +6,10 @@ internal static class Program { static void Main(string[] args) { - BenchmarkRunner.Run(); + // Forward command-line arguments so CI can pick the job, exporters and + // artifacts path (e.g. --job short --exporters json github). With no + // arguments this behaves exactly as before. + BenchmarkRunner.Run(args: args); } } } \ No newline at end of file From 177ae80032e20ecfa542fe55d91c1478507314bf Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 02:32:44 -0500 Subject: [PATCH 06/11] ci: replace build pipeline with Windows build/test/benchmark jobs Replaces .github/workflows/cicd-actions.yml with .github/workflows/ci.yml: - Runs on windows-latest (required for the net40-net48 targets). - Installs the .NET 8 and .NET 10 SDKs. The .NET 10 SDK builds every target, including netcoreapp3.1/net6.0/net7.0 and the .NET Framework targets via reference packs, so no .NET Core 3.1 SDK is needed. - Separate jobs: build (all TFMs + 0.0.0 inspection pack), unit tests (net10.0, TRX) and benchmarks (net10.0, BenchmarkDotNet ShortRun). - Test and benchmark results are written to the job summary and uploaded as artifacts; the package and binlog are uploaded too. - Never changes the version and never publishes (release.yml does). - Removes the SonarCloud scanner, cache steps, SONAR_TOKEN usage, the JDK setup that only existed for SonarCloud, the replace-tokens step and the publish steps that ran on every push to main. - Adds .github/scripts/verify-package.ps1, which checks the packed version, README, license, per-TFM assemblies and for leftover tokens or bin/obj content. - Library csproj: drop the SonarQubeTestProject marker and set ContinuousIntegrationBuild under GitHub Actions. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012C6aJYkYBV2GSnSZwsd9GU --- .github/scripts/verify-package.ps1 | 108 ++++++++++++++++ .github/workflows/ci.yml | 194 +++++++++++++++++++++++++++++ .github/workflows/cicd-actions.yml | 72 ----------- NullFX.CRC/NullFX.CRC.csproj | 3 +- 4 files changed, 304 insertions(+), 73 deletions(-) create mode 100644 .github/scripts/verify-package.ps1 create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/cicd-actions.yml diff --git a/.github/scripts/verify-package.ps1 b/.github/scripts/verify-package.ps1 new file mode 100644 index 0000000..d975365 --- /dev/null +++ b/.github/scripts/verify-package.ps1 @@ -0,0 +1,108 @@ +<# +.SYNOPSIS + Verifies a packed NullFX.CRC NuGet package. + +.DESCRIPTION + Opens the .nupkg produced by `dotnet pack` and checks that: + - the package id and version match what we expect + - README.md is packed and referenced from the nuspec + - the MIT license expression is present + - every target framework in the library project has an assembly in lib/ + - no replace-tokens placeholders (#{...}#) survived + - no test/benchmark assemblies or bin/obj paths were packed + Writes a short summary to $env:GITHUB_STEP_SUMMARY when available. + +.EXAMPLE + ./.github/scripts/verify-package.ps1 -PackageDirectory ./artifacts/package -Version 0.0.0 +#> +[CmdletBinding()] +param( + [Parameter(Mandatory)] [string] $PackageDirectory, + [Parameter(Mandatory)] [string] $Version, + [string] $PackageId = 'NullFX.CRC', + [string] $Project = 'NullFX.CRC/NullFX.CRC.csproj', + # Optional override; by default the list is read from the project. + [string[]] $TargetFrameworks +) + +$ErrorActionPreference = 'Stop' +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$failures = [System.Collections.Generic.List[string]]::new() +function Fail([string] $message) { $failures.Add($message); Write-Host "::error::$message" } + +$nupkgPath = Join-Path $PackageDirectory "$PackageId.$Version.nupkg" +if (-not (Test-Path $nupkgPath)) { + $found = (Get-ChildItem $PackageDirectory -Filter '*.nupkg' | Select-Object -ExpandProperty Name) -join ', ' + throw "Expected package '$nupkgPath' was not found. Found: $found" +} + +# Target frameworks come from the project so this list never drifts. +if ($TargetFrameworks) { + $expectedTfms = $TargetFrameworks +} else { + $tfmRaw = (& dotnet msbuild $Project -getProperty:TargetFrameworks | Out-String).Trim() + $expectedTfms = $tfmRaw.Split(';', [System.StringSplitOptions]::RemoveEmptyEntries) +} +if ($expectedTfms.Count -eq 0) { throw "Could not read TargetFrameworks from $Project" } + +$zip = [System.IO.Compression.ZipFile]::OpenRead((Resolve-Path $nupkgPath)) +try { + $entries = $zip.Entries | ForEach-Object { $_.FullName } + + function Read-Entry([string] $name) { + $entry = $zip.Entries | Where-Object { $_.FullName -eq $name } | Select-Object -First 1 + if (-not $entry) { return $null } + $reader = [System.IO.StreamReader]::new($entry.Open()) + try { return $reader.ReadToEnd() } finally { $reader.Dispose() } + } + + $nuspecName = $entries | Where-Object { $_ -like '*.nuspec' } | Select-Object -First 1 + if (-not $nuspecName) { throw 'No .nuspec found inside the package.' } + [xml] $nuspec = Read-Entry $nuspecName + $meta = $nuspec.package.metadata + + if ($meta.id -ne $PackageId) { Fail "Package id is '$($meta.id)', expected '$PackageId'." } + if ($meta.version -ne $Version) { Fail "Package version is '$($meta.version)', expected '$Version'." } + if ($meta.readme -ne 'README.md') { Fail "nuspec is '$($meta.readme)', expected 'README.md'." } + if ($meta.license.'#text' -ne 'MIT') { Fail "nuspec license is '$($meta.license.'#text')', expected 'MIT'." } + if ($entries -notcontains 'README.md') { Fail 'README.md is not packed at the package root.' } + if ($meta.repository -and -not $meta.repository.commit) { Write-Host '::warning::Repository commit is missing from the nuspec (SourceLink).' } + + foreach ($tfm in $expectedTfms) { + if ($entries -notcontains "lib/$tfm/NullFX.CRC.dll") { Fail "Missing lib/$tfm/NullFX.CRC.dll" } + } + + foreach ($name in @($nuspecName, 'README.md')) { + $text = Read-Entry $name + if ($text -and $text -match '#\{[A-Z_]+\}#') { Fail "Unreplaced token found in $name." } + } + + $unexpected = $entries | Where-Object { + $_ -match '(?i)(^|/)(bin|obj)/' -or $_ -match '(?i)\.Tests\.dll$' -or $_ -match '(?i)Benchmarks' -or $_ -match '(?i)\.snk$' + } + foreach ($u in $unexpected) { Fail "Unexpected file in package: $u" } + + $summary = @( + "### NuGet package: ``$PackageId $($meta.version)``", + '', + "| Check | Result |", + "|---|---|", + "| Version | ``$($meta.version)`` |", + "| Target frameworks | $($expectedTfms -join ', ') |", + "| README | $([bool]($entries -contains 'README.md')) |", + "| License | $($meta.license.'#text') |", + "| Files | $($entries.Count) |", + "| Problems | $($failures.Count) |" + ) -join "`n" + Write-Host $summary + if ($env:GITHUB_STEP_SUMMARY) { Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $summary } +} +finally { + $zip.Dispose() +} + +if ($failures.Count -gt 0) { + throw "Package verification failed with $($failures.Count) problem(s)." +} +Write-Host "Package $nupkgPath verified." diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2f62344 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,194 @@ +# Pull request / main validation: build every target framework, run unit tests, +# run a short benchmark pass and pack an inspection-only 0.0.0 NuGet package. +# This workflow never changes the version and never publishes anything. +name: CI + +on: + pull_request: + branches: [ main ] + types: [ opened, synchronize, reopened ] + push: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + # Non-release builds are always versioned 0.0.0; only release.yml sets a real version. + CI_VERSION: 0.0.0 + LIBRARY_PROJECT: NullFX.CRC/NullFX.CRC.csproj + TEST_PROJECT: NullFX.CRC.Tests/NullFX.CRC.Tests.csproj + BENCHMARK_PROJECT: NullFX.CRC.Benchmarks/NullFX.CRC.Benchmarks.csproj + +jobs: + build: + name: Build (all target frameworks) + # Windows is required for the .NET Framework (net40-net48) targets. + runs-on: windows-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup .NET SDKs + uses: actions/setup-dotnet@v5 + with: + # The .NET 10 SDK builds every target (netcoreapp3.1/net6.0/net7.0 and + # net4x reference packs are restored from NuGet). .NET 8 is installed + # as the fallback runtime. + dotnet-version: | + 8.0.x + 10.0.x + + - name: Show SDKs + run: dotnet --info + + - name: Restore + run: dotnet restore ${{ env.LIBRARY_PROJECT }} + + - name: Build + run: > + dotnet build ${{ env.LIBRARY_PROJECT }} -c Release --no-restore + -p:RELEASE_VERSION=${{ env.CI_VERSION }} + -bl:artifacts/logs/build.binlog + + - name: Verify every target framework was built + shell: pwsh + run: | + $tfms = (dotnet msbuild $env:LIBRARY_PROJECT -getProperty:TargetFrameworks | Out-String).Trim().Split(';') + $missing = $tfms | Where-Object { -not (Test-Path "NullFX.CRC/bin/Release/$_/NullFX.CRC.dll") } + "| Target framework | Built |`n|---|---|" | Add-Content $env:GITHUB_STEP_SUMMARY + foreach ($t in $tfms) { "| $t | $(if ($missing -contains $t) { 'no' } else { 'yes' }) |" | Add-Content $env:GITHUB_STEP_SUMMARY } + if ($missing) { throw "Missing build output for: $($missing -join ', ')" } + + - name: Pack (inspection only, version ${{ env.CI_VERSION }}) + run: > + dotnet pack ${{ env.LIBRARY_PROJECT }} -c Release --no-build + -p:RELEASE_VERSION=${{ env.CI_VERSION }} + -o artifacts/package + + - name: Verify package + shell: pwsh + run: ./.github/scripts/verify-package.ps1 -PackageDirectory artifacts/package -Version $env:CI_VERSION + + - name: Upload package + uses: actions/upload-artifact@v6 + with: + name: nuget-package-pr + path: artifacts/package/ + if-no-files-found: error + retention-days: 14 + + - name: Upload build logs + if: always() + uses: actions/upload-artifact@v6 + with: + name: build-logs + path: artifacts/logs/ + if-no-files-found: ignore + retention-days: 14 + + test: + name: Unit tests (net10.0) + needs: build + runs-on: windows-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v6 + + - name: Setup .NET SDKs + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 10.0.x + + - name: Restore + run: dotnet restore ${{ env.TEST_PROJECT }} + + - name: Build + run: dotnet build ${{ env.TEST_PROJECT }} -c Release --no-restore -p:RELEASE_VERSION=${{ env.CI_VERSION }} + + - name: Test + run: > + dotnet test ${{ env.TEST_PROJECT }} -c Release --no-build -f net10.0 + --logger "trx;LogFileName=test-results.trx" + --logger "console;verbosity=normal" + --results-directory artifacts/test-results + + - name: Publish test summary + if: always() + shell: pwsh + run: | + $trx = Get-ChildItem artifacts/test-results -Filter *.trx -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 + if (-not $trx) { "### Unit tests`nNo TRX results were produced." | Add-Content $env:GITHUB_STEP_SUMMARY; exit 0 } + [xml] $x = Get-Content $trx.FullName + $c = $x.TestRun.ResultSummary.Counters + $lines = @( + '### Unit tests (net10.0)', '', + '| Outcome | Total | Passed | Failed | Skipped |', '|---|---|---|---|---|', + "| $($x.TestRun.ResultSummary.outcome) | $($c.total) | $($c.passed) | $($c.failed) | $([int]$c.notExecuted) |" + ) + $failed = $x.TestRun.Results.UnitTestResult | Where-Object { $_.outcome -eq 'Failed' } + if ($failed) { $lines += '', '**Failed tests**', ''; $lines += $failed | ForEach-Object { "- ``$($_.testName)``" } } + $lines -join "`n" | Add-Content $env:GITHUB_STEP_SUMMARY + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v6 + with: + name: test-results + path: artifacts/test-results/ + if-no-files-found: warn + retention-days: 14 + + benchmark: + name: Benchmarks (net10.0, short run) + needs: build + runs-on: windows-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v6 + + - name: Setup .NET SDKs + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 10.0.x + + - name: Run benchmarks + # A ShortRun job keeps PR feedback fast (full statistical runs are not + # meaningful on shared CI runners anyway). Results are relative + # NullFX vs. System.Data.HashFunction numbers, not absolute timings. + run: > + dotnet run --project ${{ env.BENCHMARK_PROJECT }} -c Release -f net10.0 + --property:RELEASE_VERSION=${{ env.CI_VERSION }} + -- --job short --exporters json github --artifacts artifacts/benchmarks + + - name: Publish benchmark summary + if: always() + shell: pwsh + run: | + $reports = Get-ChildItem artifacts/benchmarks/results -Filter *-report-github.md -ErrorAction SilentlyContinue + if (-not $reports) { "### Benchmarks`nNo benchmark report was produced." | Add-Content $env:GITHUB_STEP_SUMMARY; exit 0 } + "### Benchmarks (net10.0, ShortRun)`n" | Add-Content $env:GITHUB_STEP_SUMMARY + $reports | ForEach-Object { Get-Content $_.FullName -Raw | Add-Content $env:GITHUB_STEP_SUMMARY } + + - name: Upload benchmark results + if: always() + uses: actions/upload-artifact@v6 + with: + name: benchmark-results + path: artifacts/benchmarks/ + if-no-files-found: warn + retention-days: 30 diff --git a/.github/workflows/cicd-actions.yml b/.github/workflows/cicd-actions.yml deleted file mode 100644 index 68235cb..0000000 --- a/.github/workflows/cicd-actions.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: build - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - types: [opened, synchronize, reopened] - -jobs: - build: - runs-on: windows-latest - steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 2.0.x - 3.1.x - 6.0.x - 7.0.x - - name: replace version tokens - uses: cschleiden/replace-tokens@v1.2 - with: - files: '["**/*.csproj"]' - env: - RELEASE_VERSION: ${{ vars.RELEASE_VERSION }} - - name: install dependencies - run: dotnet restore - - name: build source - run: dotnet build -c Release - - name: run tests - run: dotnet test - - name: create nuget packages - run: dotnet pack -c Release -o ./out - - name: push nuget packages to github - run: dotnet nuget push "./out/NullFX.CRC.${{ vars.RELEASE_VERSION }}.nupkg" --skip-duplicate -s "https://nuget.pkg.github.com/nullfx/index.json" -k "${{ secrets.GITHUB_TOKEN }}" - - name: push nuget packages to nuget.org - run: dotnet nuget push "./out/NullFX.CRC.${{ vars.RELEASE_VERSION }}.nupkg" --skip-duplicate -s "https://api.nuget.org/v3/index.json" -k "${{ secrets.NUGET_ORG_API_KEY }}" - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~\sonar\cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache SonarCloud scanner - id: cache-sonar-scanner - uses: actions/cache@v1 - with: - path: .\.sonar\scanner - key: ${{ runner.os }}-sonar-scanner - restore-keys: ${{ runner.os }}-sonar-scanner - - name: Install SonarCloud scanner - if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - shell: powershell - run: | - New-Item -Path .\.sonar\scanner -ItemType Directory - dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - shell: powershell - run: | - .\.sonar\scanner\dotnet-sonarscanner begin /k:"nullfx_NullFX.CRC" /o:"nullfx" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.dotnet.excludeTestProjects=true - dotnet build -f net7.0 --no-restore - .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" diff --git a/NullFX.CRC/NullFX.CRC.csproj b/NullFX.CRC/NullFX.CRC.csproj index 17e9855..9e7b670 100644 --- a/NullFX.CRC/NullFX.CRC.csproj +++ b/NullFX.CRC/NullFX.CRC.csproj @@ -20,7 +20,8 @@ snupkg MIT Release;Debug - True + + true