Skip to content

Instantly share code, notes, and snippets.

@czj
Last active October 15, 2015 14:51
Show Gist options
  • Save czj/4df82efcb8f693499ac1 to your computer and use it in GitHub Desktop.
Save czj/4df82efcb8f693499ac1 to your computer and use it in GitHub Desktop.
CodeShip tests pipeline runner
# Enabled the 2 test pipelines architecture
# Don't send to CodeClimate because they would get 2 reports
# We use Circle CI to do the code coverage analysis :-)
#
# 2 pipelines:
# bundle exec rake test `find test/{controllers,integration} -type f -regex ".+_test.rb"`
# bundle exec rake test `find test/{decorators,helpers,jobs,lib,mailers,models,policies,workers} -type f -regex ".+_test.rb"`
#
# 1 pipeline:
# bundle exec rake test
# or
# rake test test/{controllers,integration,decorators,helpers,jobs,lib,mailers,models,policies,workers}/*_test.rb
#
# NON_CONTROLLER_DIRECTORIES=`find test -maxdepth 1 -type d | grep -v 'controllers$' | tr -d './' | sed 's/test//' | xargs echo`
#
NON_CONTROLLER_DIRECTORIES=` find test -maxdepth 1 -type d | grep -v 'controllers$' | xargs echo`
NON_CONTROLLER_TESTS=` find $NON_CONTROLLER_DIRECTORIES -type f -regex ".+\/[^\/]+_test\.rb$"`
CONTROLLER_NO_NAMESPACE_TESTS=` find test/controllers -maxdepth 1 -type f -regex ".+\/[^\/]+_test\.rb$"`
CONTROLLER_NAMESPACED_A_E_TESTS=`find test/controllers -mindepth 2 -type f -regex ".+\/[a-e][^\/]+_test\.rb$"`
CONTROLLER_NAMESPACED_F_Z_TESTS=`find test/controllers -mindepth 2 -type f -regex ".+\/[f-z][^\/]+_test\.rb$"`
#
# ALL TESTS EXCEPT ERP CONTROLLERS
#
bundle exec rake test $NON_CONTROLLER_TESTS $CONTROLLER_NO_NAMESPACE_TESTS $CONTROLLER_NAMESPACED_A_E_TESTS
#
# ERP CONTROLLERS (HEAVIEST)
#
bundle exec rake test $CONTROLLER_NAMESPACED_F_Z_TESTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment