ruby_ci 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: d34d2bb75becc90c41cf2366ef0c7d6bb6ccbcc5b33e6c6e460d7a3a5fd6976f
4
- data.tar.gz: c0846f4d4ed597b738d09687d8a14697e1dff4403fbbf852ab483f70df172b5a
3
+ metadata.gz: e283124f28472dd77c422d918d1add1900eb6b6f220975feca638fd30ec9d17e
4
+ data.tar.gz: 44b1948327549780caf7dfac69d65cc4838acca1e7f84890ff410b420d85ebe9
5
5
  SHA512:
6
- metadata.gz: ee9dcf45a74418a994a369c2de76b213c0181462a7ad14ef88782cd0e9cab2f18fb4eb011920a26650f0ac68f6bad32203828a8a617d3675297e66a6656f84ef
7
- data.tar.gz: f4135d4de92276f7572ef08810fb0873375a28354fd4f7841305ebd6930d26a1d8f9aceb9d25b00dc5a74c28b90365c0b4a3d0554a5b35a2759423e76ab9be8f
6
+ metadata.gz: 81016f3033727cbb53fdb989924e62d4f5f8a8f9963cff8f935b656a08b9582b53329f798324d8427e4522540982947c3dc76d58fbdfae40492b60297c08141f
7
+ data.tar.gz: c499ce521bdc3e5c7a401fb7aa2494df109c0dc9a4796776330c68ad6ffc3bfc5f22d0dc1ecd371c8c2a693116a36f42a5f11e18ec005a42a9e600be62fe7179
@@ -0,0 +1,39 @@
1
+ module RubyCI
2
+ module SimpleCov
3
+ module Reporting
4
+ def self.included base
5
+ base.instance_eval do
6
+ if ENV['RUBY_CI_SECRET_KEY'].present?
7
+ def write_last_run(result)
8
+ ::SimpleCov::LastRun.write(result:
9
+ result.coverage_statistics.transform_values do |stats|
10
+ round_coverage(stats.percent)
11
+ end)
12
+
13
+ source = {}
14
+
15
+ result.source_files.each do |source_file|
16
+ source[source_file.filename.gsub(root, '')] = source_file.src
17
+ end
18
+
19
+ result_json = {}
20
+
21
+ result.as_json.each do |command, data|
22
+ result_json[command] = data
23
+ data['coverage'].clone.each do |src, file_data|
24
+ result_json[command]['coverage'].delete(src)
25
+
26
+ file_data['src'] = source[src.gsub(root, '')]
27
+
28
+ result_json[command]['coverage'][src.gsub(root, '')] = file_data
29
+ end
30
+ end
31
+
32
+ RubyCI.report_simplecov(result_json.to_json)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,7 @@
1
+ require_relative "simple_cov/reporting"
2
+
3
+ module RubyCI
4
+ module SimpleCov
5
+ ::SimpleCov.send(:include, RubyCI::SimpleCov::Reporting)
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyCI
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
data/lib/ruby_ci.rb CHANGED
@@ -28,6 +28,22 @@ module RubyCI
28
28
  @minitest_ws ||= WebSocket.new('minitest')
29
29
  end
30
30
 
31
+ def report_simplecov(results)
32
+ data = {
33
+ build_id: RubyCI.configuration.build_id,
34
+ run_key: 'simplecov',
35
+ secret_key: RubyCI.configuration.secret_key,
36
+ branch: RubyCI.configuration.branch,
37
+ commit: RubyCI.configuration.commit,
38
+ commit_msg: RubyCI.configuration.commit_msg,
39
+ author: RubyCI.configuration.author.to_json,
40
+ content: results
41
+ }
42
+
43
+ uri = URI('https://fast.ruby.ci/api/runs')
44
+ res = Net::HTTP.post_form(uri, data)
45
+ end
46
+
31
47
  def rspec_await
32
48
  rspec_ws.await
33
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ale ∴
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-12 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: console
@@ -79,6 +79,8 @@ files:
79
79
  - lib/ruby_ci/extract_definitions.rb
80
80
  - lib/ruby_ci/rspec_formatter.rb
81
81
  - lib/ruby_ci/runner_prepend.rb
82
+ - lib/ruby_ci/simple_cov.rb
83
+ - lib/ruby_ci/simple_cov/reporting.rb
82
84
  - lib/ruby_ci/version.rb
83
85
  - ruby_ci.gemspec
84
86
  homepage: https://github.com/RubyCI/ruby_ci_gem