This is an automated email from the ASF dual-hosted git repository.
areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new cfcca59097 [ci] Clean up mergebot commit messages (#11437)
cfcca59097 is described below
commit cfcca59097589a1a35b3a0a9b27b8c5920f49f76
Author: driazati <[email protected]>
AuthorDate: Thu May 26 12:59:55 2022 -0700
[ci] Clean up mergebot commit messages (#11437)
* [ci] Clean up mergebot commit messages
Adds both bullets and closes #11433
* Fix error from pr #11442
Co-authored-by: driazati <[email protected]>
---
tests/python/ci/sample_prs/pr10786-merges.json | 2 +-
.../python/ci/sample_prs/pr11442-no-recomment.json | 191 +++++++++++++++++++++
tests/python/ci/test_mergebot.py | 18 +-
tests/scripts/github_mergebot.py | 19 +-
4 files changed, 221 insertions(+), 9 deletions(-)
diff --git a/tests/python/ci/sample_prs/pr10786-merges.json
b/tests/python/ci/sample_prs/pr10786-merges.json
index 673fc753e3..c7b6940f0d 100644
--- a/tests/python/ci/sample_prs/pr10786-merges.json
+++ b/tests/python/ci/sample_prs/pr10786-merges.json
@@ -1,6 +1,6 @@
{
"title": "[Hexagon] 2-d allocation cleanup",
- "body": "- Added device validity check in allocation. HexagonDeviceAPI
should only be called for CPU/Hexagon types.\r\n\r\n- Check for \"global.vtcm\"
scope instead of \"vtcm\". The ccope of N-d allocations produced by
`LowerVtcmAlloc` should be `\"global.vtcm\"`. The previous check allowed
unsupported scope such as `\"local.vtcm\"`.\r\n\r\n- Remove `vtcmallocs` entry
after calling free. Previously, the vtcm allocation map kept dangling pointers
to `HexagonBuffer` objects after they [...]
+ "body": "- Added device validity check in allocation. HexagonDeviceAPI
should only be called for CPU/Hexagon types.\r\n\r\n- Check for \"global.vtcm\"
scope instead of \"vtcm\". The ccope of N-d allocations produced by
`LowerVtcmAlloc` should be `\"global.vtcm\"`. The previous check allowed
unsupported scope such as `\"local.vtcm\"`.\r\n\r\n- Remove `vtcmallocs` entry
after calling free.\n\n\nThanks for contributing to TVM! Please refer to
guideline https://tvm.apache.org/docs/cont [...]
"state": "OPEN",
"author": {
"login": "Lunderberg"
diff --git a/tests/python/ci/sample_prs/pr11442-no-recomment.json
b/tests/python/ci/sample_prs/pr11442-no-recomment.json
new file mode 100644
index 0000000000..77af805f21
--- /dev/null
+++ b/tests/python/ci/sample_prs/pr11442-no-recomment.json
@@ -0,0 +1,191 @@
+{
+ "title": "Add 'static_library' runtime::Module",
+ "body": "(See
https://discuss.tvm.apache.org/t/byoc-supporting-cutlass-byoc-with-collage/12796/6
for\r\ncontext, which in turn is part of Collage
(https://github.com/apache/tvm-rfcs/blob/main/rfcs/0062-collage.md).\r\n\r\nThis
adds a new 'DSO exportable' runtime module representing the contents of a .o
file. It\r\nallows external codegen toolchains to yield a result which:\r\n -
Like CSource modules, can be conveyed directly to the final export_library
compilation\r\n step for linkin [...]
+ "state": "OPEN",
+ "author": {
+ "login": "mbs-octoml"
+ },
+ "comments": {
+ "pageInfo": {
+ "hasPreviousPage": false
+ },
+ "nodes": [
+ {
+ "authorAssociation": "MEMBER",
+ "author": {
+ "login": "tqchen"
+ },
+ "updatedAt": "2022-05-24T22:13:29Z",
+ "body": "Thanks @mbs-octoml . I think we go with this as a temp
workaround with a mind that the IsDSOExportable and ImplementsFunction likely
should go to Artifact."
+ },
+ {
+ "authorAssociation": "CONTRIBUTOR",
+ "author": {
+ "login": "mbs-octoml"
+ },
+ "updatedAt": "2022-05-24T22:56:07Z",
+ "body": "Yeah, we really need to put some love into
that.\r\n\r\nCollecting all the pieces needed for deployment along with their
metadata a la Artifact is pretty clearly needed, though I suspect that will
need to be abstract to cover the spectrum from firmware image to dynamically
loadable .so to ready-to-call JITed code to tar.\r\n\r\nI can't help thinking
we should also think about build rules guarded by target kinds & attributes,
since again there's just so may ways to proceed."
+ },
+ {
+ "authorAssociation": "MEMBER",
+ "author": {
+ "login": "tqchen"
+ },
+ "updatedAt": "2022-05-24T23:08:00Z",
+ "body": "Perhaps we will end up building our own cmake/bazel :p in
another time"
+ },
+ {
+ "authorAssociation": "CONTRIBUTOR",
+ "author": {
+ "login": "mbs-octoml"
+ },
+ "updatedAt": "2022-05-25T22:11:44Z",
+ "body": "Thanks Tianqi. Let's see if this new fancy bot
works...\r\n\r\n"
+ },
+ {
+ "authorAssociation": "CONTRIBUTOR",
+ "author": {
+ "login": "mbs-octoml"
+ },
+ "updatedAt": "2022-05-25T22:11:50Z",
+ "body": "@tvm-bot merge"
+ },
+ {
+ "authorAssociation": "NONE",
+ "author": {
+ "login": "github-actions"
+ },
+ "updatedAt": "2022-05-25T22:12:10Z",
+ "body": "Cannot merge, did not find any approving reviews from users
with write access on 96d4e62da5a7b78da18d0ee28cc6261d8fbf31c4"
+ },
+ {
+ "authorAssociation": "CONTRIBUTOR",
+ "author": {
+ "login": "mbs-octoml"
+ },
+ "updatedAt": "2022-05-25T22:12:37Z",
+ "body": "Hmff."
+ },
+ {
+ "authorAssociation": "NONE",
+ "author": {
+ "login": "github-actions"
+ },
+ "updatedAt": "2022-05-25T22:12:55Z",
+ "body": "Cannot merge, did not find any approving reviews from users
with write access on 96d4e62da5a7b78da18d0ee28cc6261d8fbf31c4"
+ }
+ ]
+ },
+ "authorCommits": {
+ "nodes": [
+ {
+ "commit": {
+ "authors": {
+ "nodes": [
+ {
+ "name": "mbs-octoml",
+ "email": "[email protected]"
+ }
+ ]
+ }
+ }
+ }
+ ]
+ },
+ "commits": {
+ "nodes": [
+ {
+ "commit": {
+ "oid": "96d4e62da5a7b78da18d0ee28cc6261d8fbf31c4",
+ "statusCheckRollup": {
+ "contexts": {
+ "pageInfo": {
+ "hasNextPage": false
+ },
+ "nodes": [
+ {
+ "name": "MacOS",
+ "checkSuite": {
+ "workflowRun": {
+ "workflow": {
+ "name": "CI"
+ }
+ }
+ },
+ "status": "COMPLETED",
+ "conclusion": "SUCCESS",
+ "url": "https://github.com/apache/tvm/runs/6598275844"
+ },
+ {
+ "name": "cc-reviewers",
+ "checkSuite": {
+ "workflowRun": {
+ "workflow": {
+ "name": "PR"
+ }
+ }
+ },
+ "status": "COMPLETED",
+ "conclusion": "SUCCESS",
+ "url": "https://github.com/apache/tvm/runs/6598273162"
+ },
+ {
+ "name": "Windows",
+ "checkSuite": {
+ "workflowRun": {
+ "workflow": {
+ "name": "CI"
+ }
+ }
+ },
+ "status": "COMPLETED",
+ "conclusion": "SUCCESS",
+ "url": "https://github.com/apache/tvm/runs/6598275717"
+ },
+ {
+ "name": "Android",
+ "checkSuite": {
+ "workflowRun": {
+ "workflow": {
+ "name": "CI"
+ }
+ }
+ },
+ "status": "COMPLETED",
+ "conclusion": "SUCCESS",
+ "url": "https://github.com/apache/tvm/runs/6598275593"
+ },
+ {
+ "state": "SUCCESS",
+ "context": "tvm-ci/pr-head",
+ "targetUrl":
"https://ci.tlcpack.ai/job/tvm/job/PR-11442/4/display/redirect"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ },
+ "reviewDecision": "APPROVED",
+ "reviews": {
+ "pageInfo": {
+ "hasPreviousPage": false
+ },
+ "nodes": [
+ {
+ "body": "",
+ "updatedAt": "2022-05-24T23:08:31Z",
+ "url":
"https://github.com/apache/tvm/pull/11442#pullrequestreview-983954561",
+ "authorCanPushToRepository": true,
+ "commit": {
+ "oid": "23c600097cf1c2a55acda059626a060e106dd023"
+ },
+ "author": {
+ "login": "tqchen"
+ },
+ "state": "APPROVED"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/tests/python/ci/test_mergebot.py b/tests/python/ci/test_mergebot.py
index fbe9262b09..b9f944e897 100644
--- a/tests/python/ci/test_mergebot.py
+++ b/tests/python/ci/test_mergebot.py
@@ -35,11 +35,21 @@ class TempGit:
raise RuntimeError(f"git command failed: '{args}'")
+SUCCESS_EXPECTED_OUTPUT = """
+Dry run, would have merged with url=pulls/10786/merge and data={
+ "commit_title": "[Hexagon] 2-d allocation cleanup (#10786)",
+ "commit_message": "- Added device validity check in allocation.
HexagonDeviceAPI should only be called for CPU/Hexagon types.\\n\\n- Check for
\\"global.vtcm\\" scope instead of \\"vtcm\\". The ccope of N-d allocations
produced by `LowerVtcmAlloc` should be `\\"global.vtcm\\"`. The previous check
allowed unsupported scope such as `\\"local.vtcm\\"`.\\n\\n- Remove
`vtcmallocs` entry after calling free.\\n\\nPreviously, the vtcm allocation map
kept dangling pointers to `HexagonBuffer` [...]
+ "sha": "6f04bcf57d07f915a98fd91178f04d9e92a09fcd",
+ "merge_method": "squash"
+}
+""".strip()
+
+
test_data = {
"successful-merge": {
"number": 10786,
"filename": "pr10786-merges.json",
- "expected": "Dry run, would have merged with url=pulls/10786/merge",
+ "expected": SUCCESS_EXPECTED_OUTPUT,
"detail": "Everything is fine so this PR will merge",
},
"no-request": {
@@ -96,6 +106,12 @@ test_data = {
"expected": "Co-authored-by: Some One <[email protected]>",
"detail": "Check that a merge request with co-authors generates the
correct commit message",
},
+ "no-recomment": {
+ "number": 11442,
+ "filename": "pr11442-no-recomment.json",
+ "expected": "No merge requested, exiting",
+ "detail": "Check that comments after a failed merge don't trigger
another merge",
+ },
}
diff --git a/tests/scripts/github_mergebot.py b/tests/scripts/github_mergebot.py
index 65c949caf5..76e0803efc 100755
--- a/tests/scripts/github_mergebot.py
+++ b/tests/scripts/github_mergebot.py
@@ -22,6 +22,7 @@ import argparse
import warnings
import logging
import traceback
+import re
from typing import Dict, Any, List, Optional
from pathlib import Path
@@ -33,7 +34,7 @@ Review = Dict[str, Any]
CIJob = Dict[str, Any]
EXPECTED_JOBS = ["tvm-ci/pr-head"]
-THANKS_MESSAGE = "Thanks for contributing to TVM! Please refer to guideline
https://tvm.apache.org/docs/contribute/ for useful information and tips. After
the pull request is submitted, please request code reviews from
[Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers)
by @ them in the pull request thread."
+THANKS_MESSAGE = r"(\s*)Thanks for contributing to TVM! Please refer to
guideline https://tvm.apache.org/docs/contribute/ for useful information and
tips. After the pull request is submitted, please request code reviews from
\[Reviewers\]\(https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers\)
by them in the pull request thread.(\s*)"
def to_json_str(obj: Any) -> str:
@@ -315,11 +316,12 @@ class PR:
def processed_body(self) -> str:
body = self.raw["body"].strip().replace("\r", "")
- body = body.replace(
- THANKS_MESSAGE,
- "",
- )
- return body
+ # Remove any @-mentions of people
+ body = re.sub(r"(\s)@", "\g<1>", body)
+
+ # Remove the auto-inserted text since it's not useful to have in the
commit log
+ body = re.sub(THANKS_MESSAGE, "\n\n", body)
+ return body.strip()
def body_with_co_authors(self) -> str:
"""
@@ -350,7 +352,7 @@ class PR:
"""
url = f"pulls/{self.number}/merge"
- title = self.raw["title"]
+ title = self.raw["title"] + f" (#{self.number})"
body = self.body_with_co_authors()
logging.info(f"Full commit:\n{title}\n\n{body}")
@@ -406,6 +408,9 @@ class PR:
]
def parse_action(comment: Dict[str, Any]) -> Optional[str]:
+ if comment["author"]["login"] == "github-actions":
+ return "commented"
+
if not self.comment_can_merge(comment):
return None