Skip to content

Commit 3a71880

Browse files
authored
Merge branch 'master' into patch-1
2 parents 9582400 + a402c55 commit 3a71880

File tree

122 files changed

+19292
-3042
lines changed

Some content is hidden

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

122 files changed

+19292
-3042
lines changed

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Run go-redis tests'
2+
description: 'Runs go-redis tests against different Redis versions and configurations'
3+
inputs:
4+
go-version:
5+
description: 'Go version to use for running tests'
6+
default: '1.23'
7+
redis-version:
8+
description: 'Redis version to test against'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up ${{ inputs.go-version }}
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: ${{ inputs.go-version }}
17+
18+
- name: Setup Test environment
19+
env:
20+
REDIS_VERSION: ${{ inputs.redis-version }}
21+
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}"
22+
run: |
23+
set -e
24+
redis_version_np=$(echo "$REDIS_VERSION" | grep -oP '^\d+.\d+')
25+
26+
# Mapping of redis version to redis testing containers
27+
declare -A redis_version_mapping=(
28+
["8.0-M05"]="8.0-M05-pre"
29+
["7.4.2"]="rs-7.4.0-v2"
30+
["7.2.7"]="rs-7.2.0-v14"
31+
)
32+
33+
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
34+
echo "REDIS_VERSION=${redis_version_np}" >> $GITHUB_ENV
35+
echo "REDIS_IMAGE=redis:${{ inputs.redis-version }}" >> $GITHUB_ENV
36+
echo "CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:${redis_version_mapping[$REDIS_VERSION]}" >> $GITHUB_ENV
37+
else
38+
echo "Version not found in the mapping."
39+
exit 1
40+
fi
41+
sleep 10 # wait for redis to start
42+
shell: bash
43+
- name: Set up Docker Compose environment with redis ${{ inputs.redis-version }}
44+
run: |
45+
make docker.start
46+
shell: bash
47+
- name: Run tests
48+
env:
49+
RCE_DOCKER: "true"
50+
RE_CLUSTER: "false"
51+
run: |
52+
make test.ci
53+
shell: bash

.github/wordlist.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ACLs
2+
APIs
23
autoload
34
autoloader
45
autoloading
@@ -46,15 +47,21 @@ runtime
4647
SHA
4748
sharding
4849
SETNAME
50+
SpellCheck
4951
SSL
5052
struct
5153
stunnel
54+
SynDump
5255
TCP
5356
TLS
57+
UnstableResp
5458
uri
5559
URI
5660
url
5761
variadic
5862
RedisStack
5963
RedisGears
60-
RedisTimeseries
64+
RedisTimeseries
65+
RediSearch
66+
RawResult
67+
RawVal

.github/workflows/build.yml

Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ name: Go
22

33
on:
44
push:
5-
branches: [master, v9]
5+
branches: [master, v9, v9.7]
66
pull_request:
7-
branches: [master, v9]
7+
branches: [master, v9, v9.7]
88

99
permissions:
1010
contents: read
1111

1212
jobs:
13-
build:
14-
name: build
13+
14+
benchmark:
15+
name: benchmark
1516
runs-on: ubuntu-latest
1617
strategy:
1718
fail-fast: false
1819
matrix:
19-
go-version: [1.19.x, 1.20.x, 1.21.x]
20-
21-
services:
22-
redis:
23-
image: redis/redis-stack-server:edge
24-
options: >-
25-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
26-
ports:
27-
- 6379:6379
20+
redis-version:
21+
- "8.0-M05" # 8.0 milestone 5
22+
- "7.4.2" # should use redis stack 7.4
23+
go-version:
24+
- "1.23.x"
25+
- "1.24.x"
2826

2927
steps:
3028
- name: Set up ${{ matrix.go-version }}
@@ -35,5 +33,65 @@ jobs:
3533
- name: Checkout code
3634
uses: actions/checkout@v4
3735

38-
- name: Test
39-
run: make test
36+
- name: Setup Test environment
37+
env:
38+
REDIS_VERSION: ${{ matrix.redis-version }}
39+
CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ matrix.redis-version }}"
40+
run: |
41+
set -e
42+
redis_version_np=$(echo "$REDIS_VERSION" | grep -oP '^\d+.\d+')
43+
44+
# Mapping of redis version to redis testing containers
45+
declare -A redis_version_mapping=(
46+
["8.0-M05"]="8.0-M05-pre"
47+
["7.4.2"]="rs-7.4.0-v2"
48+
)
49+
if [[ -v redis_version_mapping[$REDIS_VERSION] ]]; then
50+
echo "REDIS_VERSION=${redis_version_np}" >> $GITHUB_ENV
51+
echo "REDIS_IMAGE=redis:${{ matrix.redis-version }}" >> $GITHUB_ENV
52+
echo "CLIENT_LIBS_TEST_IMAGE=redislabs/client-libs-test:${redis_version_mapping[$REDIS_VERSION]}" >> $GITHUB_ENV
53+
else
54+
echo "Version not found in the mapping."
55+
exit 1
56+
fi
57+
shell: bash
58+
- name: Set up Docker Compose environment with redis ${{ matrix.redis-version }}
59+
run: make docker.start
60+
shell: bash
61+
- name: Benchmark Tests
62+
env:
63+
RCE_DOCKER: "true"
64+
RE_CLUSTER: "false"
65+
run: make bench
66+
shell: bash
67+
68+
test-redis-ce:
69+
name: test-redis-ce
70+
runs-on: ubuntu-latest
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
redis-version:
75+
- "8.0-M05" # 8.0 milestone 5
76+
- "7.4.2" # should use redis stack 7.4
77+
- "7.2.7" # should redis stack 7.2
78+
go-version:
79+
- "1.23.x"
80+
- "1.24.x"
81+
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
- name: Run tests
87+
uses: ./.github/actions/run-tests
88+
with:
89+
go-version: ${{matrix.go-version}}
90+
redis-version: ${{ matrix.redis-version }}
91+
92+
- name: Upload to Codecov
93+
uses: codecov/codecov-action@v5
94+
with:
95+
files: coverage.txt
96+
token: ${{ secrets.CODECOV_TOKEN }}
97+

.github/workflows/codeql-analysis.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
21+
jobs:
22+
analyze:
23+
name: Analyze
24+
runs-on: ubuntu-latest
25+
permissions:
26+
actions: read
27+
contents: read
28+
security-events: write
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
language: [ 'go' ]
34+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
35+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
# Initializes the CodeQL tools for scanning.
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v3
44+
with:
45+
languages: ${{ matrix.language }}
46+
# If you wish to specify custom queries, you can do so here or in a config file.
47+
# By default, queries listed here will override any specified in a config file.
48+
# Prefix the list here with "+" to use these queries and those in the config file.
49+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50+
51+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52+
# If this step fails, then you should remove it and run the build manually (see below)
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@v3
55+
56+
# ℹ️ Command-line programs to run using the OS shell.
57+
# 📚 https://git.io/JvXDl
58+
59+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60+
# and modify them (or add more) to build your code if your project
61+
# uses a compiled language
62+
63+
#- run: |
64+
# make bootstrap
65+
# make release
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v3

.github/workflows/doctests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
go-version: [ "1.18", "1.19", "1.20", "1.21" ]
28+
go-version: ["1.24"]
2929

3030
steps:
3131
- name: Set up ${{ matrix.go-version }}
@@ -38,4 +38,4 @@ jobs:
3838

3939
- name: Test doc examples
4040
working-directory: ./doctests
41-
run: go test
41+
run: go test -v

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ on:
1212

1313
permissions:
1414
contents: read
15+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1516

1617
jobs:
1718
golangci:
18-
permissions:
19-
contents: read # for actions/checkout to fetch code
20-
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
2119
name: lint
2220
runs-on: ubuntu-latest
2321
steps:
2422
- uses: actions/checkout@v4
2523
- name: golangci-lint
26-
uses: golangci/golangci-lint-action@v4
24+
uses: golangci/golangci-lint-action@v6.5.1

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Checkout
99
uses: actions/checkout@v4
1010
- name: Check Spelling
11-
uses: rojopolis/spellcheck-github-actions@0.36.0
11+
uses: rojopolis/spellcheck-github-actions@0.47.0
1212
with:
1313
config_path: .github/spellcheck-settings.yml
1414
task_name: Markdown

.github/workflows/test-redis-enterprise.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.24.x]
1919
re-build: ["7.4.2-54"]
2020

2121
steps:
@@ -46,7 +46,8 @@ jobs:
4646

4747
- name: Test
4848
env:
49-
RE_CLUSTER: "1"
49+
RE_CLUSTER: true
50+
REDIS_VERSION: "7.4"
5051
run: |
5152
go test \
5253
--ginkgo.skip-file="ring_test.go" \

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ testdata/*
33
.idea/
44
.DS_Store
55
*.tar.gz
6-
*.dic
6+
*.dic
7+
redis8tests.sh
8+
coverage.txt
9+
**/coverage.txt
10+
.vscode

.golangci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
run:
2-
concurrency: 8
3-
deadline: 5m
2+
timeout: 5m
43
tests: false

CONTRIBUTING.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,33 @@ Here's how to get started with your code contribution:
3232

3333
1. Create your own fork of go-redis
3434
2. Do the changes in your fork
35-
3. If you need a development environment, run `make test`. Note: this clones and builds the latest release of [redis](https://redis.io). You also need a redis-stack-server docker, in order to run the capabilities tests. This can be started by running:
36-
```docker run -p 6379:6379 -it redis/redis-stack-server:edge```
37-
4. While developing, make sure the tests pass by running `make tests`
35+
3. If you need a development environment, run `make docker.start`.
36+
37+
> Note: this clones and builds the docker containers specified in `docker-compose.yml`, to understand more about
38+
> the infrastructure that will be started you can check the `docker-compose.yml`. You also have the possiblity
39+
> to specify the redis image that will be pulled with the env variable `CLIENT_LIBS_TEST_IMAGE`.
40+
> By default the docker image that will be pulled and started is `redislabs/client-libs-test:rs-7.4.0-v2`.
41+
> If you want to test with newer Redis version, using a newer version of `redislabs/client-libs-test` should work out of the box.
42+
43+
4. While developing, make sure the tests pass by running `make test` (if you have the docker containers running, `make test.ci` may be sufficient).
44+
> Note: `make test` will try to start all containers, run the tests with `make test.ci` and then stop all containers.
3845
5. If you like the change and think the project could use it, send a
3946
pull request
4047

4148
To see what else is part of the automation, run `invoke -l`
4249

50+
4351
## Testing
4452

45-
Call `make test` to run all tests, including linters.
53+
### Setting up Docker
54+
To run the tests, you need to have Docker installed and running. If you are using a host OS that does not support
55+
docker host networks out of the box (e.g. Windows, OSX), you need to set up a docker desktop and enable docker host networks.
56+
57+
### Running tests
58+
Call `make test` to run all tests.
4659

4760
Continuous Integration uses these same wrappers to run all of these
48-
tests against multiple versions of python. Feel free to test your
61+
tests against multiple versions of redis. Feel free to test your
4962
changes against all the go versions supported, as declared by the
5063
[build.yml](./.github/workflows/build.yml) file.
5164

0 commit comments

Comments
 (0)