-
Notifications
You must be signed in to change notification settings - Fork 9.6k
tests: more targeted caching for devtools build #13540
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
.github/workflows/devtools.yml
Outdated
|
|
||
| - name: Generate cache hash | ||
| run: bash $GITHUB_WORKSPACE/lighthouse/.github/scripts/generate-devtools-hash.sh > cdt-test-hash.txt | ||
| # Caches are invalidated by GH after 7 days, so that's the max time between testing |
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.
FWIW, this page says "GitHub will remove any cache entries that have not been accessed in over 7 days", which is slightly different.
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.
good catch, let's just do this bit ourselves.
.github/workflows/devtools.yml
Outdated
| # 3) every change to file in Lighthouse repo important to running these tests. | ||
| # | ||
| # The number is how many times this hash key was manually updated to break the cache. | ||
| key: ${{ runner.os }}-2-${{ hashFiles('cdt-test-hash.txt') }} |
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.
to avoid all the sh business, could run
- name: Set week of the year
run: echo "WEEK_OF_THE_YEAR=$(date +%U)" >> $GITHUB_ENVand this could become
| key: ${{ runner.os }}-2-${{ hashFiles('cdt-test-hash.txt') }} | |
| key: ${{ env.WEEK_OF_THE_YEAR }}-2-${{ hashFiles('cdt-test-hash.txt') }} |
(maybe date could be inlined in the key here but github actions syntax 🤷 )
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.
good call on the +%U
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.
for some reason I prefer mondays tho so +%V :)
Co-authored-by: Adam Raine <[email protected]>
I added some comments explaining the caching more explicitly, then realized that the cache-key generator script was considering files that were irrelevant.
the purpose of this cache is to hold on to content_shell, blink_tools, and devtools frontend repo ... but most importantly, all the stuff in
out/that gets generated duringrun_web_tests.sh. This make subsequent runs build faster, as it only needs to rebuild rules for which Lighthouse-rolled files are a dependency.The files in the cache-key generator script that didn't belong were added for the mistaken reason that "if this file changed, we need to re-run the tests" ... but we want to always run the tests, just throttle how often the DevTools repo updates.
The simplest implementation would be using no cache key, and just have DevTools update every 7 days (GHA cache ttl). Next up is checking for important LH-specific files changing in CDT source. Next up (this PR) includes considering the scripts that setup the test environment / the test files themselves as cache-breaking: most likely, you'd want to see the tests using ToT if you are actively changing them.