Skip to content

Commit 0375776

Browse files
committed
ci: adding full cargo version checker
1 parent aaec3f2 commit 0375776

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Extract version from Cargo.toml
4+
cargo_version_cli=$(grep "^version" rust/cli/Cargo.toml | awk -F '"' '{print $2}')
5+
cargo_version_core=$(grep "^version" rust/core/Cargo.toml | awk -F '"' '{print $2}')
6+
cargo_version_databases=$(grep "^version" rust/quary-databases/Cargo.toml | awk -F '"' '{print $2}')
7+
cargo_version_dbt=$(grep "^version" rust/dbt-converter/Cargo.toml | awk -F '"' '{print $2}')
8+
cargo_version_sqlinference=$(grep "^version" rust/sqlinference/Cargo.toml | awk -F '"' '{print $2}')
9+
cargo_version_wasm=$(grep "^version" rust/wasm-binding/Cargo.toml | awk -F '"' '{print $2}')
10+
11+
# Optional GitHub release version passed as an argument
12+
github_release_version=$1
13+
14+
# Function to compare two versions
15+
compare_versions() {
16+
if [ "$1" != "$2" ]; then
17+
echo "Versions do not match: $1 vs $2"
18+
exit 1
19+
fi
20+
}
21+
22+
compare_versions "$cargo_version_cli" "$cargo_version_cli"
23+
compare_versions "$cargo_version_core" "$cargo_version_cli"
24+
compare_versions "$cargo_version_databases" "$cargo_version_cli"
25+
compare_versions "$cargo_version_dbt" "$cargo_version_cli"
26+
compare_versions "$cargo_version_sqlinference" "$cargo_version_cli"
27+
compare_versions "$cargo_version_wasm" "$cargo_version_cli"
28+
29+
# If GitHub release version is provided, compare it as well
30+
if [ -n "$github_release_version" ]; then
31+
compare_versions "$cargo_version_cli" "$github_release_version"
32+
fi
33+
34+
echo "Versions match."

0 commit comments

Comments
 (0)