3 # Copyright 2017 The Rust Project Developers. See the COPYRIGHT
4 # file at the top-level directory of this distribution and at
5 # http://rust-lang.org/COPYRIGHT.
7 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10 # option. This file may not be copied, modified, or distributed
11 # except according to those terms.
16 TOOLSTATE_FILE="$(realpath $2)"
18 COMMIT="$(git rev-parse HEAD)"
19 CHANGED_FILES="$(git diff --name-status HEAD HEAD^)"
20 SIX_WEEK_CYCLE="$(( ($(date +%s) / 604800 - 3) % 6 ))"
21 # ^ 1970 Jan 1st is a Thursday, and our release dates are also on Thursdays,
22 # thus we could divide by 604800 (7 days in seconds) directly.
24 touch "$TOOLSTATE_FILE"
27 python2.7 "$X_PY" test --no-fail-fast \
31 src/doc/rust-by-example \
42 echo "Verifying status of $1..."
43 if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then
44 echo "This PR updated '$2', verifying if status is 'test-pass'..."
45 if grep -vq '"'"$1"'":"test-pass"' "$TOOLSTATE_FILE"; then
47 echo "⚠️ We detected that this PR updated '$1', but its tests failed."
49 echo "If you do intend to update '$1', please check the error messages above and"
50 echo "commit another update."
52 echo "If you do NOT intend to update '$1', please ensure you did not accidentally"
53 echo "change the submodule at '$2'. You may ask your reviewer for the"
61 if [ "$1" = submodule_changed ]; then
62 # ignore $2 (branch id)
64 elif [ "$2" = beta ]; then
65 echo "Requiring test passing for $3..."
66 if grep -q '"'"$3"'":"\(test\|build\)-fail"' "$TOOLSTATE_FILE"; then
73 check_dispatch $1 beta book src/doc/book
74 check_dispatch $1 beta nomicon src/doc/nomicon
75 check_dispatch $1 beta reference src/doc/reference
76 check_dispatch $1 beta rust-by-example src/doc/rust-by-example
77 check_dispatch $1 beta rls src/tool/rls
78 check_dispatch $1 beta rustfmt src/tool/rustfmt
79 # these tools are not required for beta to successfully branch
80 check_dispatch $1 nightly clippy-driver src/tool/clippy
81 check_dispatch $1 nightly miri src/tool/miri
84 # If this PR is intended to update one of these tools, do not let the build pass
85 # when they do not test-pass.
87 status_check "submodule_changed"
89 if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
90 . "$(dirname $0)/repo.sh"
91 MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
92 echo "($OS CI update)" > "$MESSAGE_FILE"
93 commit_toolstate_change "$MESSAGE_FILE" \
95 $COMMIT\t$(cat "$TOOLSTATE_FILE")
97 # if we are at the last week in the 6-week release cycle, reject any kind of regression.
98 if [ $SIX_WEEK_CYCLE -eq 5 ]; then
99 python2.7 "$(dirname $0)/checkregression.py" \
100 "$OS" "$TOOLSTATE_FILE" "rust-toolstate/_data/latest.json"
102 rm -f "$MESSAGE_FILE"
106 status_check "beta_required"