Skip to content

Fix dotnet version testing #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/doctests.yml

This file was deleted.

8 changes: 7 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- cron: "0 1 * * *"

concurrency:
group: ${{ github.event.pull_request.number || github.ref }}
group: ${{ github.event.pull_request.number || github.ref }}-integration
cancel-in-progress: true

jobs:
Expand All @@ -22,6 +22,7 @@ jobs:
with:
redis_stack_type: cluster
clr_version: net6.0
dotnet_sdk_version: 6.0.0
dotenv_file: .github/cluster.env
secrets: inherit

Expand All @@ -36,6 +37,7 @@ jobs:
with:
redis_stack_type: ${{matrix.redis-stack-type}}
clr_version: net6.0
dotnet_sdk_version: 6.0.0
dotenv_file: .github/standalone.env
secrets: inherit

Expand All @@ -45,6 +47,7 @@ jobs:
with:
redis_stack_type: cluster
clr_version: net7.0
dotnet_sdk_version: 7.0.0
dotenv_file: .github/cluster.env
secrets: inherit

Expand All @@ -59,6 +62,7 @@ jobs:
with:
redis_stack_type: ${{matrix.redis-stack-type}}
clr_version: net7.0
dotnet_sdk_version: 7.0.0
dotenv_file: .github/standalone.env
secrets: inherit

Expand All @@ -68,6 +72,7 @@ jobs:
with:
redis_stack_type: cluster
clr_version: net8.0
dotnet_sdk_version: 8.0.0
dotenv_file: .github/cluster.env
secrets: inherit

Expand All @@ -82,6 +87,7 @@ jobs:
with:
redis_stack_type: ${{matrix.redis-stack-type}}
clr_version: net8.0
dotnet_sdk_version: 8.0.0
dotenv_file: .github/standalone.env
secrets: inherit

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Format check on pull request
on: pull_request

concurrency:
group: ${{ github.event.pull_request.number || github.ref }}
group: ${{ github.event.pull_request.number || github.ref }}-linter
cancel-in-progress: true

jobs:
Expand All @@ -14,9 +14,7 @@ jobs:
run: dotnet tool install -g dotnet-format

- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
uses: actions/checkout@v3

- name: lint
run: |
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/nuget-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up .NET Core 6
uses: actions/setup-dotnet@v2
- name: Set up .NET Core 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Set up .NET Core 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'
dotnet-version: 8
- name: Check .NET version
run: dotnet --version
- name: Check .NET SDKs
run: dotnet --list-sdks
- name: Check .NET runtimes
run: dotnet --list-runtimes
- name: Build
run: dotnet pack -c Release --output .

- name: Publish
uses: alirezanet/publish-nuget@v3.0.3
with:
Expand Down
43 changes: 24 additions & 19 deletions .github/workflows/reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ on:
required: true
type: string

# Target .NET framework, i.e. "net6.0".
clr_version:
required: true
type: string

# SDK version, as obtained when running `dotnet --list-sdks`,
# i.e. "6.0.418", although it is safe to use '6.0.0' because
# in global.json we set the rollForward strategy to "latestMinor".
dotnet_sdk_version:
required: true
type: string

dotenv_file:
required: true
type: string
jobs:

build_and_test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -25,24 +32,12 @@ jobs:
PASSWORD: ${{ secrets.PASSWORD }}
ENDPOINT: ${{ secrets.ENDPOINT }}
steps:

- uses: actions/checkout@v3

- name: .NET Core 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'

- name: .NET Core 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'

- name: .NET Core 8 preview
- name: .NET Core 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8
dotnet-quality: 'preview'

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

# Make sure only the desired dotnet version is set both as target and as active SDK.
- name: Tweak target frameworks
run: |
find . -name '*.csproj' | xargs -I {} sed -E -i 's|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${{inputs.clr_version}}</TargetFramework>|' {}
find . -name '*.csproj' | xargs cat
jq -n --arg version ${{inputs.dotnet_sdk_version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
- name: Check .NET version
run: dotnet --version
- name: Check .NET SDKs
run: dotnet --list-sdks
- name: Check .NET runtimes
run: dotnet --list-runtimes
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
- name: Test
run: |
echo "${{secrets.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_ca.pem
echo "${{secrets.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_user.crt
echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/net6.0/redis_user_private.key
ls -R
echo "${{secrets.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_ca.pem
echo "${{secrets.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_user.crt
echo "${{secrets.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/${{inputs.clr_version}}/redis_user_private.key
dotnet test -f ${{inputs.clr_version}} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Codecov
uses: codecov/codecov-action@v3
Expand All @@ -71,4 +77,3 @@ jobs:
verbose: true
- name: Build
run: dotnet pack -c Release

2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

concurrency:
group: ${{ github.event.pull_request.number || github.ref }}
group: ${{ github.event.pull_request.number || github.ref }}-spellcheck
cancel-in-progress: true

jobs:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,6 @@ tests/NRedisStack.Tests/redis_ca.pem
tests/NRedisStack.Tests/redis_credentials/redis_user_private.key
tests/NRedisStack.Tests/redis_credentials/redis_user.crt
.env

# global.json
global.json
2 changes: 1 addition & 1 deletion src/NRedisStack/NRedisStack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Nullable>enable</Nullable>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>Redis Open Source</Authors>
Expand Down
4 changes: 2 additions & 2 deletions src/NRedisStack/TimeSeries/TimeSeriesAux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static void AddOnDuplicate(this IList<object> args, TsDuplicatePolicy? po

public static void AddAlign(this IList<object> args, TimeStamp? alignMaybe)
{
if (alignMaybe is {} align)
if (alignMaybe is { } align)
{
args.Add(TimeSeriesArgs.ALIGN);
args.Add(align.Value);
Expand Down Expand Up @@ -251,7 +251,7 @@ public static List<object> BuildTsIncrDecrByArgs(string key, double value, TimeS
IReadOnlyCollection<TimeSeriesLabel>? labels, bool? uncompressed, long? chunkSizeBytes)
{
var args = new List<object> { key, value };
if (timestampMaybe is {} timestamp) args.AddTimeStamp(timestamp);
if (timestampMaybe is { } timestamp) args.AddTimeStamp(timestamp);
args.AddRetentionTime(retentionTime);
args.AddChunkSize(chunkSizeBytes);
if (labels != null) args.AddLabels(labels);
Expand Down
4 changes: 2 additions & 2 deletions tests/Doc/Doc.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows())))</IsWindows>
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net481</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net8.0;net481</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
4 changes: 2 additions & 2 deletions tests/NRedisStack.Tests/NRedisStack.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::get_Windows())))</IsWindows>
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net481</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' == 'true'">net6.0;net7.0;net8.0;net481</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsWindows)' != 'true'">net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
4 changes: 3 additions & 1 deletion tests/NRedisStack.Tests/RedisFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public RedisFixture()

ConfigurationOptions clusterConfig = new ConfigurationOptions
{
EndPoints = endpoints
EndPoints = endpoints,
AsyncTimeout = 10000,
SyncTimeout = 10000
};

isOSSCluster = true;
Expand Down
12 changes: 6 additions & 6 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,22 @@ public void TestMRangeLatest()
var compactedLabel = new TimeSeriesLabel("compact", "true");
string primaryTsKey = _keys[0], compactedTsKey = _keys[1];
var compactionRule = new TimeSeriesRule(
compactedTsKey,
compactedTsKey,
(long)TimeSpan.FromHours(1).TotalMilliseconds, // 1h used to force partial bucket
TsAggregation.Sum);

ts.Create(primaryTsKey, labels: [label]);
ts.Create(compactedTsKey, labels: [label, compactedLabel]);
ts.Create(primaryTsKey, labels: new[] { label });
ts.Create(compactedTsKey, labels: new[] { label, compactedLabel });
ts.CreateRule(primaryTsKey, compactionRule);
var tuples = CreateData(ts, 50, [primaryTsKey]);
var tuples = CreateData(ts, 50, new[] { primaryTsKey });

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

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