ruby_ci 0.2.0 → 0.2.2

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: 17dfb5e9b470cabfc7fc4a659f3f55c1b2af547a42ee39a11affe56c759ca139
4
+ data.tar.gz: 78d7a6bf28f59d2d323e3512170a2a13a5e3387d58f9e2346d04a4f39d874063
5
5
  SHA512:
6
- metadata.gz: ee9dcf45a74418a994a369c2de76b213c0181462a7ad14ef88782cd0e9cab2f18fb4eb011920a26650f0ac68f6bad32203828a8a617d3675297e66a6656f84ef
7
- data.tar.gz: f4135d4de92276f7572ef08810fb0873375a28354fd4f7841305ebd6930d26a1d8f9aceb9d25b00dc5a74c28b90365c0b4a3d0554a5b35a2759423e76ab9be8f
6
+ metadata.gz: 410893c69240010c95d1909f450ede519cfb8d714233996319412cf5582dcc51cfc31b017271a57d69b9fc8e76bf6125c6d2b28f3b77fc4c850244445a9bc1eb
7
+ data.tar.gz: 99e53617f15b76a94b096fec4ba25b6c41f0868746dd6f2c150553c4efe06bf8292ac2bfb198487d6a33a1bbf82ed246630643c1f1b51c09fef2e1e6e67b16cd
@@ -0,0 +1,39 @@
1
+ module RubyCI
2
+ module SimpleCov
3
+ module Reporting
4
+ def self.included base
5
+ base.instance_eval do
6
+ unless (ENV['RUBY_CI_SECRET_KEY'] || '').empty?
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.2"
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.2
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