6 TOOLSTATE_FILE="$(realpath $2)"
8 COMMIT="$(git rev-parse HEAD)"
9 CHANGED_FILES="$(git diff --name-status HEAD HEAD^)"
10 SIX_WEEK_CYCLE="$(( ($(date +%s) / 86400 - 20) % 42 ))"
11 # ^ Number of days after the last promotion of beta.
12 # Its value is 41 on the Tuesday where "Promote master to beta (T-2)" happens.
13 # The Wednesday after this has value 0.
14 # We track this value to prevent regressing tools in the last week of the 6-week cycle.
16 touch "$TOOLSTATE_FILE"
18 # Try to test all the tools and store the build/test success in the TOOLSTATE_FILE
21 python2.7 "$X_PY" test --no-fail-fast \
25 src/doc/rust-by-example \
26 src/doc/embedded-book \
37 # This function checks that if a tool's submodule changed, the tool's state must improve
39 echo "Verifying status of $1..."
40 if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then
41 echo "This PR updated '$2', verifying if status is 'test-pass'..."
42 if grep -vq '"'"$1"'":"test-pass"' "$TOOLSTATE_FILE"; then
44 echo "⚠️ We detected that this PR updated '$1', but its tests failed."
46 echo "If you do intend to update '$1', please check the error messages above and"
47 echo "commit another update."
49 echo "If you do NOT intend to update '$1', please ensure you did not accidentally"
50 echo "change the submodule at '$2'. You may ask your reviewer for the"
57 # deduplicates the submodule check and the assertion that on beta some tools MUST be passing
59 if [ "$1" = submodule_changed ]; then
60 # ignore $2 (branch id)
62 elif [ "$2" = beta ]; then
63 echo "Requiring test passing for $3..."
64 if grep -q '"'"$3"'":"\(test\|build\)-fail"' "$TOOLSTATE_FILE"; then
72 check_dispatch $1 beta book src/doc/book
73 check_dispatch $1 beta nomicon src/doc/nomicon
74 check_dispatch $1 beta reference src/doc/reference
75 check_dispatch $1 beta rust-by-example src/doc/rust-by-example
76 check_dispatch $1 beta rls src/tools/rls
77 check_dispatch $1 beta rustfmt src/tools/rustfmt
78 check_dispatch $1 beta clippy-driver src/tools/clippy
79 # these tools are not required for beta to successfully branch
80 check_dispatch $1 nightly miri src/tools/miri
81 check_dispatch $1 nightly embedded-book src/doc/embedded-book
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 CHECK_NOT="$(readlink -f "$(dirname $0)/checkregression.py")"
91 # only update the history
92 if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then
93 echo 'Toolstate is not changed. Not updating.'
95 if [ $SIX_WEEK_CYCLE -ge 35 ]; then
96 python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed
99 $COMMIT\t$(cat "$TOOLSTATE_FILE")
104 if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
105 if [ -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
106 . "$(dirname $0)/repo.sh"
107 MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
108 echo "($OS CI update)" > "$MESSAGE_FILE"
109 commit_toolstate_change "$MESSAGE_FILE" change_toolstate
110 rm -f "$MESSAGE_FILE"
115 # abort compilation if an important tool doesn't build
116 # (this code is reachable if not on the nightly channel)
117 status_check "beta_required"