Sha256: 74d94f956fa84eb8212fa6ff70302ea3a0ef74a5f490f7b9e7c81ec361b7f1dc

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

skip_docs

lane :release do
  code_review
  sh('bundle exec rake build')
  gem_path = "pkg/xcmonkey-#{version}.gem"
  sh("gem push ../#{gem_path}")
  set_github_release(
    repository_name: 'alteral/xcmonkey',
    api_token: ENV.fetch("GITHUB_TOKEN", nil),
    name: "xcmonkey v#{version}",
    tag_name: "v#{version}",
    description: "v#{version}",
    commitish: git_branch,
    upload_assets: [gem_path]
  )
end

lane :code_review do
  sh('bundle exec rake')
end

lane :sonar_upload do
  update_simplecov_report
  sonar_options =
    if ENV['GITHUB_EVENT_NAME'] == 'pull_request'
      {
        sonar_login: ENV.fetch('SONAR_TOKEN', nil),
        pull_request_branch: ENV.fetch('GITHUB_HEAD_REF', nil),
        pull_request_base: ENV.fetch('GITHUB_BASE_REF', nil),
        pull_request_key: ENV.fetch('PR_NUMBER', nil)
      }
    else
      {
        sonar_login: ENV.fetch('SONAR_TOKEN', nil),
        branch_name: ENV['BRANCH_NAME'] || git_branch,
        project_version: version
      }
    end

  sonar(sonar_options)
end

private_lane :update_simplecov_report do
  coverage = JSON.parse(File.read('../coverage/.resultset.json'))["RSpec"]["coverage"]
  transformed_values = coverage.transform_values { |l| l["lines"] }
  new_format = { "RSpec" => { "coverage" => transformed_values, "timestamp" => Time.now.to_i } }
  File.write('../coverage/.sonar.json', JSON.pretty_generate(new_format))
end

def version
  version_path = '../lib/xcmonkey/version.rb'
  File.read(version_path).scan(/\d+/).join('.')
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xcmonkey-1.2.0 fastlane/Fastfile
xcmonkey-1.1.0 fastlane/Fastfile
xcmonkey-1.0.0 fastlane/Fastfile
xcmonkey-0.3.0 fastlane/Fastfile
xcmonkey-0.2.0 fastlane/Fastfile
xcmonkey-0.1.2 fastlane/Fastfile