Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit f44f873

Browse files
committed
Do not fail the build if we can't compile the previously published semverver.
1 parent 09b0d7f commit f44f873

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

ci/run.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,25 @@ cp target/debug/cargo-semver ~/rust/cargo/bin
3131
cp target/debug/rust-semverver ~/rust/cargo/bin
3232

3333
# become semververver
34-
PATH=~/rust/cargo/bin:$PATH cargo semver | tee semver_out
35-
current_version="$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)"
36-
current_version="${current_version%\"}"
37-
current_version="${current_version#\"}"
38-
result="$(head -n 1 semver_out)"
39-
if echo "$result" | grep -- "-> $current_version"; then
40-
echo "version ok"
41-
exit 0
34+
#
35+
# Note: Because we rely on rust nightly building the previously published
36+
# semver can often fail. To avoid failing the build we first check
37+
# if we can compile the previously published version.
38+
if cargo install --root "$(mktemp -d)" semverver > /dev/null 2>/dev/null; then
39+
PATH=~/rust/cargo/bin:$PATH cargo semver | tee semver_out
40+
current_version="$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)"
41+
current_version="${current_version%\"}"
42+
current_version="${current_version#\"}"
43+
result="$(head -n 1 semver_out)"
44+
if echo "$result" | grep -- "-> $current_version"; then
45+
echo "version ok"
46+
exit 0
47+
else
48+
echo "versioning mismatch"
49+
cat semver_out
50+
echo "versioning mismatch"
51+
exit 1
52+
fi
4253
else
43-
echo "versioning mismatch"
44-
cat semver_out
45-
echo "versioning mismatch"
46-
exit 1
54+
echo 'Failed to check semver-compliance of semverver. Failed to compiled previous version.' >&2
4755
fi

0 commit comments

Comments
 (0)