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 all 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
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }}
restore-keys: ${{ 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
key: ${{ runner.os }}-parallel_runtime_rspec-${{ github.sha }}
restore-keys: ${{ runner.os }}-parallel_runtime_rspec-

- name: Run brew tests
run: brew tests --online --coverage
env:
Expand Down
17 changes: 15 additions & 2 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,23 @@ def tests
Dir.glob("test/**/*_spec.rb")
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}/#{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 +133,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