Skip to content
Closed
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
20 changes: 16 additions & 4 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ name: 'Run NRedisStack tests'
description: 'Runs NRedisStack tests against different Redis versions and configurations'
inputs:
dotnet-version:
description: 'SDK version'
description: 'Target .NET version to build and run the tests against, i.e. "8.0" for net8.0'
default: '10.0'
required: false
dotnet-quality:
description: 'SDK quality'
default: 'ga'
required: false
build-sdk-version:
description: >
SDK version used to drive restore/build/pack, independent of the target
version above. Solution discovery of the .slnx needs an SDK >= 9.0.200,
so this must stay ahead of the oldest targeted version. Bump this when
the matrix starts targeting something newer than the SDK can build.
default: '10.0'
required: false
redis-version:
description: 'Redis version to test against (MAJOR.MINOR format, e.g., "7.4", "8.0")'
required: false
Expand Down Expand Up @@ -51,10 +59,13 @@ runs:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}

# We always build with build-sdk-version, but the target version is installed
# too so its runtime is present for `dotnet test -f <target>`.
- name: Install .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
${{inputs.build-sdk-version}}
${{inputs.dotnet-version}}
dotnet-quality: '${{inputs.dotnet-quality}}'

Expand Down Expand Up @@ -99,15 +110,16 @@ runs:
echo "::endgroup::"
shell: bash

# Make sure only the desired dotnet version is set both as target and as active SDK.
# Narrow every project to the single target framework under test, and pin the
# active SDK to the build SDK (not the target version - the two are decoupled).
- name: Tweak target frameworks
env:
INPUT_DOTNET_VERSION: ${{ inputs.dotnet-version }}
INPUT_BUILD_SDK_VERSION: ${{ inputs.build-sdk-version }}
shell: bash
run: |
find . -name '*.csproj' | xargs -I {} sed -E -i "s|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${CLR_VERSION}</TargetFramework>|" {}
find . -name '*.csproj' | xargs cat
jq -n --arg version "$INPUT_DOTNET_VERSION" '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
jq -n --arg version "$INPUT_BUILD_SDK_VERSION" '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Write a full SDK version to global.json

When the action uses the new default build-sdk-version: 10.0 (or any caller passes a channel-style value that setup-dotnet accepts), this writes that value directly as sdk.version in global.json. The .NET global.json schema requires the full SDK version and explicitly does not support values like 10 or 10.0 (https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#version), so the pin added for .slnx discovery is invalid and subsequent dotnet restore/build/pack can fall back to whatever SDK the runner happens to have installed instead of the intended build SDK. Use a full feature-band version or the resolved setup-dotnet output here.

Useful? React with 👍 / 👎.

- name: Check .NET version
shell: bash
run: dotnet --version
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ jobs:
ENDPOINT: ${{ secrets.ENDPOINT }}
steps:
- uses: actions/checkout@v6
# Pinned explicitly rather than relying on whatever the runner image
# ships: discovering the .slnx solution needs an SDK >= 9.0.200.
- name: Set up .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10
- uses: Vampire/setup-wsl@v6
with:
distribution: Ubuntu-22.04
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ jobs:
dotnet-format:
runs-on: windows-latest
steps:
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format

- name: Checkout repo
uses: actions/checkout@v6

# The SDK's built-in `dotnet format` is used rather than the legacy
# standalone dotnet-format tool, which cannot discover a .slnx solution.
- name: Set up .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10

- name: lint
run: |
dotnet format
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nuget-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up .NET 9
- name: Set up .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9
dotnet-version: 10
- name: Check .NET version
run: dotnet --version
- name: Check .NET SDKs
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info",
"dotnet-test-explorer.testProjectPath": "**/*NRedisStack.Tests.csproj",
"dotnet.defaultSolution": "NRedisStack.sln",
"dotnet.defaultSolution": "NRedisStack.slnx",
"dotnet.unitTests.runSettingsPath": ".vscode/.runsettings"
}
66 changes: 0 additions & 66 deletions NRedisStack.sln

This file was deleted.

16 changes: 16 additions & 0 deletions NRedisStack.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Solution>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update reusable workflow for .slnx

When this repo is built through the existing .github/workflows/reusable.yml workflow_call with its documented 6/7/8 SDK inputs, the job still installs only SDKs 6, 7, and 8, writes that SDK into global.json, and then runs implicit dotnet restore. After replacing the .sln with only this .slnx, those SDKs cannot discover/build the solution because .NET CLI support for SLNX starts in SDK 9.0.200 (https://devblogs.microsoft.com/dotnet/introducing-slnx-support-dotnet-cli/), so that reusable workflow breaks even though the composite test action was updated; please either keep a legacy .sln or decouple the reusable workflow's build SDK the same way.

Useful? React with 👍 / 👎.

<Folder Name="/Build/">
<File Path=".github/actions/run-tests/action.yml" />
<File Path=".github/workflows/integration.yml" />
<File Path="Directory.Build.props" />
<File Path="Directory.Packages.props" />
<File Path="global.json" />
<File Path="version.json" />
<Project Path=".github/ci.csproj" />
<Project Path="tests/dockers/dockers.csproj" />
</Folder>
<Project Path="docs/docs.csproj" />
<Project Path="src/NRedisStack/NRedisStack.csproj" />
<Project Path="tests/Doc/Doc.csproj" />
<Project Path="tests/NRedisStack.Tests/NRedisStack.Tests.csproj" />
</Solution>
File renamed without changes.
Loading