Sha256: 960e849f2e8f8e42d3e41b976317bf82c67b5a04ef2156709a8bd3f56ced4b5a
Contents?: true
Size: 992 Bytes
Versions: 21
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true require "json" require "net/http" namespace :simplecov_coverage do desc "Publish simplecov coverage" task :publish do branch = `git rev-parse --abbrev-ref HEAD`.chomp.strip next unless branch == "main" repo = `git rev-parse --show-toplevel`.split("/").last.chomp.strip coverage_json = JSON.parse(File.read("#{Rails.root}/coverage/.last_run.json")) coverage = { app_name: repo, value: coverage_json.dig("result", "line") } uri = URI("https://neeto-library-stable-versions.herokuapp.com/neeto_test_coverage_data/upload") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == "https") request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json") request.body = { coverage_data: coverage }.to_json response = http.request(request) raise "Simplecov coverage upload failed" unless response.is_a?(Net::HTTPSuccess) end end
Version data entries
21 entries across 21 versions & 1 rubygems