Skip to content

Commit 8ed16fe

Browse files
committed
Requires tools to test-pass if the corresponding submodule is updated.
If a PR intends to update a tool but its test has failed, abort the merge regardless of current channel. This should help the tool maintainers if the update turns out to be failing due to changes in latest master.
1 parent 35681fb commit 8ed16fe

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
- docker
66

77
git:
8-
depth: 1
8+
depth: 2
99
submodules: false
1010

1111
matrix:

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ environment:
9696
matrix:
9797
fast_finish: true
9898

99-
clone_depth: 1
99+
clone_depth: 2
100100
build: false
101101

102102
install:

src/ci/docker/x86_64-gnu-tools/checktools.sh

+23-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ X_PY="$1"
1616
TOOLSTATE_FILE="$(realpath $2)"
1717
OS="$3"
1818
COMMIT="$(git rev-parse HEAD)"
19+
CHANGED_FILES="$(git diff --name-status HEAD HEAD^)"
1920

2021
touch "$TOOLSTATE_FILE"
2122

@@ -29,7 +30,28 @@ set -e
2930

3031
cat "$TOOLSTATE_FILE"
3132

32-
if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
33+
# If this PR is intended to update one of these tools, do not let the build pass
34+
# when they do not test-pass.
35+
for TOOL in rls rustfmt miri clippy; do
36+
echo "Verifying status of $TOOL..."
37+
if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]src/tools/$TOOL$"; then
38+
echo "This PR updated 'src/tools/$TOOL', verifying if status is 'test-pass'..."
39+
if grep -vq '"'"$TOOL"'[^"]*":"test-pass"' "$TOOLSTATE_FILE"; then
40+
echo
41+
echo "⚠️ We detected that this PR updated '$TOOL', but its tests failed."
42+
echo
43+
echo "If you do intend to update '$TOOL', please check the error messages above and"
44+
echo "commit another update."
45+
echo
46+
echo "If you do NOT intend to update '$TOOL', please ensure you did not accidentally"
47+
echo "change the submodule at 'src/tools/$TOOL'. You may ask your reviewer for the"
48+
echo "proper steps."
49+
exit 3
50+
fi
51+
fi
52+
done
53+
54+
if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
3355
. "$(dirname $0)/repo.sh"
3456
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
3557
echo "($OS CI update)" > "$MESSAGE_FILE"

0 commit comments

Comments
 (0)