From 47c5547a9b09e3b75ec810e6dea92079c965e2e1 Mon Sep 17 00:00:00 2001 From: Yichi Zhang Date: Sat, 30 Apr 2016 17:26:09 +1000 Subject: [PATCH] Configure Travis; add Rakefile --- .travis.yml | 14 +---- Rakefile | 38 +++++++++++++ .../xcschemes/StringScoreTests.xcscheme | 56 +++++++++++++++++++ 3 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 Rakefile create mode 100644 StringScore.xcodeproj/xcshareddata/xcschemes/StringScoreTests.xcscheme diff --git a/.travis.yml b/.travis.yml index 580f689..8225a80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,3 @@ -# references: -# * http://www.objc.io/issue-6/travis-ci.html -# * https://github.com/supermarin/xcpretty#usage - +osx_image: xcode7.3 language: objective-c -# cache: cocoapods -# podfile: Example/Podfile -# before_install: -# - gem install cocoapods # Since Travis is not always on latest version -# - pod install --project-directory=Example -script: -- set -o pipefail && xcodebuild test -workspace Example/StringScore_Swift.xcworkspace -scheme StringScore_Swift-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -- pod lib lint +script: ci diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..2a8fb3e --- /dev/null +++ b/Rakefile @@ -0,0 +1,38 @@ +XCODEBUILD_OPTS = "-project StringScore.xcodeproj -derivedDataPath DerivedData" +IOS = "-scheme StringScore_Swift -sdk iphonesimulator9.3 -destination 'platform=iOS Simulator,name=iPhone 6'" +MACOSX = "-scheme StringScore_Swift -destination 'generic/platform=OS X'" + +def xcpretty(cmd) + sh "set -o pipefail; #{cmd} | xcpretty -c" +end + +task default: %w[test] + +task ci: %w[test:ios] + +desc "Run all tests" +task test: %w[test:ios test:macosx] + +namespace :test do + desc "Test on iOS" + task :ios do + xcpretty "xcodebuild test #{XCODEBUILD_OPTS} #{IOS}" + end + + desc "Test on Mac OS X" + task :macosx do + xcpretty "xcodebuild test #{XCODEBUILD_OPTS} #{MACOSX}" + end +end + +namespace :podspec do + desc "Validate the podspec" + task :lint do + sh "pod lib lint" + end +end + +desc "Clean the default scheme" +task :clean do + rm_rf "DerivedData" +end diff --git a/StringScore.xcodeproj/xcshareddata/xcschemes/StringScoreTests.xcscheme b/StringScore.xcodeproj/xcshareddata/xcschemes/StringScoreTests.xcscheme new file mode 100644 index 0000000..72d18e3 --- /dev/null +++ b/StringScore.xcodeproj/xcshareddata/xcschemes/StringScoreTests.xcscheme @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + +