fast_ci 1.0.6 → 1.0.7

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: a5f745c7e363bea209c4b7ff8c38211d731f7eb102622ea47637e7528a5d0c6e
4
- data.tar.gz: f16e6d81fe5c9f11fcacf4349827529aed342537ba8e67117e85bb76af462031
3
+ metadata.gz: 88ff9bc4e8535b44f8a75083d9f2e6e498a180eb579e59576deba2a78587e161
4
+ data.tar.gz: 5236dba1f25ad3776050e25482c4ce1a1810c90f051b59b5274d57ad7deee5e6
5
5
  SHA512:
6
- metadata.gz: efe774ed9b56cf19e8ff394a12d4b0277301fa292c19107b2b73293c3f94dcbe13064af8f1a343564d52fc35be939bcafb6d7d08b491b429baad56737e035417
7
- data.tar.gz: 1f5024f3dec4cd1a38da38619b72975844a4343805eb5f0c223e9c5bcdd9357e6b94aab18962f1b3216bdf7f0b4541b1b8377d60069da075d7a9aceb75be24dc
6
+ metadata.gz: 9509a523d124226ba2e495bf4683a7d0f409fb0a99e5b1f6653e1c27d47329905bb07dd2ee3de1233aae2be9ebc3f3256c1ea9da9f2e15452ea373b175b90632
7
+ data.tar.gz: 66ba3bc4ac0b3862c58e8cd0ca0ee803ce17dbacd0d08602343bf9d015d1eeacc1cbc0f82dae5ac0f327dc9c8c34f728b79b1fe1260963832382ba476ead3495
@@ -0,0 +1,23 @@
1
+ name: Release
2
+ concurrency:
3
+ group: production
4
+ cancel-in-progress: true
5
+ on:
6
+ push:
7
+ branches:
8
+ - release
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write
14
+ contents: write
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ bundler-cache: true
22
+ ruby-version: 3.0.0
23
+ - uses: rubygems/release-gem@v1
data/Gemfile.lock CHANGED
@@ -11,19 +11,21 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- fast_ci (1.0.2)
14
+ fast_ci (1.0.7)
15
15
  async-websocket (<= 0.20.0)
16
16
  brakeman (>= 5.4.1)
17
- console (~> 1.21.0)
18
- minitest-rails (>= 5.1)
17
+ console (>= 1.10.0)
18
+ minitest-rails (>= 2.2.1)
19
+ rspec-core (>= 3.6.0)
19
20
  rubycritic (>= 4.1.0)
21
+ simplecov (>= 0.22.0)
20
22
 
21
23
  GEM
22
24
  remote: https://rubygems.org/
23
25
  specs:
24
- actionpack (7.1.4)
25
- actionview (= 7.1.4)
26
- activesupport (= 7.1.4)
26
+ actionpack (7.1.4.2)
27
+ actionview (= 7.1.4.2)
28
+ activesupport (= 7.1.4.2)
27
29
  nokogiri (>= 1.8.5)
28
30
  racc
29
31
  rack (>= 2.2.4)
@@ -31,13 +33,13 @@ GEM
31
33
  rack-test (>= 0.6.3)
32
34
  rails-dom-testing (~> 2.2)
33
35
  rails-html-sanitizer (~> 1.6)
34
- actionview (7.1.4)
35
- activesupport (= 7.1.4)
36
+ actionview (7.1.4.2)
37
+ activesupport (= 7.1.4.2)
36
38
  builder (~> 3.1)
37
39
  erubi (~> 1.11)
38
40
  rails-dom-testing (~> 2.2)
39
41
  rails-html-sanitizer (~> 1.6)
40
- activesupport (7.1.4)
42
+ activesupport (7.1.4.2)
41
43
  base64
42
44
  bigdecimal
43
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -72,7 +74,7 @@ GEM
72
74
  thread_safe (~> 0.3, >= 0.3.1)
73
75
  base64 (0.2.0)
74
76
  bigdecimal (3.1.8)
75
- brakeman (6.2.1)
77
+ brakeman (6.2.2)
76
78
  racc
77
79
  builder (3.3.0)
78
80
  childprocess (5.1.0)
@@ -115,7 +117,7 @@ GEM
115
117
  addressable (~> 2.8)
116
118
  childprocess (~> 5.0)
117
119
  logger (1.6.1)
118
- loofah (2.22.0)
120
+ loofah (2.23.0)
119
121
  crass (~> 1.0.2)
120
122
  nokogiri (>= 1.12.0)
121
123
  method_source (1.0.0)
@@ -150,7 +152,7 @@ GEM
150
152
  stringio
151
153
  public_suffix (6.0.1)
152
154
  racc (1.8.1)
153
- rack (3.1.7)
155
+ rack (3.1.8)
154
156
  rack-session (2.0.0)
155
157
  rack (>= 3.0.0)
156
158
  rack-test (2.1.0)
@@ -165,9 +167,9 @@ GEM
165
167
  rails-html-sanitizer (1.6.0)
166
168
  loofah (~> 2.21)
167
169
  nokogiri (~> 1.14)
168
- railties (7.1.4)
169
- actionpack (= 7.1.4)
170
- activesupport (= 7.1.4)
170
+ railties (7.1.4.2)
171
+ actionpack (= 7.1.4.2)
172
+ activesupport (= 7.1.4.2)
171
173
  irb
172
174
  rackup (>= 1.0.0)
173
175
  rake (>= 12.2)
@@ -183,7 +185,7 @@ GEM
183
185
  rainbow (>= 2.0, < 4.0)
184
186
  reline (0.5.10)
185
187
  io-console (~> 0.5)
186
- rexml (3.3.8)
188
+ rexml (3.3.9)
187
189
  rspec (3.11.0)
188
190
  rspec-core (~> 3.11.0)
189
191
  rspec-expectations (~> 3.11.0)
data/Rakefile CHANGED
@@ -5,8 +5,4 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
8
+ task default: %i[spec]
@@ -5,35 +5,70 @@ module FastCI
5
5
  base.instance_eval do
6
6
  unless (ENV['FAST_CI_SECRET_KEY'] || '').empty?
7
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)
8
+ file_coverage = {}
12
9
 
13
- source = {}
10
+ result.files.each do |file|
11
+ missed_lines = file.missed_lines.map { |missed| missed.line_number }.sort
14
12
 
15
- result.source_files.each do |source_file|
16
- source[source_file.filename.gsub(root, '')] = source_file.src
13
+ file_coverage[file.filename.gsub(root, '.')] = {
14
+ coverage: file.coverage_statistics[:line].percent,
15
+ missed_line_count: missed_lines.count,
16
+ missed_lines: ::FastCI::SimpleCov::Reporting.join_consecutive_numbers(missed_lines),
17
+ covered_lines_count: file.covered_lines.map { |missed| missed.line_number }.count
18
+ }
17
19
  end
18
20
 
19
- result_json = {}
21
+ folder_coverage = {}
20
22
 
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)
23
+ file_coverage.each do |path, data|
24
+ parent_folders = File.dirname(path).split('/').drop(1)
25
25
 
26
- file_data['src'] = source[src.gsub(root, '')]
26
+ (0..(parent_folders.size - 1)).each do |path_index|
27
+ path = './' + parent_folders[0..path_index].join('/')
27
28
 
28
- result_json[command]['coverage'][src.gsub(root, '')] = file_data
29
+ folder_coverage[path] ||= {}
30
+
31
+ folder_coverage[path][:missed_line_count] =
32
+ (folder_coverage.dig(path, :missed_line_count) || 0) + data[:missed_line_count]
33
+ folder_coverage[path][:covered_line_count] =
34
+ (folder_coverage.dig(path, :covered_line_count) || 0) + data[:covered_lines_count]
29
35
  end
30
36
  end
31
37
 
32
- FastCI.report_simplecov(result_json.to_json)
38
+ folder_coverage.keys.each do |path|
39
+ folder_coverage[path][:coverage] =
40
+ (100 - folder_coverage[path][:missed_line_count] * 100.0 / (folder_coverage[path][:covered_line_count] + folder_coverage[path][:missed_line_count])).round(2)
41
+ end
42
+
43
+ results = {
44
+ file_coverage: file_coverage,
45
+ folder_coverage: folder_coverage,
46
+ coverage: result.coverage_statistics[:line].percent.round(2)
47
+ }
48
+
49
+ FastCI.report_simplecov(results.to_json)
33
50
  end
34
51
  end
35
52
  end
36
53
  end
54
+
55
+ def self.join_consecutive_numbers(arr)
56
+ result = []
57
+ consecutive_group = []
58
+
59
+ arr.each_with_index do |num, index|
60
+ if index == 0 || num == arr[index - 1] + 1
61
+ consecutive_group << num
62
+ else
63
+ result << (consecutive_group.size > 1 ? "#{consecutive_group.first}..#{consecutive_group.last}" : consecutive_group.first.to_s)
64
+ consecutive_group = [num]
65
+ end
66
+ end
67
+
68
+ result << (consecutive_group.size > 1 ? "#{consecutive_group.first}..#{consecutive_group.last}" : consecutive_group.first.to_s)
69
+
70
+ result.compact
71
+ end
37
72
  end
38
73
  end
39
74
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastCI
4
- VERSION = "1.0.6"
4
+ VERSION = "1.0.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nesha Zoric
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-17 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: console
@@ -133,6 +133,7 @@ extensions: []
133
133
  extra_rdoc_files: []
134
134
  files:
135
135
  - ".github/workflows/main.yml"
136
+ - ".github/workflows/release.yml"
136
137
  - ".gitignore"
137
138
  - ".rspec"
138
139
  - ".rubocop.yml"
@@ -187,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
188
  - !ruby/object:Gem::Version
188
189
  version: '0'
189
190
  requirements: []
190
- rubyforge_project:
191
- rubygems_version: 2.7.7
191
+ rubygems_version: 3.2.3
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Ruby wrapper for creating FastCI integrations