Skip to content

Commit 11930d6

Browse files
committed
bot: Filter reports earlier, so we only show a progress bar for the changesets we actually have to analyze
1 parent 8c81386 commit 11930d6

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

bot/code_coverage_bot/commit_coverage.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,36 @@ def generate(repo_dir: str) -> None:
4747
bucket = get_bucket(secrets[secrets.GOOGLE_CLOUD_STORAGE])
4848

4949
with hgmo.HGMO(repo_dir=repo_dir) as hgmo_server:
50-
reports = list(list_reports(bucket, "mozilla-central"))
51-
for changeset, platform, suite in tqdm(reports):
52-
# We are only interested in "overall" coverage, not platform or suite specific.
53-
if platform != DEFAULT_FILTER or suite != DEFAULT_FILTER:
54-
continue
55-
56-
# We already have data for this commit.
57-
if changeset in commit_coverage:
58-
continue
59-
60-
report_name = get_name("mozilla-central", changeset, platform, suite)
50+
# We are only interested in "overall" coverage, not platform or suite specific.
51+
changesets_to_analyze = [
52+
changeset
53+
for changeset, platform, suite in list_reports(bucket, "mozilla-central")
54+
if platform == DEFAULT_FILTER and suite == DEFAULT_FILTER
55+
]
56+
57+
# Skip already analyzed changesets.
58+
changesets_to_analyze = [
59+
changeset
60+
for changeset in changesets_to_analyze
61+
if changeset not in commit_coverage
62+
]
63+
64+
for changeset_to_analyze in tqdm(changesets_to_analyze):
65+
report_name = get_name(
66+
"mozilla-central", changeset_to_analyze, DEFAULT_FILTER, DEFAULT_FILTER
67+
)
6168
assert download_report("ccov-reports", bucket, report_name)
6269

6370
with open(os.path.join("ccov-reports", f"{report_name}.json"), "r") as f:
6471
report = json.load(f)
6572

6673
phabricatorUploader = PhabricatorUploader(
67-
repo_dir, changeset, warnings_enabled=False
74+
repo_dir, changeset_to_analyze, warnings_enabled=False
6875
)
6976

70-
changesets = hgmo_server.get_automation_relevance_changesets(changeset)
77+
changesets = hgmo_server.get_automation_relevance_changesets(
78+
changeset_to_analyze
79+
)
7180

7281
results = phabricatorUploader.generate(hgmo_server, report, changesets)
7382
for changeset in changesets:

0 commit comments

Comments
 (0)