ruby_ci 0.2.0 → 0.2.1
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 +4 -4
- data/lib/ruby_ci/simple_cov/reporting.rb +39 -0
- data/lib/ruby_ci/simple_cov.rb +7 -0
- data/lib/ruby_ci/version.rb +1 -1
- data/lib/ruby_ci.rb +16 -0
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e283124f28472dd77c422d918d1add1900eb6b6f220975feca638fd30ec9d17e
         | 
| 4 | 
            +
              data.tar.gz: 44b1948327549780caf7dfac69d65cc4838acca1e7f84890ff410b420d85ebe9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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
         | 
    
        data/lib/ruby_ci/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 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
         |