Skip to content

Commit

Permalink
run issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeyonglee0205 committed Jan 18, 2024
1 parent 7e37300 commit f5baa2a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 8 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
3 changes: 2 additions & 1 deletion debug/iterate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion repos/rocketmq
Submodule rocketmq updated from 0b76f6 to 5914ff
32 changes: 26 additions & 6 deletions verify_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -690,16 +693,21 @@ 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, "")

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:
Expand Down Expand Up @@ -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)
Expand All @@ -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)

0 comments on commit f5baa2a

Please sign in to comment.