-
Notifications
You must be signed in to change notification settings - Fork 438
perf: add cache for forge build #1125
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
b5bc8d7
to
d35f0ea
Compare
d35f0ea
to
6bf4b95
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.
Small suggestions, looks good otherwise
path: | | ||
cache/ | ||
out/ | ||
key: ${{ runner.os }}-forge-${{ hashFiles('**/foundry.toml', '**/remappings.txt', 'src/**/*.sol', 'lib/**/*.sol') }} |
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.
Is it possible to use the commit hash as the key? Since the above defined files may not necessarily change.
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.
don't hv strong opinion, any special benefits of using commit hash?
benefits of current way it's more cohesive within iterations of a given PR, which may hv multiple rounds of CI and build can be totally skipped
.github/workflows/foundry.yml
Outdated
# Cache Foundry dependencies | ||
|
||
# Restore Foundry and Forge cache | ||
- name: Cache Foundry dependencies |
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.
Capitalize first letters
- name: Cache Foundry dependencies | |
- name: Cache Foundry Dependencies |
looks like the approval is gone after i fixed typo, @0xClandestine needs another approval pls |
**Motivation:** after multiple round of optimization, the bottleneck in CI is forge build now, which takes 1.2-1.5min this PR added caching for forge build, so that every CI run can restore latest cache, and only compile solidity files that hv been changed, which significantly lowers compile time from 1.2-1.5min t0 <1s **Modifications:** this PR added caching for forge build, so that every CI run can restore latest cache, and only compile solidity files that hv been changed **Result:** significantly lowers compile time from 1.2-1.5min to <1s before adding cache:  after adding cache: 
Motivation:
after multiple round of optimization, the bottleneck in CI is forge build now, which takes 1.2-1.5min
this PR added caching for forge build, so that every CI run can restore latest cache, and only compile solidity files that hv been changed, which significantly lowers compile time from 1.2-1.5min t0 <1s
Modifications:
this PR added caching for forge build, so that every CI run can restore latest cache, and only compile solidity files that hv been changed
Result:
significantly lowers compile time from 1.2-1.5min to <1s
before adding cache:

after adding cache:
