-
Notifications
You must be signed in to change notification settings - Fork 10
github actions: Optimize kernel tree clone/fetch #750
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR optimizes the GitHub Actions workflow for validating kernel commits by implementing shallow cloning and targeted fetching strategies to reduce the amount of git history that needs to be cloned, significantly speeding up the CI process.
Key Changes
- Replaces full repository checkout with shallow clones using
--depth=1for the base branch and calculated depth for PR branches - Adds a staleness check to verify PR branches are rebased on the latest base commit
- Implements smart upstream mainline fetching using
--shallow-excludebased on kernel version tags - Updates all Python script calls to use commit SHAs instead of branch names for consistency
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1dc2739 to
5f30a99
Compare
5f30a99 to
eff55e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eff55e0 to
e409580
Compare
Check that the PR branch is up to date with the latest base branch commit, and fail if it isn't.
Cloning the base branch takes a long time because a fetch-depth of 0 causes all history for all branches and tags to be cloned (!). In addition, the entire history of the PR branch is fetched. Only the tip of the base branch along with the new commits present in a PR need to be cloned; anything more than that is unneeded. Reduce the depth of the base branch clone to 1 commit and the PR branch fetch to the number of commits in the PR plus 1 (to get the tip of the base branch). The same philosophy is applied to fetching the mainline branch, which is substantially more complex. All that is needed _at most_ is the history between the kernel version tag and the tip of mainline, since the kernel version tag is the most recent common ancestor between us and mainline. History older than the kernel version tag is thus excluded via --shallow-exclude. And as an added bonus, skip checkout on the base branch clone since all of the python scripts inspecting the tree perform checkouts themselves. That way, no time is wasted on checking out the tree to a different SHA than the first checkout by one of the python scripts.
e409580 to
cf8e45a
Compare
PlaidCat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
We may want to look at some of these optimization for the build workflows, but we can create a jira project to do that so everyone can learn this ... fun with GHA's
bmastbergen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥌
Speed up the cloning process by only cloning what is necessary.
Successful test run: https://github.com/ctrliq/kernel-src-tree/actions/runs/19975988193/job/57292178451?pr=749