@@ -50,31 +50,28 @@ jobs:
5050 uses : actions/checkout@v4
5151 - name : Check Rust versions are synchronized
5252 run : |
53- # Extract version from rust-toolchain.toml
54- TOOLCHAIN_VERSION=$(grep 'channel' rust-toolchain.toml | sed 's/.*"\(.*\)".*/\1/')
55- echo "rust-toolchain.toml version: $TOOLCHAIN_VERSION"
56-
57- # Check bdd/rust/Dockerfile
58- BDD_VERSION=$(grep '^FROM rust:' bdd/rust/Dockerfile | sed 's/FROM rust:\([0-9.]\+\).*/\1/')
59- echo "bdd/rust/Dockerfile version: $BDD_VERSION"
60-
61- # Check core/bench/dashboard/server/Dockerfile
62- BENCH_VERSION=$(grep '^FROM rust:' core/bench/dashboard/server/Dockerfile | sed 's/FROM rust:\([0-9.]\+\).*/\1/')
63- echo "core/bench/dashboard/server/Dockerfile version: $BENCH_VERSION"
64-
65- # Verify all versions match
66- if [ "$TOOLCHAIN_VERSION" != "$BDD_VERSION" ]; then
67- echo "ERROR: bdd/rust/Dockerfile uses Rust $BDD_VERSION but rust-toolchain.toml specifies $TOOLCHAIN_VERSION"
68- echo "Run ./scripts/sync-rust-version.sh to fix this"
53+ # rust-toolchain.toml -> 1.89(.0) -> 1.89
54+ TOOLCHAIN_VERSION=$(sed -En 's/^[[:space:]]*channel[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/p' rust-toolchain.toml)
55+ to_minor() { echo "$1" | sed -E 's/^([0-9]+)\.([0-9]+).*/\1.\2/'; }
56+ TOOLCHAIN_MINOR=$(to_minor "$TOOLCHAIN_VERSION")
57+
58+ # Extract X[.Y[.Z]] from Dockerfiles (ignores suffixes like -slim-bookworm), then -> X.Y
59+ BDD_VERSION=$(sed -En 's/^FROM[[:space:]]+rust:([0-9.]+).*/\1/p' bdd/rust/Dockerfile | head -1)
60+ BENCH_VERSION=$(sed -En 's/^FROM[[:space:]]+rust:([0-9.]+).*/\1/p' core/bench/dashboard/server/Dockerfile | head -1)
61+ BDD_MINOR=$(to_minor "$BDD_VERSION")
62+ BENCH_MINOR=$(to_minor "$BENCH_VERSION")
63+
64+ # Fail if mismatched
65+ if [ "$TOOLCHAIN_MINOR" != "$BDD_MINOR" ]; then
66+ echo "ERROR: bdd/rust/Dockerfile uses $BDD_VERSION (-> $BDD_MINOR) but rust-toolchain.toml specifies $TOOLCHAIN_VERSION (-> $TOOLCHAIN_MINOR)" >&2
6967 exit 1
7068 fi
71-
72- if [ "$TOOLCHAIN_VERSION" != "$BENCH_VERSION" ]; then
73- echo "ERROR: core/bench/dashboard/server/Dockerfile uses Rust $BENCH_VERSION but rust-toolchain.toml specifies $TOOLCHAIN_VERSION"
74- echo "Run ./scripts/sync-rust-version.sh to fix this"
69+
70+ if [ "$TOOLCHAIN_MINOR" != "$BENCH_MINOR" ]; then
71+ echo "ERROR: core/bench/dashboard/server/Dockerfile uses $BENCH_VERSION (-> $BENCH_MINOR) but rust-toolchain.toml specifies $TOOLCHAIN_VERSION (-> $TOOLCHAIN_MINOR)" >&2
7572 exit 1
7673 fi
77-
74+
7875 echo "✓ All Rust versions are synchronized at $TOOLCHAIN_VERSION"
7976
8077 check :
8582 uses : actions/checkout@v4
8683 - name : Install toolchain
8784 run : |
88- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
85+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
8986 - name : Run cargo check
9087 run : |
9188 cargo check
9895 uses : actions/checkout@v4
9996 - name : Install toolchain
10097 run : |
101- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
98+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
10299 - name : Run cargo fmt
103100 run : |
104101 cargo fmt --all -- --check
@@ -111,7 +108,7 @@ jobs:
111108 uses : actions/checkout@v4
112109 - name : Install toolchain
113110 run : |
114- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
111+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
115112 - name : Run cargo clippy
116113 run : |
117114 cargo clippy --all-targets --all-features -- -D warnings
@@ -124,7 +121,7 @@ jobs:
124121 uses : actions/checkout@v4
125122 - name : Install toolchain
126123 run : |
127- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
124+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
128125 - name : Install cargo-sort
129126 uses : taiki-e/install-action@v2
130127 with :
@@ -141,7 +138,7 @@ jobs:
141138 uses : actions/checkout@v4
142139 - name : Install toolchain
143140 run : |
144- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
141+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
145142 - name : Run cargo test (doc)
146143 run : |
147144 cargo test --doc
@@ -157,7 +154,7 @@ jobs:
157154 uses : actions/checkout@v4
158155 - name : Install toolchain
159156 run : |
160- echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
157+ echo "Using Rust toolchain from rust-toolchain.toml: $(rustup show)"
161158 - name : Install cargo-machete
162159 uses : taiki-e/install-action@v2
163160 with :
0 commit comments