diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..f19dbbac --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Check for new bugs, after 2023 June + +on: [push] +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5.0.0 + with: + python-version: 3.8 + + - name: Install Requirements + uses: py-actions/py-dependency-install@v4 + with: + path: Docker/requirements.txt + + - name: Run Script + run: | + current_date=$(date -u "+%Y-%m-%d") + previous_date=$(date -u -d "$current_date" -d "last month" "+%Y-%m-%d") + previous_date="2023-06-01" + python collect_raw_data.py -t ${{ secrets.GITHUB_TOKEN }} -f data/existing_repos.json -d $previous_date -e + + - name: Compare Output, Create Github issue + run: | + body=$(python debug/iterate_report.py) + gh issue create -t "Output of Github Action" -b "$body" -l "auto" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: report + path: collected/report.json \ No newline at end of file diff --git a/debug/iterate_report.py b/debug/iterate_report.py index e016c842..30d3a1d1 100644 --- a/debug/iterate_report.py +++ b/debug/iterate_report.py @@ -35,8 +35,9 @@ def call_iterate(): repo_dict[repo_name] = count if len(repo_dict.keys()) != 0: + output += "Repo\t\tNumber of Possible Bugs\n" for k, v in repo_dict.items(): - output += f"{k}: {v}\n" + output += f"{k}:\t\t{v}\n" print(output) else: print("No new bugs detected") diff --git a/repos/rocketmq b/repos/rocketmq index 0b76f6f6..5914ff8d 160000 --- a/repos/rocketmq +++ b/repos/rocketmq @@ -1 +1 @@ -Subproject commit 0b76f6f6194d608ed6c97023d36c30940ec6189e +Subproject commit 5914ff8dbb9d37e2cb48ef9c4f0256c6185b4659 diff --git a/verify_bug.py b/verify_bug.py index c74869cb..71766c6e 100644 --- a/verify_bug.py +++ b/verify_bug.py @@ -614,6 +614,9 @@ def fetch_prod_diff (report_map): parser.add_argument('--file', default="report.json") args = parser.parse_args() + if not os.path.isdir("unverified"): + os.makedirs("unverified") + with open(args.file, 'r') as f: report_test_mappings = json.load(f) @@ -650,9 +653,9 @@ def fetch_prod_diff (report_map): if len(bug_info['execution_result']['success_tests']) > 0: verified_bugs[bug_id] = bug_info - print("total bugs: ", len(verified_bugs)) + #print("total bugs: ", len(verified_bugs)) - file_name = f"verified_bugs_{repo_name}.json" + file_name = f"unverified/unverified_bugs_{repo_name}.json" if len(verified_bugs) > 0: with open(file_name, 'w') as f: @@ -690,6 +693,8 @@ def fetch_prod_diff (report_map): ### Auto - Verify + unverified_bugs = [] + for bug_name in bug_names: bug_number = bug_name.split("-")[-1] owner_name = bug_name.replace("-" + bug_number, "") @@ -697,9 +702,12 @@ def fetch_prod_diff (report_map): with open(f"verified_bug/verified_bugs_{owner_name}.json", "r") as f: v_b = json.load(f) - with open(f"verified_bugs_{owner_name}.json", "r") as ff: + with open(f"unverified/unverified_bugs_{owner_name}.json", "r") as ff: n_v_b = json.load(ff) + if bug_name not in v_b.keys(): + unverified_bugs.append(bug_name) + v_b[bug_name] = n_v_b[bug_name] with open(f"verified_bug/verified_bugs_{owner_name}.json", "w") as f: @@ -762,7 +770,6 @@ def fetch_prod_diff (report_map): test = shlex.split(f"{sys.executable} cli.py test -w /root/framework/testing -q") test_output = subprocess.run(test, stdout=subprocess.PIPE) test_output = test_output.stdout.decode() - print(test_output) if test_output.find("Failure") != -1: print("failure for fixed version") wrong_bugs.append(bug_name) @@ -777,12 +784,25 @@ def fetch_prod_diff (report_map): bug_number = wrong_bug.split("-")[-1] owner_name = wrong_bug.replace("-" + bug_number, "") - with open(f"verified_bug/verified_bugs_{owner_name}.json", "r") as f: + with open(f"unverified_bug/unverified_bugs_{owner_name}.json", "r") as f: v_b = json.load(f) del v_b[wrong_bug] - with open(f"verified_bug/verified_bugs_{owner_name}.json", "w") as f: + with open(f"unverified_bug/unverified_bugs_{owner_name}.json", "w") as f: json.dump(v_b, f, indent=2) + + for bug_name in unverified_bugs: + bug_number = bug_name.split("-")[-1] + owner_name = bug_name.replace("-" + bug_number, "") + + with open(f"verified_bug/verified_bugs_{owner_name}.json", "r") as f: + v_b = json.load(f) + + del v_b[bug_name] + + with open(f"verified_bug/verified_bugs_{owner_name}.json", "w") as f: + json.dump(v_b, f, indent=2) + subprocess.run([sys.executable, "debug/collector.py"], stdout=subprocess.PIPE) \ No newline at end of file