Skip to content

Commit

Permalink
Updated check-rust-version.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
phklive committed Jul 22, 2024
1 parent c9818cb commit 3997095
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/check-rust-version.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

# Check rust-toolchain file
TOOLCHAIN_VERSION=$(cat rust-toolchain)
# Get rust-toolchain.toml file channel
TOOLCHAIN_VERSION=$(grep 'channel' rust-toolchain.toml | sed -E 's/.*"(.*)".*/\1/')

# Check workspace Cargo.toml file
CARGO_VERSION=$(cat Cargo.toml | grep "rust-version" | cut -d '"' -f 2)
# Get workspace Cargo.toml file rust-version
CARGO_VERSION=$(grep 'rust-version' Cargo.toml | sed -E 's/.*"(.*)".*/\1/')

# Check version match
if [ "$CARGO_VERSION" != "$TOOLCHAIN_VERSION" ]; then
echo "Mismatch in $file. Expected $TOOLCHAIN_VERSION, found $CARGO_VERSION"
echo "Mismatch in Cargo.toml: Expected $TOOLCHAIN_VERSION, found $CARGO_VERSION"
exit 1
fi

Expand Down

0 comments on commit 3997095

Please sign in to comment.