Skip to content

Commit

Permalink
Add SPM rake task and CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Jul 13, 2018
1 parent 73b4559 commit d6f77d9
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 51 deletions.
75 changes: 44 additions & 31 deletions .circleci/config.yml
Expand Up @@ -40,7 +40,7 @@ defaults:

version: 2
jobs:
lint:
carthage-build:
<<: *default-config
steps:
- *prepare-storage
Expand All @@ -49,14 +49,17 @@ jobs:
- *install-gems
- *store-gems
- run:
name: Install SwiftLint
command: bundle exec rake swiftlint:install
name: Install Carthage
command: bundle exec rake carthage:install
- run:
name: Lint source code
command: bundle exec rake swiftlint:run
name: Build
command: bundle exec rake carthage:build
- store_test_results:
path: /tmp/circleci-test-results
- *fetch-xcode-logs
- *store-artifacts

xcode-ios-build-and-test:
check-deploy:
<<: *default-config
steps:
- *prepare-storage
Expand All @@ -65,17 +68,14 @@ jobs:
- *install-gems
- *store-gems
- run:
name: Build Framework
command: bundle exec rake fmk:ios
name: Download podspec repo
command: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
- run:
name: Run Tests
command: bundle exec rake demo:ios
- store_test_results:
path: /tmp/circleci-test-results
- *fetch-xcode-logs
name: Lint podspec
command: bundle exec rake pod:lint
- *store-artifacts

xcode-tvos-build-and-test:
lint:
<<: *default-config
steps:
- *prepare-storage
Expand All @@ -84,17 +84,14 @@ jobs:
- *install-gems
- *store-gems
- run:
name: Build Framework
command: bundle exec rake fmk:tvos
name: Install SwiftLint
command: bundle exec rake swiftlint:install
- run:
name: Run Tests
command: bundle exec rake demo:tvos
- store_test_results:
path: /tmp/circleci-test-results
- *fetch-xcode-logs
name: Lint source code
command: bundle exec rake swiftlint:run
- *store-artifacts

carthage-build:
spm-build-and-test:
<<: *default-config
steps:
- *prepare-storage
Expand All @@ -103,17 +100,30 @@ jobs:
- *install-gems
- *store-gems
- run:
name: Install Carthage
command: bundle exec rake carthage:install
name: Run all tests
command: bundle exec rake spm:test
- *store-artifacts

xcode-ios-build-and-test:
<<: *default-config
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- run:
name: Build
command: bundle exec rake carthage:build
name: Build Framework
command: bundle exec rake fmk:ios
- run:
name: Run Tests
command: bundle exec rake demo:ios
- store_test_results:
path: /tmp/circleci-test-results
- *fetch-xcode-logs
- *store-artifacts

check-deploy:
xcode-tvos-build-and-test:
<<: *default-config
steps:
- *prepare-storage
Expand All @@ -122,11 +132,14 @@ jobs:
- *install-gems
- *store-gems
- run:
name: Download podspec repo
command: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
name: Build Framework
command: bundle exec rake fmk:tvos
- run:
name: Lint podspec
command: bundle exec rake pod:lint
name: Run Tests
command: bundle exec rake demo:tvos
- store_test_results:
path: /tmp/circleci-test-results
- *fetch-xcode-logs
- *store-artifacts


Expand Down
54 changes: 34 additions & 20 deletions Rakefile
Expand Up @@ -40,16 +40,15 @@ namespace :carthage do
end
end

namespace :swiftlint do
desc "Install SwiftLint from pkg"
task :install do
next if system('which swiftlint >/dev/null')
install_pkg('https://github.com/realm/SwiftLint/releases/download/0.26.0/SwiftLint.pkg')
namespace :demo do
desc "Builds the ReusableDemo app for iOS using xcodebuild."
task :ios do |t, args|
xcodebuild(scheme: 'ReusableDemo iOS', sdk: 'iphonesimulator', destination: DESTINATIONS[:ios_sim])
end

desc "Run SwiftLint on the source code"
task :run do
run('swiftlint lint --strict', xcpretty: false)
desc "Builds the ReusableDemo app for tvOS using xcodebuild."
task :tvos do |t, args|
xcodebuild(scheme: 'ReusableDemo tvOS', sdk: 'appletvsimulator', destination: DESTINATIONS[:tvos_sim])
end
end

Expand All @@ -65,23 +64,38 @@ namespace :fmk do
end
end

namespace :demo do
desc "Builds the ReusableDemo app for iOS using xcodebuild."
task :ios do |t, args|
xcodebuild(scheme: 'ReusableDemo iOS', sdk: 'iphonesimulator', destination: DESTINATIONS[:ios_sim])
namespace :pod do
desc "Lints the Reusable.podspec"
task :lint do |t|
run("pod lib lint --allow-warnings --quick", xcpretty: false)
end
end

desc "Builds the ReusableDemo app for tvOS using xcodebuild."
task :tvos do |t, args|
xcodebuild(scheme: 'ReusableDemo tvOS', sdk: 'appletvsimulator', destination: DESTINATIONS[:tvos_sim])
namespace :spm do
desc 'Build using SPM'
task :build do |task|
Utils.print_header 'Compile using SPM'
Utils.run('swift build', task, xcrun: true)
end

desc 'Run SPM Unit Tests'
task :test => :build do |task|
Utils.print_header 'Run the unit tests using SPM'
Utils.run('swift test', task, xcrun: true)
end
end

# TODO: "namespace :test" once we have Unit Tests
namespace :swiftlint do
desc "Install SwiftLint from pkg"
task :install do
next if system('which swiftlint >/dev/null')
install_pkg('https://github.com/realm/SwiftLint/releases/download/0.26.0/SwiftLint.pkg')
end

namespace :pod do
desc "Lints the Reusable.podspec"
task :lint do |t|
run("pod lib lint --allow-warnings --quick", xcpretty: false)
desc "Run SwiftLint on the source code"
task :run do
run('swiftlint lint --strict', xcpretty: false)
end
end

# TODO: "namespace :test" once we have Unit Tests

0 comments on commit d6f77d9

Please sign in to comment.