Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
build: output coverage report using xcov-danger SDKCF-1159 (#14)
Browse files Browse the repository at this point in the history
- use Gemfile for dependencies
- only call the fastlane coverage lane when running locally because on travis Danger will be run as a separate script command after fastlane
- add vendor dir to excluded lint files because travis adds all its bundler dependencies to a vendor dir within the repo root
  • Loading branch information
donnie-jp committed Sep 5, 2019
1 parent 080734b commit 86b6363
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 17 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ identifier_name:
excluded:
- Pods
- RemoteConfigPlayground.playground
- vendor
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ xcode_scheme: Tests
osx_image: xcode10.2

before_install:
- gem install xcov
- gem update fastlane cocoapods xcov --no-document
- bundle install
- gem update fastlane cocoapods --no-document
- pod repo update

script: fastlane ci
script:
- fastlane ci
- bundle exec danger

after_success:
# generate docs
- gem install jazzy
- jazzy --xcodebuild-arguments -scheme,Tests --module RRemoteConfig --source-directory RRemoteConfig --podspec RRemoteConfig.podspec --exclude RRemoteConfig/Loader.swift --readme README.md

deploy:
Expand Down
13 changes: 13 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

xcov.report(
workspace: 'RRemoteConfig.xcworkspace',
scheme: 'Tests',
output_directory: 'artifacts/unit-tests/coverage',
source_directory: 'RRemoteConfig',
json_report: true,
include_targets: 'RRemoteConfig.framework',
include_test_targets: false,
minimum_coverage_percentage: 70.0
)
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

gem "cocoapods"
gem "xcov"
gem "jazzy"
gem "danger"
gem "danger-xcov"
gem "xcode-install"
24 changes: 11 additions & 13 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ default_platform(:ios)
platform :ios do
desc "Build everything"
lane :ci do |options|
xcversion(version: "~> 10.2")

swiftlint(
strict: true,
ignore_exit_status: false
Expand All @@ -22,7 +24,12 @@ platform :ios do
output_types: 'json-compilation-database,html,junit',
output_files: 'compile_commands.json,report.html,report.junit')

coverage
if is_ci?
puts "Running on CI, coverage report will be generated by Danger"
else
puts "Running locally so call coverage lane"
coverage
end
end

desc "Set up environment"
Expand All @@ -41,18 +48,9 @@ platform :ios do

desc "Generate code coverage"
lane :coverage do |options|
xcov(
workspace: 'RRemoteConfig.xcworkspace',
scheme: 'Tests',
output_directory: 'artifacts/unit-tests/coverage',
source_directory: 'RRemoteConfig',
json_report: true,
include_targets: 'RRemoteConfig.framework',
include_test_targets: false,
skip_slack: true,
disable_coveralls: false,
minimum_coverage_percentage: 70.0
)
Dir.chdir("..") do
sh("bundle exec danger dry_run")
end
end
end
# vim:syntax=ruby:et:sts=2:sw=2:ts=2:ff=unix:

0 comments on commit 86b6363

Please sign in to comment.