Skip to content
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

ci: Allow upstream git refs to be used for benchmarking #3730

Merged
merged 5 commits into from
Jan 30, 2025

Conversation

desmondcheongzx
Copy link
Contributor

@desmondcheongzx desmondcheongzx commented Jan 27, 2025

Had trouble running the benchmarking tool when local branch names didn't match remote branch names. Fix it so that we check for upstream branch names and use them.

E.g. if I run the tool on local-branch-name, it finds origin/user/remote-branch-name then runs the action on user/remote-branch-name.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.58%. Comparing base (603199f) to head (2481e59).
Report is 14 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3730      +/-   ##
==========================================
+ Coverage   77.55%   77.58%   +0.03%     
==========================================
  Files         729      729              
  Lines       91917    92035     +118     
==========================================
+ Hits        71284    71409     +125     
+ Misses      20633    20626       -7     

see 7 files with indirect coverage changes

Copy link

codspeed-hq bot commented Jan 27, 2025

CodSpeed Performance Report

Merging #3730 will improve performances by 46.34%

Comparing fix-git-utils-for-upstream (2481e59) with main (a8d63dd)

Summary

⚡ 2 improvements
✅ 25 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_count[1 Small File] 3.9 ms 3.3 ms +16.8%
test_show[100 Small Files] 23.5 ms 16.1 ms +46.34%

@raunakab
Copy link
Contributor

Oh, is this for when you're HEAD is detached and pointing to a remote branch name?

commit_hash = (
subprocess.check_output(["git", "rev-parse", branch_name], stderr=subprocess.STDOUT).strip().decode("utf-8")
subprocess.check_output(["git", "rev-parse", local_branch_name], stderr=subprocess.STDOUT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be remote_branch_name then, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters. If I'm not wrong, the commit hash should be the same for local and remote

.decode("utf-8")
)
has_upstream = True
local_branch_name = upstream_branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting has_upstream = True here and then performing a check later, can't we just perform the splitting here? I.e.:

local_branch_name = upstream_branch.split("/", 1)[1]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catches, I was kind of lazy when coding this up 😅 cleaned up now!

@desmondcheongzx desmondcheongzx merged commit 3462732 into main Jan 30, 2025
43 checks passed
@desmondcheongzx desmondcheongzx deleted the fix-git-utils-for-upstream branch January 30, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants