Skip to content

Commit

Permalink
Resolve "rspec_profiling is enabled for MySQL"
Browse files Browse the repository at this point in the history
  • Loading branch information
rymai authored and Robert Speicher committed Apr 28, 2017
1 parent 2952a44 commit fe57708
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ variables:

before_script:
- bundle --version
- . scripts/utils.sh
- ./scripts/prepare_build.sh
- source scripts/utils.sh
- source scripts/prepare_build.sh

stages:
- prepare
Expand Down
8 changes: 4 additions & 4 deletions config/initializers/rspec_profiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def example_finished(*args)
RspecProfiling::Collectors::PSQL.prepend(RspecProfilingExt::PSQL)
config.collector = RspecProfiling::Collectors::PSQL
end
end

if ENV.has_key?('CI') && ENV['GITLAB_DATABASE'] == 'postgresql'
RspecProfiling::VCS::Git.prepend(RspecProfilingExt::Git)
RspecProfiling::Run.prepend(RspecProfilingExt::Run)
if ENV.key?('CI')
RspecProfiling::VCS::Git.prepend(RspecProfilingExt::Git)
RspecProfiling::Run.prepend(RspecProfilingExt::Run)
end
end
end
4 changes: 1 addition & 3 deletions scripts/prepare_build.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh

. scripts/utils.sh

export SETUP_DB=${SETUP_DB:-true}
Expand Down Expand Up @@ -32,7 +30,7 @@ sed -i 's/localhost/redis/g' config/resque.yml
cp config/gitlab.yml.example config/gitlab.yml

if [ "$USE_BUNDLE_INSTALL" != "false" ]; then
retry bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check
bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check
fi

# Only install knapsack after bundle install! Otherwise oddly some native
Expand Down
5 changes: 3 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
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/
ENV['GITLAB_DATABASE'] == 'postgresql' &&
(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'
Expand Down

0 comments on commit fe57708

Please sign in to comment.