Skip to content

Commit 899e722

Browse files
gdesmottItzikvaknin
authored andcommitted
ci: pin a Rust nightly version (#6513)
Should prevent accidental breaking of the CI.
1 parent 3ba1f6a commit 899e722

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

.install/test_deps/common_installations.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ activate_venv() {
2020
fi
2121
}
2222

23+
# retrieve nightly version from build.sh
24+
NIGHTLY_VERSION=$(grep "NIGHTLY_VERSION=" build.sh | cut -d'=' -f2 | tr -d '"')
2325
# --allow-downgrade:
2426
# Allow `rustup` to install an older `nightly` if the latest one
2527
# is missing one of the components we need.
@@ -29,7 +31,7 @@ activate_venv() {
2931
# Required to run `cargo miri test` for UB detection
3032
# rust-src:
3133
# Required to build RedisJSON with address sanitizer
32-
rustup toolchain install nightly \
34+
rustup toolchain install $NIGHTLY_VERSION \
3335
--allow-downgrade \
3436
--component llvm-tools-preview \
3537
--component miri \
@@ -40,7 +42,7 @@ cargo install cargo-llvm-cov --locked
4042
# Make sure `miri` is fully operational before running tests with it.
4143
# See https://github.com/rust-lang/miri/blob/master/README.md#running-miri-on-ci
4244
# for more details.
43-
cargo +nightly miri setup
45+
cargo +$NIGHTLY_VERSION miri setup
4446

4547
python3 -m venv venv
4648
activate_venv

build.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,21 @@ run_rust_tests() {
506506
# Set Rust test environment
507507
RUST_DIR="$ROOT/src/redisearch_rs"
508508

509+
# Set up RUSTFLAGS for warnings
510+
if [[ "$RUST_DENY_WARNS" == "1" ]]; then
511+
export RUSTFLAGS="${RUSTFLAGS:+${RUSTFLAGS} }-D warnings"
512+
fi
513+
514+
# Pin a specific working version of nightly to prevent breaking the CI because
515+
# regressions in a nightly build.
516+
# Make sure to synchronize updates across all modules: Redis and RedisJSON.
517+
NIGHTLY_VERSION="nightly-2025-07-30"
518+
509519
# Add Rust test extensions
510520
if [[ $COV == 1 ]]; then
511521
# We use the `nightly` compiler in order to include doc tests in the coverage computation.
512522
# See https://github.com/taiki-e/cargo-llvm-cov/issues/2 for more details.
513-
RUST_EXTENSIONS="+nightly llvm-cov"
523+
RUST_EXTENSIONS="+$NIGHTLY_VERSION llvm-cov"
514524
RUST_TEST_OPTIONS="
515525
--doctests
516526
--codecov
@@ -521,8 +531,8 @@ run_rust_tests() {
521531
--ignore-filename-regex="varint_bencher/*,trie_bencher/*,inverted_index_bencher/*"
522532
--output-path=$BINROOT/rust_cov.info
523533
"
524-
elif [[ -n "$SAN" ]]; then # using `elif` as we shouldn't run with both
525-
RUST_EXTENSIONS="+nightly miri"
534+
elif [[ -n "$SAN" || "$RUN_MIRI" == "1" ]]; then # using `elif` as we shouldn't run with both
535+
RUST_EXTENSIONS="+$NIGHTLY_VERSION miri"
526536
fi
527537

528538
# Run cargo test with the appropriate filter

tests/deps/setup_rejson.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ TEST_DEPS_DIR="${ROOT}/tests/deps"
2121
JSON_MODULE_DIR="${TEST_DEPS_DIR}/RedisJSON"
2222
JSON_BIN_DIR="${BINROOT}/RedisJSON/${JSON_BRANCH}"
2323
export JSON_BIN_PATH="${JSON_BIN_DIR}/rejson.so"
24+
# Instruct RedisJSON to use the same pinned nightly version as RediSearch
25+
export RUST_GOOD_NIGHTLY=$(grep "NIGHTLY_VERSION=" ${ROOT}/build.sh | cut -d'=' -f2 | tr -d '"')
2426

2527
# Check if REJSON_PATH is set externally
2628
if [ -n "$REJSON_PATH" ]; then

0 commit comments

Comments
 (0)