Skip to content

Commit c655f8c

Browse files
committed
Test against Valkey in CI.
This refactors the CI pipeline to not use a cartesian product of Rust & DB version, and instead of test all Rust versions against a single DB version, and all DB versions against stable Rust, since the two are orthogonal. This allows us to add more DB types and versions and only add 1 CI action per version.
1 parent c54a463 commit c655f8c

File tree

1 file changed

+57
-19
lines changed

1 file changed

+57
-19
lines changed

.github/workflows/rust.yml

+57-19
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,59 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
redis:
22-
- 6.2.13
23-
- 7.2.0
24-
rust:
25-
- stable
26-
- beta
27-
- nightly
28-
- 1.65.0
21+
config:
22+
[
23+
# Different DB cases:
24+
{
25+
rust: stable,
26+
db-org: redis,
27+
db-name: redis,
28+
db-version: 6.2.13
29+
},
30+
{
31+
rust: stable,
32+
db-org: redis,
33+
db-name: redis,
34+
db-version: 7.2.4
35+
},
36+
{
37+
rust: stable,
38+
db-org: valkey-io,
39+
db-name: valkey,
40+
db-version: 7.2.6
41+
},
42+
43+
# Different rust cases
44+
{
45+
rust: beta,
46+
db-org: redis,
47+
db-name: redis,
48+
db-version: 7.2.4
49+
},
50+
{
51+
rust: nightly,
52+
db-org: redis,
53+
db-name: redis,
54+
db-version: 7.2.4
55+
},
56+
{
57+
rust: 1.65.0,
58+
db-org: redis,
59+
db-name: redis,
60+
db-version: 7.2.4
61+
}
62+
]
2963

3064
steps:
3165

32-
- name: Cache redis
66+
- name: Cache DB
3367
id: cache-redis
3468
uses: actions/cache@v4
3569
with:
3670
path: |
3771
~/redis-cli
3872
~/redis-server
39-
key: ${{ runner.os }}-${{ matrix.redis }}-redis
73+
key: ${{ runner.os }}-${{ matrix.config.db-name }}-${{ matrix.config.db-version }}
4074

4175
- name: Cache RedisJSON
4276
id: cache-redisjson
@@ -46,13 +80,17 @@ jobs:
4680
/tmp/librejson.so
4781
key: ${{ runner.os }}-redisjson
4882

49-
- name: Install redis
83+
- name: Install DB
5084
if: steps.cache-redis.outputs.cache-hit != 'true'
5185
run: |
5286
sudo apt-get update
53-
wget https://github.com/redis/redis/archive/${{ matrix.redis }}.tar.gz;
54-
tar -xzvf ${{ matrix.redis }}.tar.gz;
55-
pushd redis-${{ matrix.redis }} && BUILD_TLS=yes make && sudo mv src/redis-server src/redis-cli $HOME && popd;
87+
wget https://github.com/${{ matrix.config.db-org }}/${{ matrix.config.db-name }}/archive/${{ matrix.config.db-version }}.tar.gz;
88+
tar -xzvf ${{ matrix.config.db-version }}.tar.gz;
89+
pushd ${{ matrix.config.db-name }}-${{ matrix.config.db-version }} &&
90+
BUILD_TLS=yes make install &&
91+
sudo mv src/${{ matrix.config.db-name }}-server $HOME/redis-server &&
92+
sudo mv src/${{ matrix.config.db-name }}-cli $HOME/redis-cli &&
93+
popd;
5694
echo $PATH
5795
5896
- name: set PATH
@@ -62,7 +100,7 @@ jobs:
62100
- name: Install Rust
63101
uses: dtolnay/rust-toolchain/@master
64102
with:
65-
toolchain: ${{ matrix.rust }}
103+
toolchain: ${{ matrix.config.rust }}
66104
components: rustfmt
67105

68106
- uses: Swatinem/rust-cache@v2
@@ -73,7 +111,7 @@ jobs:
73111
run: make test
74112

75113
- name: Checkout RedisJSON
76-
if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.redis != '6.2.13'
114+
if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.config.db-version != '6.2.13'
77115
uses: actions/checkout@v4
78116
with:
79117
repository: "RedisJSON/RedisJSON"
@@ -94,7 +132,7 @@ jobs:
94132
# This shouldn't cause issues in the future so long as no profiles or patches
95133
# are applied to the workspace Cargo.toml file
96134
- name: Compile RedisJSON
97-
if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.redis != '6.2.13'
135+
if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.config.db-version != '6.2.13'
98136
run: |
99137
cp ./Cargo.toml ./Cargo.toml.actual
100138
echo $'\nexclude = [\"./__ci/redis-json\"]' >> Cargo.toml
@@ -104,10 +142,10 @@ jobs:
104142
rm -rf ./__ci/redis-json
105143
106144
- name: Run module-specific tests
107-
if: matrix.redis != '6.2.13'
145+
if: matrix.config.db-version != '6.2.13'
108146
run: make test-module
109147
env:
110-
REDIS_VERSION: ${{ matrix.redis }}
148+
REDIS_VERSION: ${{ matrix.config.db-version }}
111149

112150
- name: Check features
113151
run: |

0 commit comments

Comments
 (0)