percy-client 1.8.0 → 1.9.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: 8a651ce1bbf67920df1daa189a18a7894da46b1f
4
- data.tar.gz: c29f76e3af43125d1863ca2f16f3d2fb3132bdc2
3
+ metadata.gz: dd70d6513c8a2d45939367a3b48f040b38994554
4
+ data.tar.gz: 690049af75d386c2d3bafcdb3256e09a30e3a485
5
5
  SHA512:
6
- metadata.gz: 1e6b08f666ae778440a40afa49e4070cb5d18515b3d93e2e2abf9d3386d379738d79c802863b14087d27f7ecefba25198c2e37054935553a93f1f60095aad262
7
- data.tar.gz: 696a2ab779b0cb1e9da0e51d67a289c484bf30b2cd894312ade5420252e1b3ae4337d6eb4364e4a177834707bfe958fb658f27479bd1fa6e146e909fd81f4b6b
6
+ metadata.gz: 6817e9f394b45bd4edfaaca95191cece4a89fb3871f31577d68c6b1844df4f7eafc12eec830e78e9389c8b9c06abc6e8fca7b8cdcaedbc18b5dff93f53efbdca
7
+ data.tar.gz: a8137680c8a45fbf3751a1766cdbb21413bf6ed2acbadbb80ac28747f72620f56d4d15bd62f2fc61a4028f873099a7c348d5144347bb68aadbdade2bbede5948
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- percy-client (1.8.0)
4
+ percy-client (1.9.0)
5
5
  faraday (>= 0.9)
6
6
  httpclient (>= 2.6)
7
7
 
@@ -22,6 +22,7 @@ module Percy
22
22
  return :codeship if ENV['CI_NAME'] && ENV['CI_NAME'] == 'codeship'
23
23
  return :drone if ENV['DRONE'] == 'true'
24
24
  return :semaphore if ENV['SEMAPHORE'] == 'true'
25
+ return :buildkite if ENV['BUILDKITE'] == 'true'
25
26
  end
26
27
 
27
28
  # @return [Hash] All commit data from the current commit. Might be empty if commit data could
@@ -75,6 +76,10 @@ module Percy
75
76
  ENV['DRONE_COMMIT']
76
77
  when :semaphore
77
78
  ENV['REVISION']
79
+ when :buildkite
80
+ # Buildkite mixes SHAs and non-SHAs in BUILDKITE_COMMIT, so we return null if non-SHA.
81
+ return if ENV['BUILDKITE_COMMIT'] == 'HEAD'
82
+ ENV['BUILDKITE_COMMIT']
78
83
  end
79
84
  end
80
85
 
@@ -107,6 +112,8 @@ module Percy
107
112
  ENV['DRONE_BRANCH']
108
113
  when :semaphore
109
114
  ENV['BRANCH_NAME']
115
+ when :buildkite
116
+ ENV['BUILDKITE_BRANCH']
110
117
  else
111
118
  _raw_branch_output
112
119
  end
@@ -176,6 +183,8 @@ module Percy
176
183
  ENV['CI_PULL_REQUEST']
177
184
  when :semaphore
178
185
  ENV['PULL_REQUEST_NUMBER']
186
+ when :buildkite
187
+ ENV['BUILDKITE_PULL_REQUEST'] if ENV['BUILDKITE_PULL_REQUEST'] != 'false'
179
188
  end
180
189
  end
181
190
 
@@ -193,6 +202,8 @@ module Percy
193
202
  ENV['CI_BUILD_NUMBER']
194
203
  when :semaphore
195
204
  ENV['SEMAPHORE_BUILD_NUMBER']
205
+ when :buildkite
206
+ ENV['BUILDKITE_BUILD_ID']
196
207
  end
197
208
  end
198
209
 
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  class Client
3
- VERSION = '1.8.0'
3
+ VERSION = '1.9.0'
4
4
  end
5
5
  end
@@ -60,6 +60,13 @@ RSpec.describe Percy::Client::Environment do
60
60
  ENV['SEMAPHORE_BUILD_NUMBER'] = nil
61
61
  ENV['SEMAPHORE_CURRENT_THREAD'] = nil
62
62
  ENV['PULL_REQUEST_NUMBER'] = nil
63
+
64
+ # Unset Buildkite CI vars
65
+ ENV['BUILDKITE'] = nil
66
+ ENV['BUILDKITE_COMMIT'] = nil
67
+ ENV['BUILDKITE_BRANCH'] = nil
68
+ ENV['BUILDKITE_PULL_REQUEST'] = nil
69
+ ENV['BUILDKITE_BUILD_ID'] = nil
63
70
  end
64
71
 
65
72
  before(:each) do
@@ -364,6 +371,41 @@ RSpec.describe Percy::Client::Environment do
364
371
  end
365
372
  end
366
373
  end
374
+ context 'in Buildkite' do
375
+ before(:each) do
376
+ ENV['BUILDKITE'] = 'true'
377
+ ENV['BUILDKITE_COMMIT'] = 'buildkite-commit-sha'
378
+ ENV['BUILDKITE_BRANCH'] = 'buildkite-branch'
379
+ ENV['BUILDKITE_PULL_REQUEST'] = 'false'
380
+ ENV['BUILDKITE_BUILD_ID'] = 'buildkite-build-id'
381
+ end
382
+
383
+ it 'has the correct properties' do
384
+ expect(Percy::Client::Environment.current_ci).to eq(:buildkite)
385
+ expect(Percy::Client::Environment.branch).to eq('buildkite-branch')
386
+ expect(Percy::Client::Environment._commit_sha).to eq('buildkite-commit-sha')
387
+ expect(Percy::Client::Environment.pull_request_number).to be_nil
388
+ expect(Percy::Client::Environment.repo).to eq('percy/percy-client') # From git, not env.
389
+ expect(Percy::Client::Environment.parallel_nonce).to eq('buildkite-build-id')
390
+ expect(Percy::Client::Environment.parallel_total_shards).to be_nil
391
+ end
392
+ context 'Pull Request build' do
393
+ before(:each) do
394
+ ENV['BUILDKITE_PULL_REQUEST'] = '123'
395
+ end
396
+ it 'has the correct properties' do
397
+ expect(Percy::Client::Environment.pull_request_number).to eq('123')
398
+ end
399
+ end
400
+ context 'UI-triggered HEAD build' do
401
+ before(:each) do
402
+ ENV['BUILDKITE_COMMIT'] = 'HEAD'
403
+ end
404
+ it 'has the correct properties' do
405
+ expect(Percy::Client::Environment._commit_sha).to be_nil
406
+ end
407
+ end
408
+ end
367
409
  describe 'local git repo methods' do
368
410
  describe '#commit' do
369
411
  it 'returns current local commit data' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.