README.md in knapsack_pro-0.1.1 vs README.md in knapsack_pro-0.1.2

- old
+ new

@@ -34,11 +34,11 @@ * knapsack_pro will run test files which got from API * after tests finished knapsack_pro will send information about time execution of each file to API http://docs.knapsackpro.com/api/v1/#build_subsets_post so data can be used for future test runs # Requirements -* >= Ruby 2.0 +* >= Ruby 2.1 (because gem uses required keyword arguments in ruby) # Table of Contents <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> @@ -55,10 +55,12 @@ - [Set API key token](#set-api-key-token) - [Set knapsack_pro command to execute tests](#set-knapsack_pro-command-to-execute-tests) - [Extra configuration for CI server](#extra-configuration-for-ci-server) - [Info about ENV variables](#info-about-env-variables) - [Repository adapter](#repository-adapter) + - [When you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (optional)](#when-you-set-global-variable-knapsack_pro_repository_adaptergit-optional) + - [When you NOT set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER` (default)](#when-you-not-set-global-variable-knapsack_pro_repository_adapter-default) - [Environment variables for debugging gem](#environment-variables-for-debugging-gem) - [Passing arguments to rake task](#passing-arguments-to-rake-task) - [Passing arguments to rspec](#passing-arguments-to-rspec) - [Passing arguments to cucumber](#passing-arguments-to-cucumber) - [Passing arguments to minitest](#passing-arguments-to-minitest) @@ -200,19 +202,24 @@ `KNAPSACK_PRO_CI_NODE_INDEX` - index of current CI node starts from 0. Second CI node should have `KNAPSACK_PRO_CI_NODE_INDEX=1`. #### Repository adapter -`KNAPSACK_PRO_REPOSITORY_ADAPTER` - When it has value `git` then your local version of git on CI server will be used to get info about branch name, commit hash and project directory path. -By default this variable has no value so knapsack_pro will try to get those info from [supported CI](#supported-ci-providers) (CI providers have branch, commit, project directory stored as environment variables). In case when you use other CI provider like Jenkins then please set below variables on your own. +##### When you set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER=git` (optional) +`KNAPSACK_PRO_REPOSITORY_ADAPTER` - When it has value `git` then your local version of git on CI server will be used to get info about branch name and commit hash. You need to set also `KNAPSACK_PRO_PROJECT_DIR` with project directory path. + +`KNAPSACK_PRO_PROJECT_DIR` - Path to the project on CI node for instance `/home/ubuntu/my-app-repository`. It should be main directory of your repository. + +##### When you NOT set global variable `KNAPSACK_PRO_REPOSITORY_ADAPTER` (default) + +By default `KNAPSACK_PRO_REPOSITORY_ADAPTER` variable has no value so knapsack_pro will try to get info about branch name and commit hash from [supported CI](#supported-ci-providers) (CI providers have branch, commit, project directory stored as environment variables). In case when you use other CI provider like Jenkins then please set below variables on your own. + `KNAPSACK_PRO_BRANCH` - It's branch name. You run tests on this branch. `KNAPSACK_PRO_COMMIT_HASH` - Commit hash. You run tests for this commit. -`KNAPSACK_PRO_PROJECT_DIR` - Path to the project on CI node for instance `/home/ubuntu/my-app-repository`. It should be main directory of your repository. - #### Environment variables for debugging gem `KNAPSACK_PRO_ENDPOINT` - Default value is `http://api.knapsackpro.com` which is endpoint for [Knapsack Pro API](http://docs.knapsackpro.com). `KNAPSACK_PRO_MODE` - Default value is `production`. When mode is `development` then endpoint is `http://api.knapsackpro.dev:3000`. When mode is `test` then endpoint is `http://api-staging.knapsackpro.com`. @@ -257,15 +264,21 @@ ### Supported CI providers #### Info for CircleCI users -If you are using circleci.com you can omit `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX`. Knapsack Pro will use `KNAPSACK_PRO_CIRCLE_NODE_TOTAL` and `KNAPSACK_PRO_CIRCLE_NODE_INDEX` provided by CircleCI. +If you are using circleci.com you can omit `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX`. Knapsack Pro will use `CIRCLE_NODE_TOTAL` and `CIRCLE_NODE_INDEX` provided by CircleCI. Here is an example for test configuration in your `circleci.yml` file. ```yaml +machine: + environment: + # Tokens should be set in CircleCI settings to avoid expose tokens in build logs + # KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: rspec-token + # KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER: cucumber-token + # KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: minitest-token test: override: # Step for RSpec - bundle exec rake knapsack_pro:rspec: parallel: true # Caution: there are 8 spaces indentation! @@ -295,41 +308,26 @@ # Step for Minitest - "bundle exec rake knapsack_pro:minitest" env: - - KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 - - KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 -``` - -If you want to have some global ENVs and matrix of ENVs then do it like this: - -```yaml -script: - # Step for RSpec - - "bundle exec rake knapsack_pro:rspec" - - # Step for Cucumber - - "bundle exec rake knapsack_pro:cucumber" - - # Step for Minitest - - "bundle exec rake knapsack_pro:minitest" - -env: global: - - RAILS_ENV=test - - MY_GLOBAL_VAR=123 + # tokens should be set in travis settings in web interface to avoid expose tokens in build logs + - KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=rspec-token + - KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER=cucumber-token + - KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST=minitest-token + - KNAPSACK_PRO_CI_NODE_TOTAL=2 matrix: - KNAPSACK_PRO_CI_NODE_INDEX=0 - KNAPSACK_PRO_CI_NODE_INDEX=1 ``` Such configuration will generate matrix with 2 following ENV rows: - KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 RAILS_ENV=test MY_GLOBAL_VAR=123 - KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 RAILS_ENV=test MY_GLOBAL_VAR=123 + KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=rspec-token KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER=cucumber-token KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST=minitest-token + KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=rspec-token KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER=cucumber-token KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST=minitest-token More info about global and matrix ENV configuration in [travis docs](http://docs.travis-ci.com/user/build-configuration/#Environment-variables). #### Info for semaphoreapp.com users @@ -351,10 +349,12 @@ ## Step for Minitest bundle exec rake knapsack_pro:minitest Tests will be split across threads. +Please remember to set up token like `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` as global environment. + #### Info for buildkite.com users Knapsack Pro supports buildkite ENVs `BUILDKITE_PARALLEL_JOB_COUNT` and `BUILDKITE_PARALLEL_JOB`. The only thing you need to do is to configure the parallelism parameter in your build step and run the appropiate command in your build # Step for RSpec @@ -363,9 +363,11 @@ # Step for Cucumber bundle exec rake knapsack_pro:cucumber # Step for Minitest bundle exec rake knapsack_pro:minitest + +Please remember to set up token like `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` as global environment. ## Gem tests ### Spec