From c655f8c2aa9eab9109900b4f056186f257c3aff5 Mon Sep 17 00:00:00 2001 From: Shachar Langbeheim Date: Fri, 6 Sep 2024 16:46:09 +0300 Subject: [PATCH 1/3] 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. --- .github/workflows/rust.yml | 76 ++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e5c1c6cb1..dc2d3acd8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,25 +18,59 @@ jobs: strategy: fail-fast: false matrix: - redis: - - 6.2.13 - - 7.2.0 - rust: - - stable - - beta - - nightly - - 1.65.0 + config: + [ + # Different DB cases: + { + rust: stable, + db-org: redis, + db-name: redis, + db-version: 6.2.13 + }, + { + rust: stable, + db-org: redis, + db-name: redis, + db-version: 7.2.4 + }, + { + rust: stable, + db-org: valkey-io, + db-name: valkey, + db-version: 7.2.6 + }, + + # Different rust cases + { + rust: beta, + db-org: redis, + db-name: redis, + db-version: 7.2.4 + }, + { + rust: nightly, + db-org: redis, + db-name: redis, + db-version: 7.2.4 + }, + { + rust: 1.65.0, + db-org: redis, + db-name: redis, + db-version: 7.2.4 + } + ] steps: - - name: Cache redis + - name: Cache DB id: cache-redis uses: actions/cache@v4 with: path: | ~/redis-cli ~/redis-server - key: ${{ runner.os }}-${{ matrix.redis }}-redis + key: ${{ runner.os }}-${{ matrix.config.db-name }}-${{ matrix.config.db-version }} - name: Cache RedisJSON id: cache-redisjson @@ -46,13 +80,17 @@ jobs: /tmp/librejson.so key: ${{ runner.os }}-redisjson - - name: Install redis + - name: Install DB if: steps.cache-redis.outputs.cache-hit != 'true' run: | sudo apt-get update - wget https://github.com/redis/redis/archive/${{ matrix.redis }}.tar.gz; - tar -xzvf ${{ matrix.redis }}.tar.gz; - pushd redis-${{ matrix.redis }} && BUILD_TLS=yes make && sudo mv src/redis-server src/redis-cli $HOME && popd; + wget https://github.com/${{ matrix.config.db-org }}/${{ matrix.config.db-name }}/archive/${{ matrix.config.db-version }}.tar.gz; + tar -xzvf ${{ matrix.config.db-version }}.tar.gz; + pushd ${{ matrix.config.db-name }}-${{ matrix.config.db-version }} && + BUILD_TLS=yes make install && + sudo mv src/${{ matrix.config.db-name }}-server $HOME/redis-server && + sudo mv src/${{ matrix.config.db-name }}-cli $HOME/redis-cli && + popd; echo $PATH - name: set PATH @@ -62,7 +100,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain/@master with: - toolchain: ${{ matrix.rust }} + toolchain: ${{ matrix.config.rust }} components: rustfmt - uses: Swatinem/rust-cache@v2 @@ -73,7 +111,7 @@ jobs: run: make test - name: Checkout RedisJSON - if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.redis != '6.2.13' + if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.config.db-version != '6.2.13' uses: actions/checkout@v4 with: repository: "RedisJSON/RedisJSON" @@ -94,7 +132,7 @@ jobs: # This shouldn't cause issues in the future so long as no profiles or patches # are applied to the workspace Cargo.toml file - name: Compile RedisJSON - if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.redis != '6.2.13' + if: steps.cache-redisjson.outputs.cache-hit != 'true' && matrix.config.db-version != '6.2.13' run: | cp ./Cargo.toml ./Cargo.toml.actual echo $'\nexclude = [\"./__ci/redis-json\"]' >> Cargo.toml @@ -104,10 +142,10 @@ jobs: rm -rf ./__ci/redis-json - name: Run module-specific tests - if: matrix.redis != '6.2.13' + if: matrix.config.db-version != '6.2.13' run: make test-module env: - REDIS_VERSION: ${{ matrix.redis }} + REDIS_VERSION: ${{ matrix.config.db-version }} - name: Check features run: | From 7ff59798e1dc663551a08ceb46b08a38b3540238 Mon Sep 17 00:00:00 2001 From: Shachar Langbeheim Date: Thu, 12 Sep 2024 13:32:29 +0300 Subject: [PATCH 2/3] change default to valkey 7.2.4 --- .github/workflows/rust.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dc2d3acd8..b02450c80 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,26 +37,26 @@ jobs: rust: stable, db-org: valkey-io, db-name: valkey, - db-version: 7.2.6 + db-version: 7.2.4 }, # Different rust cases { rust: beta, - db-org: redis, - db-name: redis, + db-org: valkey-io, + db-name: valkey, db-version: 7.2.4 }, { rust: nightly, - db-org: redis, - db-name: redis, + db-org: valkey-io, + db-name: valkey, db-version: 7.2.4 }, { rust: 1.65.0, - db-org: redis, - db-name: redis, + db-org: valkey-io, + db-name: valkey, db-version: 7.2.4 } ] From 889012a56644ed82f80903f7c33dada5fadcb598 Mon Sep 17 00:00:00 2001 From: Shachar Langbeheim Date: Thu, 12 Sep 2024 20:17:51 +0300 Subject: [PATCH 3/3] update valkey version. --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b02450c80..9dea6bd78 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,7 +37,7 @@ jobs: rust: stable, db-org: valkey-io, db-name: valkey, - db-version: 7.2.4 + db-version: 7.2.6 }, # Different rust cases @@ -45,19 +45,19 @@ jobs: rust: beta, db-org: valkey-io, db-name: valkey, - db-version: 7.2.4 + db-version: 7.2.6 }, { rust: nightly, db-org: valkey-io, db-name: valkey, - db-version: 7.2.4 + db-version: 7.2.6 }, { rust: 1.65.0, db-org: valkey-io, db-name: valkey, - db-version: 7.2.4 + db-version: 7.2.6 } ]