RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
Development Lead at
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
... now we can deploy and go home
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
# Add gem in Gemfile
group :test, :development do
gem "knapsack"
end
# Tasks in Rakefile
Knapsack.load_tasks if defined?(Knapsack)
# Setup in spec_helper.rb
if ENV["CI"]
require "knapsack"
Knapsack::Adapters::RSpecAdapter.bind
end
RUG::B Sep 2018, by @zalesz
# in .travis.yml replace default script with following
script:
- "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
# 3. Setup .travis.yml to run multiple jobs in parallel
env:
global:
- RAILS_ENV=test
- CI_NODE_TOTAL=4 # total number of workers
matrix:
- CI_NODE_INDEX=0
- CI_NODE_INDEX=1
- CI_NODE_INDEX=2
- CI_NODE_INDEX=3
script:
- "bundle exec rake knapsack:rspec"
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
$ CI_NODE_TOTAL=8 \
CI_NODE_INDEX=5 \
CI=true \
bundle exec rake "knapsack:rspec[--seed 4049]"
RUG::B Sep 2018, by @zalesz
CI_NODE_TOTAL=8 CI_NODE_INDEX=5 CI=true \
bundle exec rake "knapsack:rspec[--seed 4049 --bisect=verbose]"
# =>
Report specs: # list of files selected by knapsack
Bisect started using options: "--seed 2463 --default-path spec --
spec/foo_spec.rb etc"
Running suite to find failures... (5 minutes 0 seconds)
- Failing examples (3):
- ./spec/controllers/api/v2/rooms_controller_spec.rb[1:1:1:2:2:1]
- ./spec/features/attachment_spec.rb[1:2]
- ./spec/features/workflow_spec.rb[1:1]
- Non-failing examples (924):
- rest of the files
Checking that failure(s) are order-dependent..
- Running: rspec (50.83 seconds)
- Failure appears to be order-dependent
Round 1: bisecting over non-failing examples 1-924
- Multiple culprits detected - splitting candidates
Round 2: bisecting over non-failing examples 1-462
...
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
RUG::B Sep 2018, by @zalesz
cache:
bundler: true
directories:
- ~/bin
# install only test dependencies
bundler_args: "--without development production"
# use built in tools
addons:
postgresql: '9.6'
chrome: stable
before_install:
- ./bin/ci_install_chromedriver
RUG::B Sep 2018, by @zalesz
#!/bin/bash
set -Eeuo pipefail
VERSION="2.41"
NAME="chromedriver_${VERSION}"
STORAGE=https://chromedriver.storage.googleapis.com
install_chromedriver() {
rm -f ~/bin/chromedriver*
wget ${STORAGE}/${VERSION}/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
rm chromedriver_linux64.zip
mv -f chromedriver ~/bin/${NAME}
chmod +x ~/bin/${NAME}
ln -s ~/bin/${NAME} ~/bin/chromedriver
}
[ -e ~/bin/${NAME} ] || install_chromedriver
RUG::B Sep 2018, by @zalesz
Links:
RUG::B Sep 2018, by @zalesz