Skip to content

Commit 06a3ceb

Browse files
committed
Streamline CI jobs
Add net8.0 as target framework. Remove the `doctests` workflow, since all tests inside `tests/Doc` are executed anyway during the `integration` workflow. Separate the concurrency groups between workflows, to avoid them cancelling each other during one CI run. This seems to be a known issue: https://github.com/orgs/community/discussions/41518 Update the release workflow to use dotnet 8, given that we have it as a target now. Print the dotnet version and available SDKs and runtimes in some workflows, for clarity. Update the `reusable` workflow to build for a specific target framework, and to use a specific version of the dotnet SDK when building and running tests. This is done via a generated `global.json` file. The goal is to ensure that the source code can compile on all supported SDKs. Make the `linter` workflow do the checkout just like the others, without explicitly specifying what to checkout.
1 parent c511a51 commit 06a3ceb

File tree

11 files changed

+56
-82
lines changed

11 files changed

+56
-82
lines changed

.github/workflows/doctests.yml

-39
This file was deleted.

.github/workflows/integration.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- cron: "0 1 * * *"
1313

1414
concurrency:
15-
group: ${{ github.event.pull_request.number || github.ref }}
15+
group: ${{ github.event.pull_request.number || github.ref }}-integration
1616
cancel-in-progress: true
1717

1818
jobs:
@@ -22,6 +22,7 @@ jobs:
2222
with:
2323
redis_stack_type: cluster
2424
clr_version: net6.0
25+
dotnet_sdk_version: 6.0.0
2526
dotenv_file: .github/cluster.env
2627
secrets: inherit
2728

@@ -36,6 +37,7 @@ jobs:
3637
with:
3738
redis_stack_type: ${{matrix.redis-stack-type}}
3839
clr_version: net6.0
40+
dotnet_sdk_version: 6.0.0
3941
dotenv_file: .github/standalone.env
4042
secrets: inherit
4143

@@ -45,6 +47,7 @@ jobs:
4547
with:
4648
redis_stack_type: cluster
4749
clr_version: net7.0
50+
dotnet_sdk_version: 7.0.0
4851
dotenv_file: .github/cluster.env
4952
secrets: inherit
5053

@@ -59,6 +62,7 @@ jobs:
5962
with:
6063
redis_stack_type: ${{matrix.redis-stack-type}}
6164
clr_version: net7.0
65+
dotnet_sdk_version: 7.0.0
6266
dotenv_file: .github/standalone.env
6367
secrets: inherit
6468

@@ -68,6 +72,7 @@ jobs:
6872
with:
6973
redis_stack_type: cluster
7074
clr_version: net8.0
75+
dotnet_sdk_version: 8.0.0
7176
dotenv_file: .github/cluster.env
7277
secrets: inherit
7378

@@ -82,6 +87,7 @@ jobs:
8287
with:
8388
redis_stack_type: ${{matrix.redis-stack-type}}
8489
clr_version: net8.0
90+
dotnet_sdk_version: 8.0.0
8591
dotenv_file: .github/standalone.env
8692
secrets: inherit
8793

.github/workflows/linter.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Format check on pull request
33
on: pull_request
44

55
concurrency:
6-
group: ${{ github.event.pull_request.number || github.ref }}
6+
group: ${{ github.event.pull_request.number || github.ref }}-linter
77
cancel-in-progress: true
88

99
jobs:
@@ -14,9 +14,7 @@ jobs:
1414
run: dotnet tool install -g dotnet-format
1515

1616
- name: Checkout repo
17-
uses: actions/checkout@v2
18-
with:
19-
ref: ${{ github.head_ref }}
17+
uses: actions/checkout@v3
2018

2119
- name: lint
2220
run: |

.github/workflows/nuget-release.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
12-
- name: Set up .NET Core 6
13-
uses: actions/setup-dotnet@v2
12+
- name: Set up .NET Core 8
13+
uses: actions/setup-dotnet@v3
1414
with:
15-
dotnet-version: '6.0.x'
16-
- name: Set up .NET Core 7
17-
uses: actions/setup-dotnet@v2
18-
with:
19-
dotnet-version: '7.0.x'
15+
dotnet-version: 8
16+
- name: Check .NET version
17+
run: dotnet --version
18+
- name: Check .NET SDKs
19+
run: dotnet --list-sdks
20+
- name: Check .NET runtimes
21+
run: dotnet --list-runtimes
2022
- name: Build
2123
run: dotnet pack -c Release --output .
22-
2324
- name: Publish
2425
uses: alirezanet/[email protected]
2526
with:

.github/workflows/reusable.yml

+24-19
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,22 @@ on:
77
required: true
88
type: string
99

10+
# Target .NET framework, i.e. "net6.0".
1011
clr_version:
1112
required: true
1213
type: string
1314

15+
# SDK version, as obtained when running `dotnet --list-sdks`,
16+
# i.e. "6.0.418", although it is safe to use '6.0.0' because
17+
# in global.json we set the rollForward strategy to "latestMinor".
18+
dotnet_sdk_version:
19+
required: true
20+
type: string
21+
1422
dotenv_file:
1523
required: true
1624
type: string
1725
jobs:
18-
1926
build_and_test:
2027
name: Test
2128
runs-on: ubuntu-latest
@@ -25,24 +32,12 @@ jobs:
2532
PASSWORD: ${{ secrets.PASSWORD }}
2633
ENDPOINT: ${{ secrets.ENDPOINT }}
2734
steps:
28-
2935
- uses: actions/checkout@v3
3036

31-
- name: .NET Core 6
32-
uses: actions/setup-dotnet@v2
33-
with:
34-
dotnet-version: '6.0.x'
35-
36-
- name: .NET Core 7
37-
uses: actions/setup-dotnet@v2
38-
with:
39-
dotnet-version: '7.0.x'
40-
41-
- name: .NET Core 8 preview
37+
- name: .NET Core 8
4238
uses: actions/setup-dotnet@v3
4339
with:
4440
dotnet-version: 8
45-
dotnet-quality: 'preview'
4641

4742
- name: run redis-stack-server docker
4843
working-directory: .github
@@ -53,16 +48,27 @@ jobs:
5348
with:
5449
env-file: ${{inputs.dotenv_file}}
5550

51+
# Make sure only the desired dotnet version is set both as target and as active SDK.
52+
- name: Tweak target frameworks
53+
run: |
54+
find . -name '*.csproj' | xargs -I {} sed -E -i 's|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${{inputs.clr_version}}</TargetFramework>|' {}
55+
find . -name '*.csproj' | xargs cat
56+
jq -n --arg version ${{inputs.dotnet_sdk_version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
57+
- name: Check .NET version
58+
run: dotnet --version
59+
- name: Check .NET SDKs
60+
run: dotnet --list-sdks
61+
- name: Check .NET runtimes
62+
run: dotnet --list-runtimes
5663
- name: Restore dependencies
5764
run: dotnet restore
5865
- name: Build
5966
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
6067
- name: Test
6168
run: |
62-
echo "${{secrets.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_ca.pem
63-
echo "${{secrets.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_user.crt
64-
echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_user_private.key
65-
ls -R
69+
echo "${{secrets.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_ca.pem
70+
echo "${{secrets.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_user.crt
71+
echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_user_private.key
6672
dotnet test -f ${{inputs.clr_version}} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
6773
- name: Codecov
6874
uses: codecov/codecov-action@v3
@@ -71,4 +77,3 @@ jobs:
7177
verbose: true
7278
- name: Build
7379
run: dotnet pack -c Release
74-

.github/workflows/spellcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55

66
concurrency:
7-
group: ${{ github.event.pull_request.number || github.ref }}
7+
group: ${{ github.event.pull_request.number || github.ref }}-spellcheck
88
cancel-in-progress: true
99

1010
jobs:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,6 @@ tests/NRedisStack.Tests/redis_ca.pem
405405
tests/NRedisStack.Tests/redis_credentials/redis_user_private.key
406406
tests/NRedisStack.Tests/redis_credentials/redis_user.crt
407407
.env
408+
409+
# global.json
410+
global.json

src/NRedisStack/NRedisStack.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Nullable>enable</Nullable>
5-
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
5+
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
66
<LangVersion>latest</LangVersion>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Authors>Redis Open Source</Authors>

tests/Doc/Doc.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows())))</IsWindows>
4-
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net481</TargetFrameworks>
5-
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net8.0;net481</TargetFrameworks>
5+
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0;net8.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<LangVersion>latest</LangVersion>

tests/NRedisStack.Tests/NRedisStack.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows())))</IsWindows>
4-
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net481</TargetFrameworks>
5-
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net8.0;net481</TargetFrameworks>
5+
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0;net8.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<LangVersion>latest</LangVersion>

tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRange.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,18 @@ public void TestMRangeLatest()
322322
(long)TimeSpan.FromHours(1).TotalMilliseconds, // 1h used to force partial bucket
323323
TsAggregation.Sum);
324324

325-
ts.Create(primaryTsKey, labels: [label]);
326-
ts.Create(compactedTsKey, labels: [label, compactedLabel]);
325+
ts.Create(primaryTsKey, labels: new[] { label });
326+
ts.Create(compactedTsKey, labels: new[] { label, compactedLabel });
327327
ts.CreateRule(primaryTsKey, compactionRule);
328-
var tuples = CreateData(ts, 50, [primaryTsKey]);
328+
var tuples = CreateData(ts, 50, new[] { primaryTsKey });
329329

330-
var results = ts.MRange("-", "+", ["key=MRangeLatest", "compact=true"], latest: true);
330+
var results = ts.MRange("-", "+", new[] { "key=MRangeLatest", "compact=true" }, latest: true);
331331
Assert.Single(results);
332332
Assert.Equal(compactedTsKey, results[0].key);
333333
Assert.NotEmpty(results[0].values);
334334
Assert.Equal(tuples.Sum(x => x.Val), results[0].values.Sum(x => x.Val));
335335

336-
results = ts.MRange("-", "+", ["key=MRangeLatest", "compact=true"], latest: false);
336+
results = ts.MRange("-", "+", new[] { "key=MRangeLatest", "compact=true" }, latest: false);
337337
Assert.Single(results);
338338
Assert.Equal(compactedTsKey, results[0].key);
339339
Assert.Empty(results[0].values);

0 commit comments

Comments
 (0)