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

cache parallel tests log on ci #10989

Merged
merged 10 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ jobs:
- name: Install Bundler RubyGems
run: brew install-bundler-gems

- name: Create parallel test log directory
run: mkdir tests

- name: Cache parallel tests log
uses: actions/cache@v1
with:
path: tests/parallel_runtime_rspec.log
key: ${{ runner.os }}-parallel_runtime_rspec.log
Copy link
Member

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)

restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
key: ${{ runner.os }}-parallel_runtime_rspec.log
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec


- name: Run brew tests
run: |
# brew tests doesn't like world writable directories
Expand Down Expand Up @@ -283,6 +293,16 @@ jobs:
which svn
which svnadmin

- name: Create parallel test log directory
run: mkdir tests

- name: Cache parallel tests log
uses: actions/cache@v1
with:
path: tests/parallel_runtime_rspec.log
key: ${{ runner.os }}-parallel_runtime_rspec.log
MikeMcQuaid marked this conversation as resolved.
Show resolved Hide resolved
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
restore-keys: ${{ runner.os }}-parallel_runtime_rspec.log


- name: Run brew tests
run: brew tests --online --coverage
env:
Expand Down
11 changes: 9 additions & 2 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@ def tests
Dir.glob("test/**/*_spec.rb")
end

parallel_rspec_log_path = if ENV["CI"]
"tests/parallel_runtime_rspec.log"
else
"#{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log"
end

Copy link
Member

Choose a reason for hiding this comment

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

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

parallel_args = if ENV["CI"]
%w[
%W[
--combine-stderr
--serialize-stdout
--runtime-log "#{parallel_rspec_log_path}"
]
else
%w[
Expand All @@ -120,7 +127,7 @@ def tests
--require spec_helper
--format NoSeedProgressFormatter
--format ParallelTests::RSpec::RuntimeLogger
--out #{HOMEBREW_CACHE}/tests/parallel_runtime_rspec.log
--out #{parallel_rspec_log_path}
]

bundle_args << "--format" << "RSpec::Github::Formatter" if ENV["GITHUB_ACTIONS"]
Expand Down