Skip to content

Commit 7b10f64

Browse files
authored
Merge branch 'master' into DOC-4733-geo-index-examples
2 parents 946f4d1 + 54d894a commit 7b10f64

File tree

100 files changed

+2950
-2880
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2950
-2880
lines changed

.github/actions/run-tests/action.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: 'Run NRedisStack tests'
2+
description: 'Runs NRedisStack tests against different Redis versions and configurations'
3+
inputs:
4+
dotnet-version:
5+
description: 'SDK version'
6+
required: true
7+
redis-version:
8+
description: 'Redis version to test against'
9+
required: true
10+
verify-nuget-package:
11+
description: 'Verify Nuget package'
12+
required: false
13+
default: 'false'
14+
REDIS_CA_PEM:
15+
description: 'Redis CA PEM'
16+
required: true
17+
REDIS_USER_CRT:
18+
description: 'Redis User CRT'
19+
required: true
20+
REDIS_USER_PRIVATE_KEY:
21+
description: 'Redis User Private Key'
22+
required: true
23+
runs:
24+
using: "composite"
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install .NET Core
29+
uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: ${{inputs.dotnet-version}}
32+
dotnet-quality: 'ga'
33+
34+
- name: Setup Environment variables and run Redis
35+
env:
36+
REDIS_VERSION: ${{ inputs.redis-version }}
37+
REDIS_IMAGE: "redis:${{ inputs.redis-version }}"
38+
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
39+
run: |
40+
set -e
41+
42+
echo "::group::Setup Environment variables and run Redis"
43+
dotnet_major_minor_version=$(echo "${{ inputs.dotnet-version }}" | grep -oP '^\d+\.\d+')
44+
echo "CLR_VERSION=net${dotnet_major_minor_version}" >> $GITHUB_ENV
45+
46+
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
47+
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
48+
49+
if (( redis_major_version < 8 )); then
50+
echo "Using redis-stack for module tests"
51+
52+
# Mapping of redis version to stack version
53+
declare -A redis_stack_version_mapping=(
54+
["7.4.1"]="rs-7.4.0-v1"
55+
["7.2.6"]="rs-7.2.0-v13"
56+
["6.2.16"]="rs-6.2.6-v17"
57+
)
58+
59+
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
60+
export CLIENT_LIBS_TEST_IMAGE="redislabs/client-libs-test:${redis_stack_version_mapping[$REDIS_VERSION]}"
61+
else
62+
echo "Version not found in the mapping."
63+
exit 1
64+
fi
65+
66+
if (( redis_major_version < 7 )); then
67+
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
68+
fi
69+
70+
docker compose --profile all -f tests/dockers/docker-compose.yml up -d --build
71+
else
72+
echo "Using redis CE for module tests"
73+
export CLIENT_LIBS_TEST_IMAGE="redislabs/client-libs-test:$REDIS_VERSION"
74+
docker compose --profile all -f tests/dockers/docker-compose.yml up -d --build
75+
fi
76+
echo "::endgroup::"
77+
shell: bash
78+
79+
# Make sure only the desired dotnet version is set both as target and as active SDK.
80+
- name: Tweak target frameworks
81+
shell: bash
82+
run: |
83+
find . -name '*.csproj' | xargs -I {} sed -E -i "s|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${CLR_VERSION}</TargetFramework>|" {}
84+
find . -name '*.csproj' | xargs cat
85+
jq -n --arg version ${{inputs.dotnet-version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
86+
- name: Check .NET version
87+
shell: bash
88+
run: dotnet --version
89+
- name: Check .NET SDKs
90+
shell: bash
91+
run: dotnet --list-sdks
92+
- name: Check .NET runtimes
93+
shell: bash
94+
run: dotnet --list-runtimes
95+
- name: Restore dependencies
96+
shell: bash
97+
run: dotnet restore
98+
99+
- name: Build
100+
shell: bash
101+
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
102+
103+
- name: Test
104+
shell: bash
105+
env:
106+
REDIS_VERSION: ${{ inputs.redis-version }}
107+
run: |
108+
echo "::group::Run tests"
109+
echo "${{inputs.REDIS_CA_PEM}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_ca.pem
110+
echo "${{inputs.REDIS_USER_CRT}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_user.crt
111+
echo "${{inputs.REDIS_USER_PRIVATE_KEY}}" > tests/NRedisStack.Tests/bin/Debug/${CLR_VERSION}/redis_user_private.key
112+
REDIS_VERSION=$(echo "$REDIS_VERSION" | cut -d'-' -f1)
113+
echo $REDIS_VERSION
114+
dotnet test -f ${CLR_VERSION} --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover -p:BuildInParallel=false tests/Test.proj --logger GitHubActions
115+
echo "::endgroup::"
116+
- name: Codecov
117+
uses: codecov/codecov-action@v4
118+
with:
119+
verbose: true
120+
- name: Build
121+
shell: bash
122+
run: dotnet pack -c Release
123+
124+
- name: Test against Nuget package from local source
125+
if: inputs.verify-nuget-package == 'true'
126+
working-directory: PackageVerification
127+
shell: bash
128+
run: |
129+
echo "::group::Test against Nuget package from local source"
130+
mkdir -p test-source
131+
dotnet nuget add source $(readlink -f test-source) -n test-source
132+
find .. -name '*.nupkg' | xargs -I {} dotnet nuget push {} -s test-source
133+
ls -R
134+
dotnet nuget remove source nuget.org
135+
dotnet nuget list source
136+
find . -name '*.csproj' | xargs -I {} sed -E -i 's|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${CLR_VERSION}</TargetFramework>|' {}
137+
dotnet restore -s test-source -v detailed
138+
dotnet run
139+
echo "::endgroup::"
140+

.github/docker-compose.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/dockers/Dockerfile.cluster

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/dockers/cluster.redis.conf

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/dockers/create_cluster.sh

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)