diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index 2cac34d6..d5200d63 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) @@ -69,7 +93,7 @@ jobs: with: 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: @@ -78,11 +102,28 @@ jobs: flag-name: win6 parallel: true - - name: Publish NuGet artifacts + - 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: NuGet package - path: BitFaster.Caching/bin/Release/ + name: test-results-win9-std + path: BitFaster.Caching.UnitTests.Std/TestResults/results9.trx + + - 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.net9.0.info + flag-name: win9 + parallel: true mac: @@ -170,7 +211,7 @@ jobs: coverage: - needs: [win, mac, linux] + needs: [win, win2, mac, linux] runs-on: ubuntu-latest diff --git a/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj b/BitFaster.Caching.UnitTests/BitFaster.Caching.UnitTests.csproj index 73b58a9f..f01a8cef 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;netcoreapp3.1;net6.0;net9.0 + 10.0 diff --git a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs index 343a7958..5ab66dd6 100644 --- a/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs +++ b/BitFaster.Caching.UnitTests/Lfu/ConcurrentLfuBuilderTests.cs @@ -13,7 +13,7 @@ public class ConcurrentLfuBuilderTests public void TestConcurrencyLevel() { var b = new ConcurrentLfuBuilder() - .WithConcurrencyLevel(-1); + .WithConcurrencyLevel(0); Action constructor = () => { var x = b.Build(); }; 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(); }; 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 diff --git a/BitFaster.Caching/Lru/Defaults.cs b/BitFaster.Caching/Lru/Defaults.cs index 7e225d15..79624d3c 100644 --- a/BitFaster.Caching/Lru/Defaults.cs +++ b/BitFaster.Caching/Lru/Defaults.cs @@ -1,11 +1,14 @@ using System; -using System.Collections.Generic; -using System.Text; 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; +#endif } }