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



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

def self.authors
  ["BinaryBeard"]
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 38

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



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

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

.detailsObject



33
34
35
36
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 33

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/fastlane/plugin/codecov_reporter/actions/codecov_reporter_action.rb', line 48

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
20
21
22
23
# 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"

  params[:token] ||= false

  if params[:token] != false
    UI.message "It looks like I'm working with a private repository"
    sh "bash #{ENV['PWD']}/codecov_reporter.sh -K -t #{params[:token]}"
  else
    UI.message "It looks like I'm working with a public repository"
    sh "bash #{ENV['PWD']}/codecov_reporter.sh -K "
  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, if any."
  sh "rm -f *.coverage.txt"
  UI.message "All was well"
end