Skip to content

Commit fc01783

Browse files
committed
Merge branch 'master' into modules-config
2 parents 5f747a2 + 3e537f9 commit fc01783

File tree

182 files changed

+4672
-1023
lines changed

Some content is hidden

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

182 files changed

+4672
-1023
lines changed

.github/CONTRIBUTING.md

+47
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,53 @@ Jedis unit tests use many Redis instances, so we use a ```Makefile``` to prepare
2525
Start unit tests with ```make test```.
2626
Set up test environments with ```make start```, tear down those environments with ```make stop``` and clean up the environment files with ```make cleanup```.
2727

28+
29+
# Jedis Test Environment Using Docker
30+
31+
This guide explains how to bootstrap and manage a test environment for Jedis using Docker Compose.
32+
33+
## Workflow Steps
34+
1. **Start the test environment** by running the following command (examples below).
35+
- For instance, to start the environment with Redis 8.0-M02, use `make start-test-env`.
36+
2. **Run tests** through your IDE, Maven, or other testing tools as needed.
37+
3. **Stop the test environment** by running the following command:
38+
- `make stop-test-env`
39+
- This will stop and tear down the Docker containers running the Redis service
40+
41+
# Start the Test Environment Using Docker
42+
43+
You can bootstrap the test environment for supported versions of Redis using the provided `make` targets.
44+
45+
## Option 1: Using `make` Targets
46+
To bring up the test environment for a specific Redis version (8.0-M02, 7.4.1, 7.2.6, or 6.2.16), use the following command:
47+
```bash
48+
make start-test-env version=8.0-M02 # Replace with desired version
49+
```
50+
To stop test environment:
51+
```bash
52+
make stop-test-env
53+
```
54+
To run tests using dockerized environment:
55+
```bash
56+
make test-on-docker
57+
```
58+
59+
## Option 2: Using docker compose commands directly
60+
Docker compose file can be found in `src/test/resources/env` folder.
61+
- **Redis 8.0-M02**
62+
```bash
63+
rm -rf /tmp/redis-env-work
64+
export REDIS_VERSION=8.0-M02
65+
docker compose up
66+
```
67+
- **Redis 7.4.1, 7.2.6, 6.2.16,**
68+
```bash
69+
rm -rf /tmp/redis-env-work
70+
export REDIS_VERSION=6.2.16
71+
docker compose --env-file .env --env-file .env.v6.2.16 up
72+
```
73+
74+
2875
# Some rules of Jedis source code
2976

3077
## Code Convention

.github/workflows/docs.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
concurrency: ci-${{ github.ref }}
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-python@v4
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
1919
with:
20-
python-version: 3.9
20+
python-version: 3.13
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
@@ -33,4 +33,4 @@ jobs:
3333
path: 'docsbuild'
3434
- name: Deploy to GitHub Pages
3535
id: deployment
36-
uses: actions/deploy-pages@v2
36+
uses: actions/deploy-pages@v2

.github/workflows/integration.yml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
mvn javadoc:jar
5252
- name: Run tests
5353
run: |
54+
export TEST_ENV_PROVIDER=local
5455
make test
5556
env:
5657
JVM_OPTS: -Xmx3200m

.github/workflows/test-on-docker.yml

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
3+
name: Build and Test using containerized environment
4+
5+
on:
6+
push:
7+
paths-ignore:
8+
- 'docs/**'
9+
- '**/*.md'
10+
- '**/*.rst'
11+
branches:
12+
- master
13+
- '[0-9].*'
14+
pull_request:
15+
branches:
16+
- master
17+
- '[0-9].*'
18+
schedule:
19+
- cron: '0 1 * * *' # nightly build
20+
workflow_dispatch:
21+
inputs:
22+
specific_test:
23+
description: 'Run specific test(s) (optional)'
24+
required: false
25+
default: ''
26+
jobs:
27+
28+
build:
29+
name: Build and Test
30+
runs-on: ubuntu-latest
31+
env:
32+
REDIS_ENV_WORK_DIR: ${{ github.workspace }}/redis-env-work
33+
REDIS_ENV_CONF_DIR: ${{ github.workspace }}/src/test/resources/env
34+
CLIENT_LIBS_IMAGE_PREFIX: "redislabs/client-libs-test"
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
redis_version:
39+
- "8.0-M02"
40+
- "7.4.1"
41+
- "7.2.6"
42+
# - "6.2.16"
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up publishing to maven central
46+
uses: actions/setup-java@v4
47+
with:
48+
java-version: '8'
49+
distribution: 'temurin'
50+
- name: System setup
51+
run: |
52+
sudo apt update
53+
sudo apt install -y make
54+
make compile-module
55+
- name: Cache dependencies
56+
uses: actions/cache@v4
57+
with:
58+
path: |
59+
~/.m2/repository
60+
/var/cache/apt
61+
key: jedis-${{hashFiles('**/pom.xml')}}
62+
# Set up Docker Compose environment
63+
- name: Set up Docker Compose environment
64+
run: |
65+
mkdir -m 777 $REDIS_ENV_WORK_DIR
66+
export REDIS_VERSION="${{ matrix.redis_version }}"
67+
make start-test-env version=$REDIS_VERSION
68+
- name: Maven offline
69+
run: |
70+
mvn -q dependency:go-offline
71+
- name: Build docs
72+
run: |
73+
mvn javadoc:jar
74+
# Run Tests
75+
- name: Run Maven tests
76+
run: |
77+
export TEST_ENV_PROVIDER=docker
78+
export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR
79+
echo $TEST_WORK_FOLDER
80+
if [ -z "$TESTS" ]; then
81+
mvn clean compile test
82+
else
83+
mvn -Dtest=$TESTS clean compile test
84+
fi
85+
env:
86+
JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof"
87+
TESTS: ${{ github.event.inputs.specific_test || '' }}
88+
- name: Upload Heap Dumps
89+
if: failure()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: heap-dumps-${{ matrix.redis_version }}
93+
path: ${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof
94+
retention-days: 5
95+
- name: Upload Surefire Dump File
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: surefire-dumpstream
99+
path: target/surefire-reports/*.dumpstream
100+
- name: Publish Test Results
101+
uses: EnricoMi/publish-unit-test-result-action@v2
102+
if: always()
103+
with:
104+
files: |
105+
target/surefire-reports/**/*.xml
106+
# Collect logs on failure
107+
- name: Collect logs on failure
108+
if: failure() # This runs only if the previous steps failed
109+
run: |
110+
echo "Collecting logs from $WORK_DIR..."
111+
ls -la $REDIS_ENV_WORK_DIR
112+
# Upload logs as artifacts
113+
- name: Upload logs on failure
114+
if: failure()
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: redis-env-work-logs-${{ matrix.redis_version }}
118+
path: ${{ env.REDIS_ENV_WORK_DIR }}
119+
# Bring down the Docker Compose test environment
120+
- name: Tear down Docker Compose environment
121+
if: always()
122+
run: |
123+
docker compose $COMPOSE_ENV_FILES -f src/test/resources/env/docker-compose.yml down
124+
continue-on-error: true
125+
# Upload code coverage
126+
- name: Upload coverage to Codecov
127+
uses: codecov/codecov-action@v5
128+
with:
129+
fail_ci_if_error: false
130+
token: ${{ secrets.CODECOV_TOKEN }}
131+
- name: Upload test results to Codecov
132+
if: ${{ github.event_name == 'schedule' || (github.event_name == 'push') || github.event_name == 'workflow_dispatch'}}
133+
uses: codecov/test-results-action@v1
134+
with:
135+
fail_ci_if_error: false
136+
files: ./target/surefire-reports/TEST*
137+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ build/
1111
bin/
1212
tags
1313
.idea
14+
.run
1415
*.aof
1516
*.rdb
1617
redis-git
1718
appendonlydir/
19+
.DS_Store

0 commit comments

Comments
 (0)