Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
1e8f6d79
Unverified
Commit
1e8f6d79
authored
3 years ago
by
Mike McQuaid
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #11598 from Homebrew/buildpulse-retry
Tweak BuildPulse/`rspec-retry` logic
parents
04532cb6
a4c2e0e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.github/workflows/tests.yml
+14
-1
14 additions, 1 deletion
.github/workflows/tests.yml
Library/Homebrew/dev-cmd/tests.rb
+32
-0
32 additions, 0 deletions
Library/Homebrew/dev-cmd/tests.rb
Library/Homebrew/test/spec_helper.rb
+24
-14
24 additions, 14 deletions
Library/Homebrew/test/spec_helper.rb
with
70 additions
and
15 deletions
.github/workflows/tests.yml
+
14
−
1
View file @
1e8f6d79
...
...
@@ -311,11 +311,24 @@ jobs:
restore-keys
:
${{ runner.os }}-parallel_runtime_rspec-
-
name
:
Run brew tests
run
:
brew tests --online --coverage
run
:
|
# Retry multiple times when using BuildPulse to detect and submit
# flakiness (because rspec-retry is disabled).
if [ -n "$HOMEBREW_BUILDPULSE_ACCESS_KEY_ID" ]; then
brew tests --online --coverage || \
brew tests --online --coverage || \
brew tests --online --coverage
else
brew tests --online --coverage
fi
env
:
HOMEBREW_GITHUB_API_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
# These cannot be queried at the macOS level on GitHub Actions.
HOMEBREW_LANGUAGES
:
en-GB
HOMEBREW_BUILDPULSE_ACCESS_KEY_ID
:
${{ secrets.BUILDPULSE_ACCESS_KEY_ID }}
HOMEBREW_BUILDPULSE_SECRET_ACCESS_KEY
:
${{ secrets.BUILDPULSE_SECRET_ACCESS_KEY }}
HOMEBREW_BUILDPULSE_ACCOUNT_ID
:
1503512
HOMEBREW_BUILDPULSE_REPOSITORY_ID
:
53238813
-
run
:
brew test-bot --only-formulae --test-default-formula
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/dev-cmd/tests.rb
+
32
−
0
View file @
1e8f6d79
...
...
@@ -36,6 +36,32 @@ module Homebrew
end
end
def
use_buildpulse?
return
@use_buildpulse
if
defined?
(
@use_buildpulse
)
@use_buildpulse
=
ENV
[
"HOMEBREW_BUILDPULSE_ACCESS_KEY_ID"
].
present?
&&
ENV
[
"HOMEBREW_BUILDPULSE_SECRET_ACCESS_KEY"
].
present?
&&
ENV
[
"HOMEBREW_BUILDPULSE_ACCOUNT_ID"
].
present?
&&
ENV
[
"HOMEBREW_BUILDPULSE_REPOSITORY_ID"
].
present?
end
def
run_buildpulse
require
"formula"
unless
Formula
[
"buildpulse-test-reporter"
].
any_version_installed?
ohai
"Installing `buildpulse-test-reporter` for reporting test flakiness..."
safe_system
HOMEBREW_BREW_FILE
,
"install"
,
"buildpulse-test-reporter"
end
ENV
[
"BUILDPULSE_ACCESS_KEY_ID"
]
=
ENV
[
"HOMEBREW_BUILDPULSE_ACCESS_KEY_ID"
]
ENV
[
"BUILDPULSE_SECRET_ACCESS_KEY"
]
=
ENV
[
"HOMEBREW_BUILDPULSE_SECRET_ACCESS_KEY"
]
safe_system
Formula
[
"buildpulse-test-reporter"
].
opt_bin
/
"buildpulse-test-reporter"
,
"submit"
,
"Library/Homebrew/test/junit"
,
"--account-id"
,
ENV
[
"HOMEBREW_BUILDPULSE_ACCOUNT_ID"
],
"--repository-id"
,
ENV
[
"HOMEBREW_BUILDPULSE_REPOSITORY_ID"
]
end
def
tests
args
=
tests_args
.
parse
...
...
@@ -154,12 +180,18 @@ module Homebrew
# Let `bundle` in PATH find its gem.
ENV
[
"GEM_PATH"
]
=
"
#{
ENV
[
"GEM_PATH"
]
}
:
#{
gem_user_dir
}
"
# Submit test flakiness information using BuildPulse
# BUILDPULSE used in spec_helper.rb
ENV
[
"BUILDPULSE"
]
=
"1"
if
use_buildpulse?
if
parallel
system
"bundle"
,
"exec"
,
"parallel_rspec"
,
*
parallel_args
,
"--"
,
*
bundle_args
,
"--"
,
*
files
else
system
"bundle"
,
"exec"
,
"rspec"
,
*
bundle_args
,
"--"
,
*
files
end
run_buildpulse
if
use_buildpulse?
return
if
$CHILD_STATUS
.
success?
Homebrew
.
failed
=
true
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/spec_helper.rb
+
24
−
14
View file @
1e8f6d79
...
...
@@ -77,25 +77,35 @@ RSpec.configure do |config|
c
.
max_formatted_output_length
=
200
end
# Use rspec-retry in CI.
# Use rspec-retry to handle flaky tests.
config
.
default_sleep_interval
=
1
# Don't make retries as noisy unless in CI.
if
ENV
[
"CI"
]
config
.
verbose_retry
=
true
config
.
display_try_failure_messages
=
true
config
.
default_retry_count
=
2
config
.
default_sleep_interval
=
1
end
config
.
around
(
:each
,
:integration_test
)
do
|
example
|
example
.
metadata
[
:timeout
]
||=
120
example
.
run
end
# Don't want the nicer default retry behaviour when using BuildPulse to
# identify flaky tests.
config
.
default_retry_count
=
2
unless
ENV
[
"BUILDPULSE"
]
config
.
around
(
:each
,
:needs_network
)
do
|
example
|
example
.
metadata
[
:timeout
]
||=
120
example
.
metadata
[
:retry
]
||=
4
example
.
metadata
[
:retry_wait
]
||=
2
example
.
metadata
[
:exponential_backoff
]
||=
true
example
.
run
end
# Increase timeouts for integration tests (as we expect them to take longer).
config
.
around
(
:each
,
:integration_test
)
do
|
example
|
example
.
metadata
[
:timeout
]
||=
120
example
.
run
end
config
.
around
(
:each
,
:needs_network
)
do
|
example
|
example
.
metadata
[
:timeout
]
||=
120
# Don't want the nicer default retry behaviour when using BuildPulse to
# identify flaky tests.
example
.
metadata
[
:retry
]
||=
4
unless
ENV
[
"BUILDPULSE"
]
example
.
metadata
[
:retry_wait
]
||=
2
example
.
metadata
[
:exponential_backoff
]
||=
true
example
.
run
end
# Never truncate output objects.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment