Allow forked version of repo to run tests with knapsack_pro gem without

needed API key KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC.

Based on:
https://github.com/KnapsackPro/knapsack_pro-ruby#how-to-make-knapsack_pr
o-works-for-forked-repositories-of-my-project
This commit is contained in:
ArturT
2017-12-04 22:24:50 +01:00
parent b1c785408c
commit 27f46c9239
2 changed files with 10 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ before_script:
- bundle exec rake db:setup - bundle exec rake db:setup
script: script:
- "bundle exec rake assets:precompile RAILS_ENV=test" - "bundle exec rake assets:precompile RAILS_ENV=test"
- "bundle exec rake knapsack_pro:queue:rspec" - "bin/knapsack_pro_rspec"
env: env:
global: global:
- KNAPSACK_PRO_CI_NODE_TOTAL=2 - KNAPSACK_PRO_CI_NODE_TOTAL=2

9
bin/knapsack_pro_rspec Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC" = "" ]; then
KNAPSACK_PRO_ENDPOINT=https://api-disabled-for-fork.knapsackpro.com \
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=disabled-for-fork \
bundle exec rake knapsack_pro:rspec # use Regular Mode here always
else
# Queue Mode - dynamic tests allocation across CI nodes
bundle exec rake knapsack_pro:queue:rspec
fi