knapsack_pro 0.49.0 → 0.50.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46edc2a928b66e0048731ce1020e9fe35987d4c8
4
- data.tar.gz: 39ea37466eaaa96fcd492c7061b6afdb918f5ea0
3
+ metadata.gz: 48df13c28fe99e21992658e00e7060cd95ceceb9
4
+ data.tar.gz: fc702b3965c812d79fa8c936fdb234c1a1c90cd0
5
5
  SHA512:
6
- metadata.gz: 23c98e6243dd263c1e23c3dbd4fa3126486fe3a15586ef5411948e5b6cfe7905bb21fa200b3833664940832705e0bcdbb201c1b929c87347bc4e00da79a073d5
7
- data.tar.gz: fc7fecf7c7e5985fa018c5e3098808a2ff2abc43f9ddc01333c98b5b834256a88093a4cb82482db3eccb6f03d88c454702b9de20b257b7b66d99e2a876291339
6
+ metadata.gz: 7c855dd55ca4d8911d9b747e63a0d98911674b00fe40696efe4e840950d9892e03e3983d4be87ef75f1e58874e289ee6cce5c8eeea331f1d5dccc9dd70014b4a
7
+ data.tar.gz: b7811b63a66b9b0f9c133dbf1151a66ea3b6ceb46ae4184ffb6d733573a320281fd534cbedda9ad8b674ddb0b792e657c37cbe98a9c1cb12a280226b76d7bf98
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.50.0
6
+
7
+ * Add support for Codeship environment variables.
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/51
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.49.0...v0.50.0
12
+
5
13
  ### 0.49.0
6
14
 
7
15
  * Show short warning for not executed test files on CI node. Show explanation in debug logs.
data/README.md CHANGED
@@ -97,6 +97,7 @@ The knapsack_pro has also [queue mode](#queue-mode) to get an optimal test suite
97
97
  - [Info for semaphoreapp.com users](#info-for-semaphoreappcom-users)
98
98
  - [Info for buildkite.com users](#info-for-buildkitecom-users)
99
99
  - [Info for Gitlab CI users](#info-for-gitlab-ci-users)
100
+ - [Info for codeship.com users](#info-for-codeshipcom-users)
100
101
  - [Info for snap-ci.com users](#info-for-snap-cicom-users)
101
102
  - [Info for Jenkins users](#info-for-jenkins-users)
102
103
  - [FAQ](#faq)
@@ -783,6 +784,38 @@ test_ci_node_1:
783
784
 
784
785
  Remember to add API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` to [Secret Variables](https://gitlab.com/help/ci/variables/README.md#secret-variables) in `Gitlab CI Settings -> CI/CD Pipelines -> Secret Variables`.
785
786
 
787
+ #### Info for codeship.com users
788
+
789
+ Codeship does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each [parallel test pipeline](https://documentation.codeship.com/basic/builds-and-configuration/parallel-tests/#using-parallel-test-pipelines). Below is an example for 2 parallel test pipelines.
790
+
791
+ Configure test pipelines (1/2 used)
792
+
793
+ ```
794
+ # first CI node running in parallel
795
+
796
+ # Cucumber tests in Knapsack Pro Regular Mode (deterministic test suite split)
797
+ KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 bundle exec rake knapsack_pro:cucumber
798
+
799
+ # RSpec tests in Knapsack Pro Queue Mode (dynamic test suite split)
800
+ # It will autobalance bulid because it is executed after Cucumber tests.
801
+ KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 bundle exec rake knapsack_pro:queue:rspec
802
+ ```
803
+
804
+ Configure test pipelines (2/2 used)
805
+
806
+ ```
807
+ # second CI node running in parallel
808
+
809
+ # Cucumber tests in Knapsack Pro Regular Mode (deterministic test suite split)
810
+ KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 bundle exec rake knapsack_pro:cucumber
811
+
812
+ # RSpec tests in Knapsack Pro Queue Mode (dynamic test suite split)
813
+ # It will autobalance bulid because it is executed after Cucumber tests.
814
+ KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 bundle exec rake knapsack_pro:queue:rspec
815
+ ```
816
+
817
+ Remember to add API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` to `Environment` page of your project settings in Codeship.
818
+
786
819
  #### Info for snap-ci.com users
787
820
 
788
821
  Knapsack Pro supports snap-ci.com ENVs `SNAP_WORKER_TOTAL` and `SNAP_WORKER_INDEX`. The only thing you need to do is to configure number of workers for your project in configuration settings in order to enable parallelism. Next thing is to set below commands to be executed in your stage:
data/lib/knapsack_pro.rb CHANGED
@@ -18,6 +18,7 @@ require_relative 'knapsack_pro/config/ci/semaphore'
18
18
  require_relative 'knapsack_pro/config/ci/buildkite'
19
19
  require_relative 'knapsack_pro/config/ci/travis'
20
20
  require_relative 'knapsack_pro/config/ci/snap_ci'
21
+ require_relative 'knapsack_pro/config/ci/codeship'
21
22
  require_relative 'knapsack_pro/config/env'
22
23
  require_relative 'knapsack_pro/config/env_generator'
23
24
  require_relative 'knapsack_pro/client/api/action'
@@ -0,0 +1,31 @@
1
+ module KnapsackPro
2
+ module Config
3
+ module CI
4
+ class Codeship < Base
5
+ def node_total
6
+ # not provided
7
+ end
8
+
9
+ def node_index
10
+ # not provided
11
+ end
12
+
13
+ def node_build_id
14
+ ENV['CI_BUILD_NUMBER']
15
+ end
16
+
17
+ def commit_hash
18
+ ENV['CI_COMMIT_ID']
19
+ end
20
+
21
+ def branch
22
+ ENV['CI_BRANCH']
23
+ end
24
+
25
+ def project_dir
26
+ # not provided
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.49.0'
2
+ VERSION = '0.50.0'
3
3
  end
@@ -0,0 +1,66 @@
1
+ describe KnapsackPro::Config::CI::Codeship do
2
+ let(:env) { {} }
3
+
4
+ before do
5
+ stub_const('ENV', env)
6
+ end
7
+
8
+ it { should be_kind_of KnapsackPro::Config::CI::Base }
9
+
10
+ describe '#node_total' do
11
+ subject { described_class.new.node_total }
12
+
13
+ it { should be nil }
14
+ end
15
+
16
+ describe '#node_index' do
17
+ subject { described_class.new.node_index }
18
+
19
+ it { should be nil }
20
+ end
21
+
22
+ describe '#node_build_id' do
23
+ subject { described_class.new.node_build_id }
24
+
25
+ context 'when environment exists' do
26
+ let(:env) { { 'CI_BUILD_NUMBER' => 2013 } }
27
+ it { should eql 2013 }
28
+ end
29
+
30
+ context "when environment doesn't exist" do
31
+ it { should be nil }
32
+ end
33
+ end
34
+
35
+ describe '#commit_hash' do
36
+ subject { described_class.new.commit_hash }
37
+
38
+ context 'when environment exists' do
39
+ let(:env) { { 'CI_COMMIT_ID' => 'a22aec3ee5d334fd658da35646b42bc5' } }
40
+ it { should eql 'a22aec3ee5d334fd658da35646b42bc5' }
41
+ end
42
+
43
+ context "when environment doesn't exist" do
44
+ it { should be nil }
45
+ end
46
+ end
47
+
48
+ describe '#branch' do
49
+ subject { described_class.new.branch }
50
+
51
+ context 'when environment exists' do
52
+ let(:env) { { 'CI_BRANCH' => 'master' } }
53
+ it { should eql 'master' }
54
+ end
55
+
56
+ context "when environment doesn't exist" do
57
+ it { should be nil }
58
+ end
59
+ end
60
+
61
+ describe '#project_dir' do
62
+ subject { described_class.new.project_dir }
63
+
64
+ it { should be nil }
65
+ end
66
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.49.0
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -221,6 +221,7 @@ files:
221
221
  - lib/knapsack_pro/config/ci/base.rb
222
222
  - lib/knapsack_pro/config/ci/buildkite.rb
223
223
  - lib/knapsack_pro/config/ci/circle.rb
224
+ - lib/knapsack_pro/config/ci/codeship.rb
224
225
  - lib/knapsack_pro/config/ci/gitlab_ci.rb
225
226
  - lib/knapsack_pro/config/ci/semaphore.rb
226
227
  - lib/knapsack_pro/config/ci/snap_ci.rb
@@ -292,6 +293,7 @@ files:
292
293
  - spec/knapsack_pro/config/ci/base_spec.rb
293
294
  - spec/knapsack_pro/config/ci/buildkite_spec.rb
294
295
  - spec/knapsack_pro/config/ci/circle_spec.rb
296
+ - spec/knapsack_pro/config/ci/codeship_spec.rb
295
297
  - spec/knapsack_pro/config/ci/gitlab_ci_spec.rb
296
298
  - spec/knapsack_pro/config/ci/semaphore_spec.rb
297
299
  - spec/knapsack_pro/config/ci/snap_ci_spec.rb
@@ -389,6 +391,7 @@ test_files:
389
391
  - spec/knapsack_pro/config/ci/base_spec.rb
390
392
  - spec/knapsack_pro/config/ci/buildkite_spec.rb
391
393
  - spec/knapsack_pro/config/ci/circle_spec.rb
394
+ - spec/knapsack_pro/config/ci/codeship_spec.rb
392
395
  - spec/knapsack_pro/config/ci/gitlab_ci_spec.rb
393
396
  - spec/knapsack_pro/config/ci/semaphore_spec.rb
394
397
  - spec/knapsack_pro/config/ci/snap_ci_spec.rb