-
Notifications
You must be signed in to change notification settings - Fork 60
FEAT: Add PR Performance Report (Profiler) #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
30e7805
CHORE: Add paired profiler benchmarks and PR regression reports
bewithgaurav 665e659
FIX: Repair hosted profiler setup and CI wait budgets
bewithgaurav b505deb
FIX: Complete profiler CI samples and isolate incomplete reports
bewithgaurav 019b75e
FIX: Repair profiler CI against latest main
bewithgaurav f5779f4
FIX: Stabilize profiler CI reporting and macOS tests
bewithgaurav 5ed1792
FIX: Authenticate profiler reporting inputs
bewithgaurav 8c8e3dd
REFACTOR: Organize PR performance reporting
bewithgaurav 00da039
FIX: Finalize and bound performance reports
bewithgaurav e2997e0
FIX: Isolate performance artifact timeouts
bewithgaurav 04c62ba
FIX: Harden profiler CI orchestration
Copilot 14a3677
Merge branch 'main' into bewithgaurav/profiler-ci
bewithgaurav 43b2669
REFACTOR: Deepen profiler report assessment
bewithgaurav 234b7f0
Merge remote-tracking branch 'origin/main' into bewithgaurav/profiler-ci
bewithgaurav a2dde75
FIX: Complete profiler CI review hardening
bewithgaurav 31f34cb
FIX: Close profiler CI validation gaps
bewithgaurav c1b9ab8
FIX: Harden profiler artifact finalization
bewithgaurav dd7a951
FIX: Scope profiler CI to pull requests
bewithgaurav 650c31e
FIX: Finalize profiler CI readiness
bewithgaurav f565b1b
FIX: Bound profiler CI to current PR runs
Copilot 0a96092
FIX: Select Windows profiler tasks by reason
Copilot 1b44b27
FIX: Normalize interrupted profiler responses
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| """Copy one expected coverage report from a ZIP without extracting archive paths.""" | ||
|
|
||
| import argparse | ||
| from pathlib import Path, PurePosixPath | ||
| import stat | ||
| import zipfile | ||
|
|
||
| MAX_ARCHIVE_FILES = 10_000 | ||
| MAX_ARCHIVE_BYTES = 256 * 1024 * 1024 | ||
| MAX_REPORT_BYTES = 64 * 1024 * 1024 | ||
|
|
||
|
|
||
| def select(archive, kind): | ||
| members = archive.infolist() | ||
| if ( | ||
| len(members) > MAX_ARCHIVE_FILES | ||
| or sum(member.file_size for member in members) > MAX_ARCHIVE_BYTES | ||
| ): | ||
| raise ValueError("Coverage artifact exceeds size limits") | ||
|
|
||
| candidates = [] | ||
| for member in members: | ||
| path = PurePosixPath(member.filename) | ||
| if ( | ||
| member.is_dir() | ||
| or stat.S_ISDIR(member.external_attr >> 16) | ||
| or path.is_absolute() | ||
| or ".." in path.parts | ||
| or "\\" in member.filename | ||
| or member.flag_bits & 1 | ||
| or stat.S_ISLNK(member.external_attr >> 16) | ||
| or member.file_size > MAX_REPORT_BYTES | ||
| ): | ||
| continue | ||
| if kind == "html" and path.name == "index.html" and "Code Coverage Report" in str(path): | ||
| candidates.append((0, member)) | ||
| elif kind == "xml" and path.suffix.lower() == ".xml": | ||
| name = path.name.lower() | ||
| if str(path).endswith("unified-coverage/coverage.xml"): | ||
| priority = 0 | ||
| elif name == "coverage.xml": | ||
| priority = 1 | ||
| elif "coverage" in name: | ||
| priority = 2 | ||
| else: | ||
| continue | ||
| candidates.append((priority, member)) | ||
|
|
||
| if not candidates: | ||
| raise ValueError(f"No coverage {kind} report found") | ||
| priority = min(item[0] for item in candidates) | ||
| selected = [member for rank, member in candidates if rank == priority] | ||
| return selected | ||
|
|
||
|
|
||
| def copy_report(archive_path, output, kind): | ||
| if Path(archive_path).stat().st_size > MAX_ARCHIVE_BYTES: | ||
| raise ValueError("Coverage archive exceeds size limit") | ||
| with zipfile.ZipFile(archive_path) as archive: | ||
| selected = select(archive, kind) | ||
| data = archive.read(selected[0]) | ||
| if any(archive.read(member) != data for member in selected[1:]): | ||
| raise ValueError(f"Conflicting coverage {kind} reports") | ||
| Path(output).write_bytes(data) | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("kind", choices=("html", "xml")) | ||
| parser.add_argument("archive", type=Path) | ||
| parser.add_argument("output", type=Path) | ||
| args = parser.parse_args() | ||
| copy_report(args.archive, args.output, args.kind) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.