Skip to content

Conversation

@connorjclark
Copy link
Collaborator

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 during run_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.

@connorjclark connorjclark requested a review from a team as a code owner January 5, 2022 19:38
@connorjclark connorjclark requested review from adamraine and removed request for a team January 5, 2022 19:38

- 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
Copy link
Contributor

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.

https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy

Copy link
Collaborator Author

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.

# 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') }}
Copy link
Contributor

@brendankenny brendankenny Jan 5, 2022

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_ENV

and this could become

Suggested change
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 🤷 )

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants