Allow to enable `rspec_profiling` for a branch on the CI
`rspec_profiling` will be enabled if the branch name includes `rspec-profile`. Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
7629c9ec57
commit
d6550d255c
|
@ -9,8 +9,14 @@ require 'rspec/rails'
|
||||||
require 'shoulda/matchers'
|
require 'shoulda/matchers'
|
||||||
require 'rspec/retry'
|
require 'rspec/retry'
|
||||||
|
|
||||||
if (ENV['RSPEC_PROFILING_POSTGRES_URL'] || ENV['RSPEC_PROFILING']) &&
|
rspec_profiling_is_configured =
|
||||||
(!ENV.has_key?('CI') || ENV['CI_COMMIT_REF_NAME'] == 'master')
|
ENV['RSPEC_PROFILING_POSTGRES_URL'] ||
|
||||||
|
ENV['RSPEC_PROFILING']
|
||||||
|
branch_can_be_profiled =
|
||||||
|
ENV['CI_COMMIT_REF_NAME'] == 'master' ||
|
||||||
|
ENV['CI_COMMIT_REF_NAME'] =~ /rspec-profile/
|
||||||
|
|
||||||
|
if rspec_profiling_is_configured && (!ENV.key?('CI') || branch_can_be_profiled)
|
||||||
require 'rspec_profiling/rspec'
|
require 'rspec_profiling/rspec'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue