From 21b28b843c509c3245615e57c758cb2d51970f12 Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 17:03:05 -0700 Subject: [PATCH 1/9] net9 --- .github/workflows/gate.yml | 21 ++++++++++++++++--- .../BitFaster.Caching.UnitTests.csproj | 4 ++-- BitFaster.Caching/BitFaster.Caching.csproj | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 2cac34d6..10db53e2 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -69,13 +69,28 @@ jobs: with: name: test-results-win6-std path: BitFaster.Caching.UnitTests.Std/TestResults/results6.trx + + - name: Test (9.0) + run: dotnet test --no-restore --verbosity normal -f net9.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results9.trx" + - name: Upload test results (9.0) + uses: actions/upload-artifact@v4 # upload test results + if: success() || failure() # run this step even if previous step failed + with: + name: test-results-win9 + path: BitFaster.Caching.UnitTests/TestResults/results9.trx + - name: Upload test results (9.0 .NET Std) + uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: test-results-win9-std + path: BitFaster.Caching.UnitTests.Std/TestResults/results9.trx - - name: Publish coverage report to coveralls.io (6.0) + - name: Publish coverage report to coveralls.io (9.0) uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info - flag-name: win6 + path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net9.0.info + flag-name: win9 parallel: true - name: Publish NuGet artifacts diff --git a/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj b/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj index 73b58a9f..5ba5fdbe 100644 --- a/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj +++ b/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj @@ -1,8 +1,8 @@ - net48;netcoreapp3.1;net6.0 - 9.0 + net48;net6.0 + 10.0 diff --git a/BitFaster.Caching/BitFaster.Caching.csproj b/BitFaster.Caching/BitFaster.Caching.csproj index e29e04b9..1c2bbfb3 100644 --- a/BitFaster.Caching/BitFaster.Caching.csproj +++ b/BitFaster.Caching/BitFaster.Caching.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netcoreapp3.1;net6.0 + netstandard2.0;netcoreapp3.1;net6.0;net9.0 11.0 Alex Peck From 042ad568b5da83f90ce94d7dcb6c9b801ea4913d Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 17:42:21 -0700 Subject: [PATCH 2/9] different build leg --- .github/workflows/gate.yml | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 10db53e2..3b73c79b 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -22,9 +22,7 @@ jobs: with: dotnet-version: | 3.1.x - 6.0.x - 8.0.x - 9.0.x + - name: Install dependencies run: dotnet restore - name: Build @@ -55,6 +53,32 @@ jobs: flag-name: win3 parallel: true + - name: Publish NuGet artifacts + uses: actions/upload-artifact@v4 + with: + name: NuGet package + path: BitFaster.Caching/bin/Release/ + win2: + + runs-on: windows-latest + + permissions: + checks: write + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + 9.0.x + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test (6.0) run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results6.trx" - name: Upload test results (6.0) @@ -93,12 +117,6 @@ jobs: flag-name: win9 parallel: true - - name: Publish NuGet artifacts - uses: actions/upload-artifact@v4 - with: - name: NuGet package - path: BitFaster.Caching/bin/Release/ - mac: runs-on: macos-latest @@ -185,7 +203,7 @@ jobs: coverage: - needs: [win, mac, linux] + needs: [win, win2, mac, linux] runs-on: ubuntu-latest From 8ad52ad9807c4f94c156e35666502a26ec8e80aa Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 17:51:27 -0700 Subject: [PATCH 3/9] fix proj --- BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj b/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj index 5ba5fdbe..f01a8cef 100644 --- a/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj +++ b/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj @@ -1,7 +1,7 @@ - net48;net6.0 + net48;netcoreapp3.1;net6.0;net9.0 10.0 From f0cc3108eda9d69cbdc8e9bfd5a770104f1f973c Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:21:25 -0700 Subject: [PATCH 4/9] fix test --- BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs index 343a7958..7188d2af 100644 --- a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs +++ b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs @@ -12,8 +12,9 @@ public class ConcurrentLfuBuilderTests [Fact] public void TestConcurrencyLevel() { + // on .net9, -1 indicates the default concurrency level var b = new ConcurrentLfuBuilder() - .WithConcurrencyLevel(-1); + .WithConcurrencyLevel(-2); Action constructor = () => { var x = b.Build(); }; From f1656675df7392bbde4a962f663dca33cb06f920 Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:23:43 -0700 Subject: [PATCH 5/9] default concurrency --- BitFaster.Caching/Lru/Defaults.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BitFaster.Caching/Lru/Defaults.cs b/BitFaster.Caching/Lru/Defaults.cs index 7e225d15..e15847bf 100644 --- a/BitFaster.Caching/Lru/Defaults.cs +++ b/BitFaster.Caching/Lru/Defaults.cs @@ -1,11 +1,13 @@ using System; -using System.Collections.Generic; -using System.Text; namespace BitFaster.Caching.Lru { internal static class Defaults { +#if NET9_0_OR_GREATER + public static int ConcurrencyLevel => -1; +#else public static int ConcurrencyLevel => Environment.ProcessorCount; +#endif } } From d8d999c2adf2ec7e96c38dcd5bf5c4ec15ca2b5b Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:32:51 -0700 Subject: [PATCH 6/9] correct version --- BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs | 4 ++-- BitFaster.Caching/Lru/Defaults.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs index 7188d2af..5156996e 100644 --- a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs +++ b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs @@ -12,9 +12,9 @@ public class ConcurrentLfuBuilderTests [Fact] public void TestConcurrencyLevel() { - // on .net9, -1 indicates the default concurrency level + // Note that on .net8+, -1 indicates the default concurrency level var b = new ConcurrentLfuBuilder() - .WithConcurrencyLevel(-2); + .WithConcurrencyLevel(0); Action constructor = () => { var x = b.Build(); }; diff --git a/BitFaster.Caching/Lru/Defaults.cs b/BitFaster.Caching/Lru/Defaults.cs index e15847bf..36f9dc51 100644 --- a/BitFaster.Caching/Lru/Defaults.cs +++ b/BitFaster.Caching/Lru/Defaults.cs @@ -4,7 +4,7 @@ namespace BitFaster.Caching.Lru { internal static class Defaults { -#if NET9_0_OR_GREATER +#if NET8_0_OR_GREATER public static int ConcurrencyLevel => -1; #else public static int ConcurrencyLevel => Environment.ProcessorCount; From f790a7d85a8ba2f29f4bef6f713ea916f7c1dac5 Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:35:07 -0700 Subject: [PATCH 7/9] more tests --- BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs b/BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs index 851640c3..fe94c0b9 100644 --- a/BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs +++ b/BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs @@ -109,7 +109,7 @@ public void TestComparer() public void TestConcurrencyLevel() { var b = new ConcurrentLruBuilder() - .WithConcurrencyLevel(-1); + .WithConcurrencyLevel(0); Action constructor = () => { var x = b.Build(); }; From 01d27db4054886868d5d1fb693828626058300da Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:37:10 -0700 Subject: [PATCH 8/9] cleanup --- BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs | 1 - BitFaster.Caching/Lru/Defaults.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs index 5156996e..5ab66dd6 100644 --- a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs +++ b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs @@ -12,7 +12,6 @@ public class ConcurrentLfuBuilderTests [Fact] public void TestConcurrencyLevel() { - // Note that on .net8+, -1 indicates the default concurrency level var b = new ConcurrentLfuBuilder() .WithConcurrencyLevel(0); diff --git a/BitFaster.Caching/Lru/Defaults.cs b/BitFaster.Caching/Lru/Defaults.cs index 36f9dc51..79624d3c 100644 --- a/BitFaster.Caching/Lru/Defaults.cs +++ b/BitFaster.Caching/Lru/Defaults.cs @@ -5,6 +5,7 @@ namespace BitFaster.Caching.Lru internal static class Defaults { #if NET8_0_OR_GREATER + // Note that on .net8+, -1 indicates the default concurrency level public static int ConcurrencyLevel => -1; #else public static int ConcurrencyLevel => Environment.ProcessorCount; From 624cae9e0f54e7c28bf016a17b709e8d8c3b2a9e Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Sat, 28 Jun 2025 18:57:49 -0700 Subject: [PATCH 9/9] publish coverage for net6 --- .github/workflows/gate.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 3b73c79b..d5200d63 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -94,6 +94,14 @@ jobs: name: test-results-win6-std path: BitFaster.Caching.UnitTests.Std/TestResults/results6.trx + - name: Publish coverage report to coveralls.io (6.0) + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info + flag-name: win6 + parallel: true + - name: Test (9.0) run: dotnet test --no-restore --verbosity normal -f net9.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results9.trx" - name: Upload test results (9.0)