Skip to content

Commit b179039

Browse files
authored
ci(test): add redis matrix and update docker compose file (#2034)
1 parent 44c2df6 commit b179039

File tree

4 files changed

+46
-31
lines changed

4 files changed

+46
-31
lines changed

.github/workflows/test_with_cov.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
node: [12.x, 14.x, 16.x, 18.x, 20.x]
10+
node: [20.x, 22.x, 24.x]
11+
redis: ["rs-7.4.0-v1", "8.0.2", "8.2"]
1112
steps:
1213
- name: Git checkout
1314
uses: actions/checkout@v2
@@ -17,12 +18,9 @@ jobs:
1718
with:
1819
node-version: ${{ matrix.node }}
1920

20-
- name: Start Redis
21-
uses: supercharge/[email protected]
22-
with:
23-
redis-version: latest
24-
25-
- run: npm run cluster:setup
21+
- run: npm run docker:setup
22+
env:
23+
REDIS_VERSION: ${{ matrix.redis }}
2624

2725
- run: npm install
2826
- run: npm run lint
@@ -31,7 +29,7 @@ jobs:
3129
- run: npm run test:cov || npm run test:cov || npm run test:cov
3230
- run: npm run test:cluster
3331
- name: Coveralls
34-
if: matrix.node == '18.x'
32+
if: matrix.node == '24.x'
3533
uses: coverallsapp/github-action@master
3634
with:
3735
github-token: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"built/"
99
],
1010
"scripts": {
11-
"cluster:setup": "docker compose -f test/cluster/docker-compose.cluster.yml up -d --wait",
12-
"cluster:teardown": "docker compose -f test/cluster/docker-compose.cluster.yml down --volumes --remove-orphans",
11+
"docker:setup": "docker compose -f test/docker-compose.yml up -d --wait",
12+
"docker:teardown": "docker compose -f test/docker-compose.yml down --volumes --remove-orphans",
1313
"test:tsd": "npm run build && tsd",
14-
"test:js": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test/helpers/*.ts\" \"test/unit/**/*.ts\" \"test/functional/**/*.ts\"",
14+
"test:js": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha --no-experimental-strip-types \"test/helpers/*.ts\" \"test/unit/**/*.ts\" \"test/functional/**/*.ts\"",
1515
"test:cov": "nyc npm run test:js",
16-
"test:cluster": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha \"test/cluster/**/*.ts\"",
16+
"test:cluster": "TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test mocha --no-experimental-strip-types \"test/cluster/**/*.ts\"",
1717
"test": "npm run test:js && npm run test:tsd",
1818
"lint": "eslint --ext .js,.ts ./lib",
1919
"docs": "npx typedoc --logLevel Error --excludeExternals --excludeProtected --excludePrivate --readme none lib/index.ts",

test/cluster/docker-compose.cluster.yml

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

test/docker-compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
x-redis-common: &redis-common
2+
image: redislabs/client-libs-test:${REDIS_VERSION:-8.4-M01-pre}
3+
4+
services:
5+
single:
6+
<<: *redis-common
7+
ports:
8+
- 6379:3000
9+
healthcheck:
10+
test: ["CMD", "redis-cli", "-p", "3000", "ping"]
11+
interval: 1s
12+
timeout: 10s
13+
retries: 5
14+
15+
cluster:
16+
<<: *redis-common
17+
environment:
18+
REDIS_CLUSTER: "yes"
19+
NODES: "6"
20+
REPLICAS: "1"
21+
ports:
22+
- 3000:3000
23+
- 3001:3001
24+
- 3002:3002
25+
- 3003:3003
26+
- 3004:3004
27+
- 3005:3005
28+
healthcheck:
29+
test:
30+
[
31+
"CMD-SHELL",
32+
"redis-cli -p 3000 cluster info | grep -q 'cluster_state:ok'",
33+
]
34+
interval: 1s
35+
timeout: 10s
36+
retries: 5

0 commit comments

Comments
 (0)