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

Add Submodule Caching to Toolchain Generation #1607

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TShapinsky
Copy link

@TShapinsky TShapinsky commented Nov 2, 2024

Adds a job at the beginning of the build workflow which updates caches containing the different submodules required to build the different variants.

This job takes about 3 minutes to run the first time, and after that it takes about 4 seconds to check that the cache is still up to date. This could also be moved to a different trigger which runs less often.

This greatly reduces the amount of resources used to clone submodules (just for the build variants for now). The clones that do happen are shallow (except for uclibc-ng) which also shrinks the git overhead by at least 1GB.

This action only caches the .git/modules directory as the rest of the working directory can be rebuilt from those without needing to download anything else. This allows us to choose which submodules we want to manifest into our build environment. The directory sizes for GCC and LLVM are 1.1GB and 1.9GB respectively, so being able to pick which we want in our environment saves a lot of disk space.

An additional note on github caches. They are scoped to branches, but any branch can restore a cache that was saved by master. Repos are limited to 10GB of total cache storage, so restricting cache generation to master may also be a good move to prevent using all of the cache storage capacity.

@TShapinsky
Copy link
Author

Workflow can be seen here

@TShapinsky TShapinsky force-pushed the cache-submodules branch 4 times, most recently from 9351157 to 9f469aa Compare November 2, 2024 20:56
Copy link
Collaborator

@TommyMurphyTM1234 TommyMurphyTM1234 left a comment

Choose a reason for hiding this comment

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

Minor comments

id: submodule-hash
run: echo "HASH=$(git submodule | sha1sum | head -c 40)" >> $GITHUB_OUTPUT

- name: Check is Cache Exists for Exact Submodule Configuration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo? "is" should be "if"?

Very minor cosmetic (pedantic?!) issue - why the capitalisation of words in comments (here and elsewhere)?

Copy link
Author

@TShapinsky TShapinsky Nov 2, 2024

Choose a reason for hiding this comment

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

Thanks for catching the typo. I was using title case because they appear in the CI as the titles of each step. But if the standard here is all lower case or sentence case I'll happily switch to that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for catching the typo. I was using title case because they appear in the CI as the titles of each step. But if the standard here is all lower case or sentence case I'll happily switch to that.

Ah - they're names of the steps/tasks. I mistakenly thought that they were comments. If that's the convention then it makes sense to adhere to it. But should every word start with a capital letter? Not all do - e.g. "Check if Cache Exists for Exact Submodule Configuration", "If no Cache Hit, Update Cache", "Clone submodules", etc. Maybe prepositions are exempt from the rule? :-)

Copy link
Author

@TShapinsky TShapinsky Nov 2, 2024

Choose a reason for hiding this comment

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

Yeah, maybe just the first word should be capital. Title case is what I was going for, link, which does not capitalize prepositions or conjunctions.

@TShapinsky TShapinsky force-pushed the cache-submodules branch 2 times, most recently from 3b609a8 to 06a5cf2 Compare November 2, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants