rspec-buildkite 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a13c43c0cd2a422336df5a96156ea82150e565d5ee6884811eb184eae860bf37
4
- data.tar.gz: f59368d071f26d1eb94aae5d1dbb3bfa92a9524a2d6a157ae853c2eac054e981
3
+ metadata.gz: f70f8313f4a0be804bbc012021fd7859569a59283198ed75e77a64732eae2353
4
+ data.tar.gz: 70e326e3d66915b3c10fc2b0fcec1026325e5bc4862a58b4d53d9b73d6bcbd2d
5
5
  SHA512:
6
- metadata.gz: 3f9584918aedfd8a622dd108b56db43a32add0092af4b2650d55f06de54b2943c42cf96053bf9b2c050de435d76f6c96b8c78e39cfd9ac8e28863897d6c84f5b
7
- data.tar.gz: 47564c8f5c724d8f3a5452333dc5bc529fadb021da90e495a15832d66b8c71884892d4f1410701347d31767bfa4b3b37ae92425a6bf8a388978c6f9bb5b8e95e
6
+ metadata.gz: c9bc1943b27689513e94edae07d9a16264355e606c8fa16030bb41e8cf18f8ad4cfd3c4c46ab9d6364ea6358f2d70c5d48a8f931d1ccdfd5eb5fd326b290f2ad
7
+ data.tar.gz: 99f2f2d81331c32dc1c0bca2a0e97b924e4f2b56603513581782495cbedf777f5b598e85bdab11b2d19f88835cb3a545d1b832373eea0d6cab18ea25ada011fd
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -38,6 +38,22 @@ Add it to your `.rspec` alongside your favorite formatter:
38
38
 
39
39
  Now run your specs on Buildkite!
40
40
 
41
+ ### Docker & Docker Compose
42
+
43
+ If you run your RSpec builds inside Docker or Docker Compose then you'll need to make sure that buildkite-agent is available inside your container, and that some environment variables are propagated into the running containers. The buildkite-agent binary can be baked into your image, or mounted in as a volume. If you're using [the docker-compose-buildkite-plugin][dcbp] you can pass the environment using [plugin configuration][dcbp-env]. Or you can add them to the [environment section][dc-env] in your `docker-compose.yml`, or supply [env arguments][d-env] to your docker command.
44
+
45
+ The following environment variables are required:
46
+
47
+ - `BUILDKITE`
48
+ - `BUILDKITE_BUILD_URL`
49
+ - `BUILDKITE_JOB_ID`
50
+ - `BUILDKITE_AGENT_ACCESS_TOKEN`
51
+
52
+ [dcbp]: https://github.com/buildkite-plugins/docker-compose-buildkite-plugin
53
+ [dcbp-env]: https://github.com/buildkite-plugins/docker-compose-buildkite-plugin#environment
54
+ [dc-env]: https://docs.docker.com/compose/environment-variables/
55
+ [d-env]: https://docs.docker.com/engine/reference/run/#env-environment-variables
56
+
41
57
  ## Development
42
58
 
43
59
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -46,7 +62,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
46
62
 
47
63
  ## Contributing
48
64
 
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/sj26/rspec-buildkite.
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/buildkite/rspec-buildkite.
50
66
 
51
67
  ## License
52
68
 
@@ -27,7 +27,9 @@ module RSpec::Buildkite
27
27
  end
28
28
 
29
29
  def example_failed(notification)
30
- @queue.push(notification) if @queue
30
+ return if @queue.nil? || RSpec.world.wants_to_quit
31
+
32
+ @queue.push(notification)
31
33
  end
32
34
 
33
35
  private
@@ -37,17 +39,19 @@ module RSpec::Buildkite
37
39
  break if notification == :close
38
40
 
39
41
  if notification
40
- system "buildkite-agent", "annotate",
42
+ system("buildkite-agent", "annotate",
41
43
  "--context", "rspec",
42
44
  "--style", "error",
43
45
  "--append",
44
46
  format_failure(notification),
45
47
  out: :close # only display errors
48
+ ) or raise "buildkite-agent failed to run: #{$?}#{" (command not found)" if $?.exitstatus == 127}"
46
49
  end
47
50
  end
48
51
  rescue
49
- puts "Warning: Couldn't create Buildkite annotations:"
50
- puts " " << $!.to_s, " " << $!.backtrace.join("\n ")
52
+ $stderr.puts "Warning: Couldn't create Buildkite annotations:\n" <<
53
+ " #{$!.to_s}\n" <<
54
+ " #{$!.backtrace.join("\n ")}"
51
55
  end
52
56
 
53
57
  def format_failure(notification)
@@ -56,11 +60,19 @@ module RSpec::Buildkite
56
60
  job_url = "#{build_url}##{job_id}"
57
61
 
58
62
  %{<details>\n} <<
59
- %{<summary>#{notification.description.encode(:xml => :text)}</summary>\n\n} <<
60
- %{<code><pre class="term">#{Recolorizer.recolorize(notification.colorized_message_lines.join("\n").encode(:xml => :text))}</pre></code>\n\n} <<
61
- %{in <a href=#{job_url.encode(:xml => :attr)}>Job ##{job_id.encode(:xml => :text)}</a>\n} <<
63
+ %{<summary>#{notification.description.encode(:xml => :text)}</summary>\n} <<
64
+ %{<pre class="term">#{Recolorizer.recolorize(notification.colorized_message_lines.join("\n").encode(:xml => :text))}</pre>\n} <<
65
+ format_rerun(notification) <<
66
+ %{<p>in <a href=#{job_url.encode(:xml => :attr)}>Job ##{job_id.encode(:xml => :text)}</a></p>\n} <<
62
67
  %{</details>} <<
63
68
  %{\n\n\n}
64
69
  end
70
+
71
+ def format_rerun(notification)
72
+ %{<pre class="term">} <<
73
+ %{<span class="term-fg31">rspec #{notification.example.location_rerun_argument.encode(:xml => :text)}</span>} <<
74
+ %{ <span class="term-fg36"># #{notification.example.full_description.encode(:xml => :text)}</span>} <<
75
+ %{</pre>\n}
76
+ end
65
77
  end
66
78
  end
@@ -49,52 +49,5 @@ module RSpec::Buildkite
49
49
  end
50
50
  end << ("</span>" * level)
51
51
  end
52
- # Re-color an ANSI-colorized string using terminal CSS classes:
53
- # https://github.com/buildkite/terminal/blob/05a77905c468b9150cac41298fdb8a0735024d42/style.go#L34
54
- def recolorize(string)
55
- level = 0
56
- string.gsub(/\e\[(\d+(?:;\d+)*)m/) do
57
- "".tap do |buffer|
58
- codes = $1.split(";").map(&:to_i)
59
-
60
- classes = []
61
- while code = codes.shift
62
- case code
63
- when 0
64
- classes.clear
65
- buffer << ("</span>" * level)
66
- level = 0
67
- when 1..5, 9, 30..37
68
- classes << "term-fg#{code}"
69
- when 38
70
- if codes[0] == 5
71
- codes.shift
72
- if codes[0]
73
- classes << "term-fgx#{codes.shift}"
74
- end
75
- end
76
- when 40..47
77
- classes << "term-bg#{code}"
78
- when 48
79
- if codes[0] == 5
80
- codes.shift
81
- if codes[0]
82
- classes << "term-bgx#{codes.shift}"
83
- end
84
- end
85
- when 90..97
86
- classes << "term-fgi#{code}"
87
- when 100..107
88
- classes << "term-bgi#{code}"
89
- end
90
- end
91
-
92
- if classes.any?
93
- level += 1
94
- buffer << %{<span class=#{classes.map { |klass| klass }.join(" ").encode(:xml => :attr)}>}
95
- end
96
- end
97
- end << ("</span>" * level)
98
- end
99
52
  end
100
53
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Buildkite
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,34 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-buildkite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDKDCCAhCgAwIBAgIBBTANBgkqhkiG9w0BAQUFADA6MQ0wCwYDVQQDDARzajI2
14
- MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0x
15
- NzA3MzEwNTQ3MDVaFw0xODA3MzEwNTQ3MDVaMDoxDTALBgNVBAMMBHNqMjYxFDAS
13
+ MIIDXDCCAkSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
14
+ MRQwEgYKCZImiZPyLGQBGRYEc2oyN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 KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABo20w
23
+ azAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
24
+ m3ZsDWrNC80wGAYDVR0RBBEwD4ENc2oyNkBzajI2LmNvbTAYBgNVHRIEETAPgQ1z
25
+ ajI2QHNqMjYuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQCsa7k3TABBcyXotr3yCq6f
26
+ xsgbMG9FR71c4wRgVNQi9O3jN64fQBbxo//BQlHfPCjs1CeU4es9xdQFfhqXAPXG
27
+ P7mK3+qd5jObjh6l3/rDKrTXNS+P+YO/1frlZ6xPjCA8XgGc4y0rhAjZnVBDV6t1
28
+ kmdtEmue1s1OxaMakr78XRZDxEuAeLM5fg8MYnlOFygEcAH6lZkTjXavY7s9MXRB
29
+ AAMioxgB6J5QhXQ42OSWIzwHZIbSv3DV9Lf5sde50HIW5f9u5jn29TUGDhSWYKkh
30
+ LDvy9dfwMMOdIZi75Q8SBBib84AuwhMHIlUv9FcHhh3dXsDDYkrVrpUAwCsG6yCm
30
31
  -----END CERTIFICATE-----
31
- date: 2018-05-26 00:00:00.000000000 Z
32
+ date: 2022-07-08 00:00:00.000000000 Z
32
33
  dependencies:
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: rspec-core
@@ -50,14 +51,14 @@ dependencies:
50
51
  requirements:
51
52
  - - "~>"
52
53
  - !ruby/object:Gem::Version
53
- version: '1.16'
54
+ version: '2.3'
54
55
  type: :development
55
56
  prerelease: false
56
57
  version_requirements: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - "~>"
59
60
  - !ruby/object:Gem::Version
60
- version: '1.16'
61
+ version: '2.3'
61
62
  - !ruby/object:Gem::Dependency
62
63
  name: rake
63
64
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +115,7 @@ dependencies:
114
115
  - - ">="
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
117
- description:
118
+ description:
118
119
  email: sj26@sj26.com
119
120
  executables: []
120
121
  extensions: []
@@ -126,17 +127,17 @@ files:
126
127
  - lib/rspec/buildkite/annotation_formatter.rb
127
128
  - lib/rspec/buildkite/recolorizer.rb
128
129
  - lib/rspec/buildkite/version.rb
129
- homepage: https://github.com/sj26/rspec-buildkite
130
+ homepage: https://github.com/buildkite/rspec-buildkite
130
131
  licenses:
131
132
  - MIT
132
133
  metadata: {}
133
- post_install_message:
134
+ post_install_message:
134
135
  rdoc_options: []
135
136
  require_paths:
136
137
  - lib
137
138
  required_ruby_version: !ruby/object:Gem::Requirement
138
139
  requirements:
139
- - - "~>"
140
+ - - ">="
140
141
  - !ruby/object:Gem::Version
141
142
  version: '2.2'
142
143
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -145,9 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubyforge_project:
149
- rubygems_version: 2.7.7
150
- signing_key:
149
+ rubygems_version: 3.3.7
150
+ signing_key:
151
151
  specification_version: 4
152
152
  summary: RSpec formatter creating Buildkite annotations for failures
153
153
  test_files: []
metadata.gz.sig CHANGED
Binary file