Class: Fastlane::Actions::CodecovReporterAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject


25
26
27
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 25

def self.authors
  ["BinaryBeard"]
end

.available_optionsObject


34
35
36
37
38
39
40
41
42
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 34

def self.available_options
    [
      FastlaneCore::ConfigItem.new(key: :token,
                                   env_name: "CODECOV_TOKEN",
                                   description: "Codecov.io private repo token",
                                   is_string: true,
                                   default_value: false)
    ]
end

.descriptionObject


21
22
23
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 21

def self.description
  "Uploads coverage report to Codecov.io"
end

.detailsObject


29
30
31
32
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 29

def self.details
  # Optional:
  "Uploads coverage report, from a public or private repository, to Codecov.io"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)

44
45
46
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 44

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 4

def self.run(params)
  UI.message "I am Getting the latest bash script from Codecov.io"
  sh "curl -s -N https://Codecov.io/bash > #{ENV['PWD']}/codecov_reporter.sh"
  if params[:token] != false then
    UI.message "It looks like I'm working with a private repository"
    sh "bash #{ENV['PWD']}/codecov_reporter.sh -t #{params[:token]}"
  else
    UI.message "It looks like I'm working with a public repository"
    sh "bash #{ENV['PWD']}/codecov_reporter.sh"
  end
  UI.message "Removing the bash script I got from Codecov.io"
  sh "rm #{ENV['PWD']}/codecov_reporter.sh"
  UI.message "Removing the created coverage.txt files"
  sh "rm *.coverage.txt"
  UI.message "All was well"
end