forked from ChartsOrg/Charts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
osx_image: xcode7.2 | ||
language: objective-c | ||
|
||
env: | ||
global: | ||
- LANG=en_US.UTF-8 | ||
|
||
cache: | ||
- bundler | ||
|
||
before_install: | ||
- brew update | ||
- brew install carthage | ||
- carthage bootstrap | ||
|
||
script: | ||
- rake test | ||
|
||
# after_success: | ||
# - bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "rake" | ||
gem "xcpretty" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
rake (10.4.2) | ||
rouge (1.10.1) | ||
xcpretty (0.2.2) | ||
rouge (~> 1.8) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rake | ||
xcpretty | ||
|
||
BUNDLED WITH | ||
1.11.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
def type | ||
:project # set `:project` for xcodeproj and `:workspace` for xcworkspace | ||
end | ||
|
||
def project_name | ||
"Charts/Charts.xcodeproj" | ||
end | ||
|
||
def configuration | ||
"Debug" | ||
end | ||
|
||
def test_targets | ||
[ | ||
:ios, | ||
# :tvos #no tvOS fbsnapshot | ||
] | ||
end | ||
|
||
def schemes | ||
{ | ||
ios: 'Charts-iOS', | ||
tvos: 'Charts-TV' | ||
} | ||
end | ||
|
||
def sdks | ||
{ | ||
ios: 'iphonesimulator', | ||
osx: 'macosx', | ||
tvos: 'appletvsimulator' | ||
} | ||
end | ||
|
||
def devices | ||
{ | ||
ios: "name='iPhone 6s'", | ||
osx: "arch='x86_64'", | ||
tvos: "name='Apple TV 1080p'" | ||
} | ||
end | ||
|
||
def xcodebuild(type, name, scheme, configuration, sdk, destination, tasks, xcprety_args: '') | ||
|
||
# set either workspace or project flag for xcodebuild | ||
case type | ||
when :project | ||
project_type = "-project" | ||
when :workspace | ||
project_type = "-workspace" | ||
else | ||
abort "Invalid project type, use `:project` for xcodeproj and `:workspace` for xcworkspace." | ||
end | ||
|
||
sh "set -o pipefail && xcodebuild #{project_type} '#{name}' -scheme '#{scheme}' -configuration '#{configuration}' -sdk #{sdk} -destination #{destination} #{tasks} | xcpretty -c #{xcprety_args}" | ||
|
||
end | ||
|
||
def execute(tasks, platform, xcprety_args) | ||
|
||
# platform specific settings | ||
sdk = sdks[platform] | ||
scheme = schemes[platform] | ||
destination = devices[platform] | ||
|
||
# check if xcodebuild needs to be run on multiple devices | ||
if destination.respond_to?('map') | ||
destination.map do |destination| | ||
xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args | ||
end | ||
else | ||
xcodebuild type, project_name, scheme, configuration, sdk, destination, tasks, xcprety_args | ||
end | ||
|
||
end | ||
|
||
desc 'Build, then run tests.' | ||
task :test do | ||
|
||
test_targets.map do |platform| | ||
execute 'build test', platform, xcprety_args: '--test' | ||
end | ||
|
||
sh "killall Simulator" | ||
|
||
end |