-
Notifications
You must be signed in to change notification settings - Fork 58
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
1 parent
8095d3c
commit a336166
Showing
20 changed files
with
348 additions
and
248 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ xcuserdata/ | |
## Other | ||
*.moved-aside | ||
*.xcuserstate | ||
*.xcscmblueprint | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,25 +1,79 @@ | ||
def xcpretty(cmd) | ||
if `which xcpretty` && $?.success? | ||
def xcpretty(cmd, task) | ||
name = task.name.gsub(/:/,"_") | ||
xcpretty = `which xcpretty` | ||
|
||
if ENV['CI'] | ||
sh "set -o pipefail && #{cmd} | tee \"#{ENV['CIRCLE_ARTIFACTS']}/#{name}_raw.log\" | xcpretty --color --report junit --output \"#{ENV['CIRCLE_TEST_REPORTS']}/xcode/#{name}.xml\"" | ||
elsif xcpretty && $?.success? | ||
sh "set -o pipefail && #{cmd} | xcpretty -c" | ||
else | ||
sh cmd | ||
end | ||
end | ||
|
||
task :build_for_testing do | ||
sh "swift build" | ||
xcpretty "xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests build-for-testing" | ||
def plain(cmd, task) | ||
name = task.name.gsub(/:/,"_") | ||
if ENV['CI'] | ||
sh "set -o pipefail && #{cmd} | tee \"#{ENV['CIRCLE_ARTIFACTS']}/#{name}_raw.log\"" | ||
else | ||
sh cmd | ||
end | ||
end | ||
|
||
desc 'Run Unit Tests' | ||
task :test => :build_for_testing do | ||
sh "swift test" | ||
xcpretty "xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests test-without-building" | ||
namespace :spm do | ||
desc 'Build using SPM' | ||
task :build do |task| | ||
plain("swift build", task) | ||
end | ||
|
||
desc 'Run SPM Unit Tests' | ||
task :test => :build do |task| | ||
plain("swift test", task) | ||
end | ||
end | ||
|
||
desc 'Lint the Pod' | ||
task :lint do | ||
sh "pod lib lint StencilSwiftKit.podspec --quick" | ||
namespace :xcode do | ||
desc 'Build using Xcode' | ||
task :build do |task| | ||
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests build-for-testing", task) | ||
end | ||
|
||
desc 'Run Xcode Unit Tests' | ||
task :test => :build do |task| | ||
xcpretty("xcodebuild -workspace StencilSwiftKit.xcworkspace -scheme Tests test-without-building", task) | ||
end | ||
end | ||
|
||
namespace :lint do | ||
desc 'Install swiftlint' | ||
task :install do |task| | ||
swiftlint = `which swiftlint` | ||
|
||
if !(swiftlint && $?.success?) | ||
url = 'https://github.com/realm/SwiftLint/releases/download/0.16.1/SwiftLint.pkg' | ||
tmppath = '/tmp/SwiftLint.pkg' | ||
|
||
plain("curl -Lo #{tmppath} #{url}", task) | ||
plain("sudo installer -pkg #{tmppath} -target /", task) | ||
end | ||
end | ||
|
||
desc 'Lint the code' | ||
task :code => :install do |task| | ||
plain("swiftlint lint --no-cache --strict --path Sources", task) | ||
end | ||
|
||
desc 'Lint the tests' | ||
task :tests => :install do |task| | ||
plain("swiftlint lint --no-cache --strict --path Tests/StencilSwiftKitTests", task) | ||
end | ||
end | ||
|
||
namespace :pod do | ||
desc 'Lint the Pod' | ||
task :lint do |task| | ||
plain("pod lib lint StencilSwiftKit.podspec --quick", task) | ||
end | ||
end | ||
|
||
task :default => :test | ||
task :default => "xcode:test" |
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
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
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
Oops, something went wrong.