diff options
| author | kennytm <kennytm@gmail.com> | 2017-12-22 01:16:21 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-12-27 00:00:46 +0800 |
| commit | 44954ab52d82fe5ae5222c3bfd482d38c3db0baa (patch) | |
| tree | d9dee3177bf9a289fb87a7a43f33bcb9c9cea3ad /src/ci/docker | |
| parent | d7488c308963ddc98811cafc95f75cd1647baf0a (diff) | |
| download | rust-44954ab52d82fe5ae5222c3bfd482d38c3db0baa.tar.gz rust-44954ab52d82fe5ae5222c3bfd482d38c3db0baa.zip | |
Clarify toolstate names. Move publish.py to a more convenient location.
Diffstat (limited to 'src/ci/docker')
| -rwxr-xr-x | src/ci/docker/x86_64-gnu-tools/checktools.sh | 2 | ||||
| -rwxr-xr-x | src/ci/docker/x86_64-gnu-tools/publish.py | 105 |
2 files changed, 1 insertions, 106 deletions
diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index e06b6ab3d1b..0d40863c092 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -41,6 +41,6 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE") exit 0 fi -if grep -q 'Broken\|Compiling' "$TOOLSTATE_FILE"; then +if grep -q fail "$TOOLSTATE_FILE"; then exit 4 fi diff --git a/src/ci/docker/x86_64-gnu-tools/publish.py b/src/ci/docker/x86_64-gnu-tools/publish.py deleted file mode 100755 index b90947e5a43..00000000000 --- a/src/ci/docker/x86_64-gnu-tools/publish.py +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -import sys -import re -import json -import copy -import datetime -import collections - -# List of people to ping when the status of a tool changed. -MAINTAINERS = { - 'miri': '@oli-obk @RalfJung @eddyb', - 'clippy-driver': '@Manishearth @llogiq @mcarton @oli-obk', - 'rls': '@nrc', - 'rustfmt': '@nrc', -} - - -def read_current_status(current_commit, path): - '''Reads build status of `current_commit` from content of `history/*.tsv` - ''' - with open(path, 'rU') as f: - for line in f: - (commit, status) = line.split('\t', 1) - if commit == current_commit: - return json.loads(status) - return {} - - -def update_latest(current_commit, relevant_pr_number, current_datetime): - '''Updates `_data/latest.json` to match build result of the given commit. - ''' - with open('_data/latest.json', 'rb+') as f: - latest = json.load(f, object_pairs_hook=collections.OrderedDict) - - current_status = { - os: read_current_status(current_commit, 'history/' + os + '.tsv') - for os in ['windows', 'linux'] - } - - slug = 'rust-lang/rust' - message = '📣 Toolstate changed by {}!\n\nTested on commit {}@{}.\n\n' \ - .format(relevant_pr_number, slug, current_commit) - anything_changed = False - for status in latest: - tool = status['tool'] - changed = False - - for os, s in current_status.items(): - old = status[os] - new = s.get(tool, old) - status[os] = new - if new > old: - changed = True - message += '🎉 {} on {}: {} → {}.\n' \ - .format(tool, os, old, new) - elif new < old: - changed = True - message += '💔 {} on {}: {} → {} (cc {}).\n' \ - .format(tool, os, old, new, MAINTAINERS[tool]) - - if changed: - status['commit'] = current_commit - status['datetime'] = current_datetime - anything_changed = True - - if not anything_changed: - return '' - - f.seek(0) - f.truncate(0) - json.dump(latest, f, indent=4, separators=(',', ': ')) - return message - - -if __name__ == '__main__': - cur_commit = sys.argv[1] - cur_datetime = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') - cur_commit_msg = sys.argv[2] - save_message_to_path = sys.argv[3] - - relevant_pr_match = re.search('#[0-9]+', cur_commit_msg) - if relevant_pr_match: - relevant_pr_number = 'rust-lang/rust' + relevant_pr_match.group(0) - else: - relevant_pr_number = '<unknown PR>' - - message = update_latest(cur_commit, relevant_pr_number, cur_datetime) - if message: - print(message) - with open(save_message_to_path, 'w') as f: - f.write(message) - else: - print('<Nothing changed>') |
