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
cache parallel tests log on ci #10989
cache parallel tests log on ci #10989
Conversation
Looks good @hyuraku! If you rebase on What do we need to look for in the GitHub Actions logs to see if this is working as expected? |
I guess that We have to check the two expect test results.
|
|
b4f46b6
to
76a16ca
Compare
76a16ca
to
7fbe08e
Compare
.github/workflows/tests.yml
Outdated
uses: actions/cache@v1 | ||
with: | ||
path: tests/parallel_runtime_rspec.log | ||
key: ${{ runner.os }}-parallel_runtime_rspec.log |
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.
Just noticed: probably want to include the test-flags
in the key somehow (because otherwise the three matrix workers will overwrite each other's cache)
Not seeing any of these yet unfortunately 😭 |
The previous cache is probably in a broken state now. The cache is never overwritten - you have something unique in the key. Use something unique to each test run (like perhaps |
That would avoid having any speedup here. It's fine to overwrite the existing values here (as this is effectively what is done locally) it's just not fine to do so across test suites. Arguably, though, that's something that could be handled in |
Library/Homebrew/dev-cmd/tests.rb
Outdated
|
||
parallel_rspec_log_path = if ENV["CI"] | ||
"tests/parallel_runtime_rspec.log" | ||
else | ||
"#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log" | ||
end | ||
|
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.
parallel_rspec_log_path = if ENV["CI"] | |
"tests/parallel_runtime_rspec.log" | |
else | |
"#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log" | |
end | |
parallel_rspec_log_name = "parallel_runtime_rspec" | |
parallel_rspec_log_name = "#{parallel_rspec_log_name}.no_compat" if args.no_compat? | |
parallel_rspec_log_name = "#{parallel_rspec_log_name}.generic" if args.generic? | |
parallel_rspec_log_name = "#{parallel_rspec_log_name}.online" if args.online? | |
parallel_rspec_log_name = "#{parallel_rspec_log_name}.log" | |
parallel_rspec_log_path = if ENV["CI"] | |
"tests/#{parallel_rspec_log_name}" | |
else | |
"#{HOMEBREW_CACHE}/tests/#{parallel_rspec_log_name}" | |
end | |
.github/workflows/tests.yml
Outdated
key: ${{ runner.os }}-parallel_runtime_rspec.log | ||
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log |
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.
key: ${{ runner.os }}-parallel_runtime_rspec.log | |
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log | |
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec |
.github/workflows/tests.yml
Outdated
with: | ||
path: tests/parallel_runtime_rspec.log | ||
key: ${{ runner.os }}-parallel_runtime_rspec.log | ||
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log |
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.
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log |
That's the point of restore keys. So anything is restored via a partial key match but you always save the updated log with a unique key. Right now, as the key is, the cache will never be updated because the key never changes. So you are storing one log and using it permanently without changes. (I'm not talking about the platform/flags - I agree they should be separated). |
@Bo98 My understanding was it'd be overwritten each time: https://github.com/Homebrew/brew/pull/10989/checks?check_run_id=2274127135#step:17:3 Do you have a source for the above? Not disagreeing, just want to make sure I fully understand 😁 |
That worked because it's the first run under the new key, but look at the previous commit run: https://github.com/Homebrew/brew/runs/2270091160?check_suite_focus=true#step:17:2 |
Gotcha! |
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.
@Bo98 make sense to you?
Yep that should work. Will need to run it a couple times to see if the restore works. |
Great work here, thanks again @hyuraku! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?cache
brew tests
(parallel tests) log on ci.Fixes #10507