Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from ReactKit/fastlane
- Loading branch information
Showing
5 changed files
with
241 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
fastlane_version "1.59.0" | ||
default_platform :mac | ||
|
||
UNIVERSAL_SCHEME = "SwiftState" | ||
RELEASE_BRANCH = "swift/2.0" | ||
|
||
before_all do | ||
#carthage(use_submodules: true, no_build: true) # checkout only | ||
sh("git submodule sync && git submodule update --init --recursive") # for non-Carthage users | ||
end | ||
|
||
desc "Lints Podspec" | ||
lane :pod_lint do | ||
sh("cd .. && pod lib lint") | ||
end | ||
|
||
desc "Runs tests in all platforms" | ||
lane :test_all do |options| | ||
test_universal_framework(platform: :OSX, scheme: UNIVERSAL_SCHEME) | ||
test_universal_framework(platform: :iOS, scheme: UNIVERSAL_SCHEME) | ||
test_universal_framework(platform: :tvOS, scheme: UNIVERSAL_SCHEME) | ||
# test_universal_framework(platform: :watchOS, scheme: UNIVERSAL_SCHEME) # no XCTest in watchOS | ||
end | ||
|
||
desc "Release new version" | ||
lane :bump do |options| | ||
bump_local(options) | ||
#bump_remote # TODO | ||
end | ||
|
||
desc "Prepare release for new version (no remote push)" | ||
lane :bump_local do |options| | ||
target_version = options[:version] | ||
raise "Parameter `version` is missing. Use `fastlane release version:{version_number}`.`" if target_version.nil? | ||
|
||
ensure_git_branch(branch: RELEASE_BRANCH) | ||
ensure_git_status_clean | ||
|
||
test_all | ||
pod_lint | ||
|
||
increment_version_number(version_number: target_version) | ||
|
||
version_bump_podspec(path: "SwiftState.podspec", version_number: target_version) | ||
|
||
git_commit( | ||
path: ["SwiftState.podspec", "Sources/Info.plist", "Tests/Info.plist"], | ||
message: "Bump version to #{target_version}" | ||
) | ||
add_git_tag tag: target_version | ||
end | ||
|
||
platform :mac do | ||
lane :test do | ||
test_universal_framework(platform: :OSX, scheme: UNIVERSAL_SCHEME) | ||
end | ||
end | ||
|
||
platform :ios do | ||
lane :test do | ||
test_universal_framework(platform: :iOS, scheme: UNIVERSAL_SCHEME) | ||
end | ||
end | ||
|
||
after_all do |lane| | ||
end | ||
|
||
error do |lane, exception| | ||
end |
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,56 @@ | ||
fastlane documentation | ||
================ | ||
# Installation | ||
``` | ||
sudo gem install fastlane | ||
``` | ||
# Available Actions | ||
### pod_lint | ||
``` | ||
fastlane pod_lint | ||
``` | ||
Lints Podspec | ||
### carthage_build | ||
``` | ||
fastlane carthage_build | ||
``` | ||
Builds dependencies using Carthage | ||
### test_all | ||
``` | ||
fastlane test_all | ||
``` | ||
Runs tests in all platforms | ||
### bump | ||
``` | ||
fastlane bump | ||
``` | ||
Release new version | ||
### bump_local | ||
``` | ||
fastlane bump_local | ||
``` | ||
|
||
|
||
---- | ||
|
||
## Mac | ||
### mac test | ||
``` | ||
fastlane mac test | ||
``` | ||
|
||
|
||
---- | ||
|
||
## iOS | ||
### ios test | ||
``` | ||
fastlane ios test | ||
``` | ||
|
||
|
||
---- | ||
|
||
This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools). | ||
More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools). | ||
The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane). |
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,87 @@ | ||
module Fastlane | ||
module Actions | ||
class SimulatorWatch < FastlaneCore::Simulator | ||
class << self | ||
def requested_os_type | ||
'watchOS' | ||
end | ||
end | ||
end | ||
|
||
_ios_sim = FastlaneCore::Simulator.all.last | ||
_tvos_sim = FastlaneCore::SimulatorTV.all.last | ||
_watchos_sim = SimulatorWatch.all.last | ||
|
||
BUILD_LOG_DIR = ENV['CIRCLE_ARTIFACTS'] || "fastlane/test_output/build_log" | ||
TEST_REPORTS_DIR = ENV['CIRCLE_TEST_REPORTS'] || "fastlane/test_output/test_report" | ||
|
||
SIMULATORS = { | ||
:OSX => "platform=OS X", | ||
:iOS => _ios_sim && "platform=iOS Simulator,name=#{_ios_sim}", | ||
:tvOS => _tvos_sim && "platform=tvOS Simulator,name=#{_tvos_sim}", | ||
:watchOS => _watchos_sim && "platform=watchOS Simulator,name=#{_watchos_sim}" | ||
} | ||
|
||
class TestUniversalFrameworkAction < Action | ||
|
||
def self._test_platform(platform, scheme: "OSX") | ||
if SIMULATORS[platform.to_sym].nil? then | ||
raise "Simulator not found for #{platform}." | ||
end | ||
|
||
require 'scan' | ||
|
||
config = FastlaneCore::Configuration.create(Scan::Options.available_options, { | ||
scheme: scheme, | ||
destination: SIMULATORS[platform], | ||
code_coverage: true, | ||
buildlog_path: "#{BUILD_LOG_DIR}/#{platform}", | ||
output_directory: "#{TEST_REPORTS_DIR}/#{platform}", | ||
clean: true | ||
}) | ||
|
||
Fastlane::Actions::ScanAction.run(config) | ||
end | ||
|
||
def self.run(params) | ||
Helper.log.info "Run TestUniversalFrameworkAction." | ||
|
||
_test_platform(params[:platform], scheme: params[:scheme]) | ||
end | ||
|
||
##################################################### | ||
# @!group Documentation | ||
##################################################### | ||
|
||
def self.description | ||
"Runs tests in target platform." | ||
end | ||
|
||
def self.available_options | ||
[ | ||
FastlaneCore::ConfigItem.new(key: :platform, | ||
env_name: "FL_TEST_UNIVERSAL_FRAMEWORK_PLATFORM", | ||
description: "Xcode simulator platform for testing universal framework", | ||
is_string: false, | ||
verify_block: proc do |value| | ||
raise "No platform for TestUniversalFramework given, pass using `platform: 'platform'`".red unless (value and not value.empty?) | ||
end), | ||
FastlaneCore::ConfigItem.new(key: :scheme, | ||
env_name: "FL_TEST_UNIVERSAL_FRAMEWORK_SCHEME", | ||
description: "Xcode scheme for testing universal framework", | ||
verify_block: proc do |value| | ||
raise "No scheme for TestUniversalFramework given, pass using `scheme: 'scheme'`".red unless (value and not value.empty?) | ||
end) | ||
] | ||
end | ||
|
||
def self.authors | ||
["Yasuhiro Inami"] | ||
end | ||
|
||
def self.is_supported?(platform) | ||
true | ||
end | ||
end | ||
end | ||
end |