Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds CI #636

Merged
merged 3 commits into from
Dec 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .travis.yml
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
- cd Charts && carthage bootstrap

script:
- rake test

# after_success:
# - bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"

gem "rake"
gem "xcpretty"
17 changes: 17 additions & 0 deletions Gemfile.lock
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
86 changes: 86 additions & 0 deletions Rakefile
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