Skip to content

Commit ee89e00

Browse files
merge
2 parents b5b0bb0 + 422ab25 commit ee89e00

23 files changed

+1177
-1140
lines changed

.github/workflows/devskim.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
security-events: write
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
2222
- name: Run DevSkim scanner
2323
uses: microsoft/DevSkim-Action@v1
2424
- name: Upload DevSkim scan results to GitHub Security tab
25-
uses: github/codeql-action/upload-sarif@v2
25+
uses: github/codeql-action/upload-sarif@v3
2626
with:
2727
sarif_file: devskim-results.sarif

.github/workflows/gate.yml

Lines changed: 125 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -8,175 +8,136 @@ on:
88
branches: [ main ]
99

1010
jobs:
11-
win:
12-
13-
runs-on: windows-latest
14-
15-
permissions:
16-
checks: write
17-
18-
steps:
19-
- uses: actions/checkout@v4
20-
- name: Setup .NET Core
21-
uses: actions/setup-dotnet@v4
22-
with:
23-
dotnet-version: |
24-
3.1.x
25-
6.0.x
26-
8.0.x
27-
9.0.x
28-
- name: Install dependencies
29-
run: dotnet restore
30-
- name: Build
31-
run: dotnet build --configuration Release --no-restore
32-
33-
- name: Test (4.8)
34-
run: dotnet test --no-restore --verbosity normal -f net48 --logger "trx;LogFileName=results4.trx"
35-
- name: Upload test results (4.8)
36-
uses: actions/upload-artifact@v4 # upload test results
37-
if: success() || failure() # run this step even if previous step failed
38-
with:
39-
name: test-results-win48
40-
path: BitFaster.Caching.UnitTests/TestResults/results4.trx
41-
42-
- name: Test (3.1)
43-
run: dotnet test --no-restore --verbosity normal -f netcoreapp3.1 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results3.trx"
44-
- name: Upload test results (3.1)
45-
uses: actions/upload-artifact@v4 # upload test results
46-
if: success() || failure() # run this step even if previous step failed
47-
with:
48-
name: test-results-win3
49-
path: BitFaster.Caching.UnitTests/TestResults/results3.trx
50-
- name: Publish coverage report to coveralls.io (3.1)
51-
uses: coverallsapp/github-action@master
52-
with:
53-
github-token: ${{ secrets.GITHUB_TOKEN }}
54-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.netcoreapp3.1.info
55-
flag-name: win3
56-
parallel: true
57-
58-
- name: Test (6.0)
59-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results6.trx"
60-
- name: Upload test results (6.0)
61-
uses: actions/upload-artifact@v4 # upload test results
62-
if: success() || failure() # run this step even if previous step failed
63-
with:
64-
name: test-results-win6
65-
path: BitFaster.Caching.UnitTests/TestResults/results6.trx
66-
- name: Upload test results (6.0 .NET Std)
67-
uses: actions/upload-artifact@v4
68-
if: success() || failure()
69-
with:
70-
name: test-results-win6-std
71-
path: BitFaster.Caching.UnitTests.Std/TestResults/results6.trx
72-
73-
- name: Publish coverage report to coveralls.io (6.0)
74-
uses: coverallsapp/github-action@master
75-
with:
76-
github-token: ${{ secrets.GITHUB_TOKEN }}
77-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
78-
flag-name: win6
79-
parallel: true
80-
81-
- name: Publish NuGet artifacts
82-
uses: actions/upload-artifact@v4
83-
with:
84-
name: NuGet package
85-
path: BitFaster.Caching/bin/Release/
86-
87-
mac:
88-
89-
runs-on: macos-latest
90-
11+
build:
12+
name: ${{ matrix.framework }} ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
9114
permissions:
9215
checks: write
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
# Windows
21+
- os: windows-latest
22+
framework: net48
23+
coverage: false
24+
results: results4.trx
25+
artifact: test-results-win48
26+
std: false
27+
flag: net48
28+
publish_nuget: true
29+
30+
- os: windows-latest
31+
framework: netcoreapp3.1
32+
coverage: true
33+
results: results3.trx
34+
artifact: test-results-win3
35+
std: false
36+
flag: win3
37+
publish_nuget: false
38+
39+
- os: windows-latest
40+
framework: net6.0
41+
coverage: true
42+
results: results6.trx
43+
artifact: test-results-win6
44+
std: true
45+
flag: win6
46+
publish_nuget: false
47+
48+
- os: windows-latest
49+
framework: net9.0
50+
coverage: true
51+
results: results9.trx
52+
artifact: test-results-win9
53+
std: true
54+
flag: win9
55+
publish_nuget: false
56+
57+
# macOS
58+
- os: macos-latest
59+
framework: net6.0
60+
coverage: true
61+
results: results.trx
62+
artifact: test-results-mac
63+
std: true
64+
flag: mac
65+
publish_nuget: false
66+
67+
# Linux
68+
- os: ubuntu-latest
69+
framework: net6.0
70+
coverage: true
71+
results: results.trx
72+
artifact: test-results-linux
73+
std: true
74+
flag: linux
75+
publish_nuget: false
9376

9477
steps:
95-
- uses: actions/checkout@v4
96-
- name: Setup .NET Core
97-
uses: actions/setup-dotnet@v4
98-
with:
99-
dotnet-version: |
100-
6.0.x
101-
8.0.x
102-
9.0.x
103-
- name: Install dependencies
104-
run: dotnet restore
105-
- name: Build
106-
run: dotnet build --configuration Release --no-restore
107-
- name: Test
108-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx"
109-
- name: Publish coverage report to coveralls.io
110-
uses: coverallsapp/github-action@master
111-
with:
112-
github-token: ${{ secrets.GITHUB_TOKEN }}
113-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
114-
flag-name: mac
115-
parallel: true
116-
- name: Upload test results (6.0)
117-
uses: actions/upload-artifact@v4
118-
if: success() || failure()
119-
with:
120-
name: test-results-mac
121-
path: BitFaster.Caching.UnitTests/TestResults/results.trx
122-
- name: Upload test results (6.0 .NET Std)
123-
uses: actions/upload-artifact@v4
124-
if: success() || failure()
125-
with:
126-
name: test-results-mac-std
127-
path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx
128-
129-
linux:
130-
131-
runs-on: ubuntu-latest
132-
133-
permissions:
134-
checks: write
135-
136-
steps:
137-
- uses: actions/checkout@v4
138-
- name: Setup .NET Core
139-
uses: actions/setup-dotnet@v4
140-
with:
141-
dotnet-version: |
142-
6.0.x
143-
8.0.x
144-
9.0.x
145-
- name: Install dependencies
146-
run: dotnet restore
147-
- name: Build
148-
run: dotnet build --configuration Release --no-restore
149-
- name: Test
150-
run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx"
151-
- name: Publish coverage report to coveralls.io
152-
uses: coverallsapp/github-action@master
153-
with:
154-
github-token: ${{ secrets.GITHUB_TOKEN }}
155-
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info
156-
flag-name: linux
157-
parallel: true
158-
- name: Upload test results (6.0)
159-
uses: actions/upload-artifact@v4
160-
if: success() || failure()
161-
with:
162-
name: test-results-linux
163-
path: BitFaster.Caching.UnitTests/TestResults/results.trx
164-
- name: Upload test results (6.0 .NET Std)
165-
uses: actions/upload-artifact@v4
166-
if: success() || failure()
167-
with:
168-
name: test-results-linux-std
169-
path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx
78+
- uses: actions/checkout@v4
79+
80+
- name: Setup .NET Core
81+
uses: actions/setup-dotnet@v4
82+
with:
83+
dotnet-version: |
84+
3.1.x
85+
6.0.x
86+
8.0.x
87+
9.0.x
88+
89+
- name: Install dependencies
90+
run: dotnet restore
91+
92+
- name: Build
93+
run: dotnet build --configuration Release --no-restore
94+
95+
- name: Test
96+
run: |
97+
dotnet test --no-restore --verbosity normal -f ${{ matrix.framework }} \
98+
${{ matrix.coverage && '-p:CollectCoverage=true' || '' }} \
99+
${{ matrix.coverage && '-p:CoverletOutput=TestResults/' || '' }} \
100+
${{ matrix.coverage && '-p:CoverletOutputFormat=lcov' || '' }} \
101+
--logger "trx;LogFileName=${{ matrix.results }}"
102+
shell: bash
103+
104+
- name: Upload test results
105+
uses: actions/upload-artifact@v4
106+
if: success() || failure()
107+
with:
108+
name: ${{ matrix.artifact }}
109+
path: BitFaster.Caching.UnitTests/TestResults/${{ matrix.results }}
110+
111+
- name: Upload test results (.NET Std)
112+
if: ${{ matrix.std }}
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: ${{ matrix.artifact }}-std
116+
path: BitFaster.Caching.UnitTests.Std/TestResults/${{ matrix.results }}
117+
118+
- name: Publish coverage report to coveralls.io
119+
if: ${{ matrix.coverage && matrix.flag != '' }}
120+
uses: coverallsapp/github-action@master
121+
with:
122+
github-token: ${{ secrets.GITHUB_TOKEN }}
123+
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.${{ matrix.framework }}.info
124+
flag-name: ${{ matrix.flag }}
125+
parallel: true
126+
127+
- name: Publish NuGet artifacts
128+
if: ${{ matrix.publish_nuget }}
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: NuGet package
132+
path: BitFaster.Caching/bin/Release/
170133

171134
coverage:
172-
173-
needs: [win, mac, linux]
174-
135+
name: Coveralls Finished
136+
needs: build
175137
runs-on: ubuntu-latest
176-
177138
steps:
178-
- name: Coveralls Finished
179-
uses: coverallsapp/github-action@master
180-
with:
181-
github-token: ${{ secrets.GITHUB_TOKEN }}
182-
parallel-finished: true
139+
- name: Coveralls Finished
140+
uses: coverallsapp/github-action@master
141+
with:
142+
github-token: ${{ secrets.GITHUB_TOKEN }}
143+
parallel-finished: true

.github/workflows/infer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ jobs:
3131
binary-path: BitFaster.Caching/bin
3232

3333
- name: Upload SARIF output to GitHub Security Center
34-
uses: github/codeql-action/upload-sarif@v2
34+
uses: github/codeql-action/upload-sarif@v3
3535
with:
3636
sarif_file: infer-out/report.sarif

BitFaster.Caching.Benchmarks/BitFaster.Caching.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<LangVersion>latest</LangVersion>
6-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
6+
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
77
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
88
<!-- https://stackoverflow.com/a/59916801/131345 -->
99
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>

BitFaster.Caching.Benchmarks/DrainBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void Add()
187187
public void DrainArray()
188188
{
189189
Add();
190-
#if NETCOREAPP3_1_OR_GREATER
190+
#if NET
191191
buffer.DrainTo(output.AsSpan());
192192
#else
193193
buffer.DrainTo(new ArraySegment<string>(output));

BitFaster.Caching.Benchmarks/Lfu/CmSketchFlat.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Threading.Tasks;
66

7-
#if NETCOREAPP3_1_OR_GREATER
7+
#if NET
88
using System.Runtime.Intrinsics;
99
using System.Runtime.Intrinsics.X86;
1010
#endif
@@ -53,7 +53,7 @@ public CmSketchFlat(long maximumSize, IEqualityComparer<T> comparer)
5353
/// <returns>The estimated frequency of the value.</returns>
5454
public int EstimateFrequency(T value)
5555
{
56-
#if !NETCOREAPP3_1_OR_GREATER
56+
#if !NET
5757
return EstimateFrequencyStd(value);
5858
#else
5959

@@ -76,7 +76,7 @@ public int EstimateFrequency(T value)
7676
/// <param name="value">The value.</param>
7777
public void Increment(T value)
7878
{
79-
#if !NETCOREAPP3_1_OR_GREATER
79+
#if !NET
8080
IncrementStd(value);
8181
#else
8282

@@ -199,15 +199,15 @@ private int IndexOf(int item, int i)
199199
return ((int)hash) & tableMask;
200200
}
201201

202-
private int Spread(int x)
202+
private static int Spread(int x)
203203
{
204204
uint y = (uint)x;
205205
y = ((y >> 16) ^ y) * 0x45d9f3b;
206206
y = ((y >> 16) ^ y) * 0x45d9f3b;
207207
return (int)((y >> 16) ^ y);
208208
}
209209

210-
#if NETCOREAPP3_1_OR_GREATER
210+
#if NET
211211
private unsafe int EstimateFrequencyAvx(T value)
212212
{
213213
int hash = Spread(comparer.GetHashCode(value));

0 commit comments

Comments
 (0)