Created
June 4, 2016 10:39
-
-
Save dddnuts/522302dc0b787896ebd103542372f9c1 to your computer and use it in GitHub Desktop.
Build ipa from Unity project with 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
fastlane_version "1.94.0" | |
default_platform :ios | |
platform :ios do | |
desc "Run Unity Editor tests" | |
lane :test_unit do | |
unity( | |
run_editor_tests: true | |
) | |
end | |
desc "Run integration tests" | |
lane :test_integration do | |
unity( | |
execute_method: "TestHelper.SetUp" | |
) | |
unity( | |
execute_method: "UnityTest.Batch.RunIntegrationTests", | |
results_file_directory: "EditorTestResults" | |
) | |
end | |
desc "Submit a new Beta Build" | |
desc "This will also make sure the profile is up to date" | |
lane :beta do | |
unity( | |
execute_method: 'Builder.BuildiOS' | |
) | |
sigh( | |
adhoc: true | |
) | |
gym( | |
project: './Build/Unity-iPhone.xcodeproj', | |
scheme: 'Unity-iPhone', | |
use_legacy_build_api: true, | |
output_directory: './Build', | |
xcargs: 'CODE_SIGN_IDENTITY="iPhone Distribution"' | |
) | |
unless ENV['NO_DEPLOY'] | |
changelog_from_git_commits | |
deploygate( | |
message: "Changes:\n\n#{lane_context[SharedValues::FL_CHANGELOG]}" | |
) | |
end | |
end | |
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
module Fastlane | |
module Actions | |
class UnityAction < Action | |
def self.run(params) | |
build_cmd = "#{params[:executable]}" | |
build_cmd << " -projectPath #{params[:project_path]}" | |
build_cmd << " -batchmode" | |
build_cmd << " -quit" | |
build_cmd << " -nographics" if params[:nographics] | |
build_cmd << " -executeMethod #{params[:execute_method]}" if params[:execute_method] | |
build_cmd << " -runEditorTests" if params[:run_editor_tests] | |
build_cmd << " -resultsFileDirectory=#{params[:results_file_directory]}" if params[:results_file_directory] | |
UI.message "" | |
UI.message Terminal::Table.new( | |
title: "Unity".green, | |
headings: ["Option", "Value"], | |
rows: params.values | |
) | |
UI.message "" | |
UI.message "Start running" | |
UI.message "Check out logs at \"~/Library/Logs/Unity/Editor.log\" if the build failed" | |
UI.message "" | |
sh build_cmd | |
UI.success "Completed" | |
end | |
##################################################### | |
# @!group Documentation | |
##################################################### | |
def self.description | |
"Run Unity in batch mode" | |
end | |
def self.available_options | |
[ | |
FastlaneCore::ConfigItem.new(key: :executable, | |
env_name: "FL_UNITY_EXECUTABLE", | |
description: "Path for Unity executable", | |
default_value: "/Applications/Unity/Unity.app/Contents/MacOS/Unity"), | |
FastlaneCore::ConfigItem.new(key: :project_path, | |
env_name: "FL_UNITY_PROJECT_PATH", | |
description: "Path for Unity project", | |
default_value: "#{Dir.pwd}"), | |
FastlaneCore::ConfigItem.new(key: :execute_method, | |
env_name: "FL_UNITY_EXECUTE_METHOD", | |
description: "Method to execute", | |
optional: true, | |
default_value: nil), | |
FastlaneCore::ConfigItem.new(key: :nographics, | |
env_name: "FL_UNITY_NOGRAPHICS", | |
description: "Initialize graphics device or not", | |
is_string: false, | |
default_value: true), | |
FastlaneCore::ConfigItem.new(key: :run_editor_tests, | |
env_name: "FL_UNITY_RUN_EDITOR_TESTS", | |
description: "Option to run editor tests", | |
is_string: false, | |
default_value: false), | |
FastlaneCore::ConfigItem.new(key: :results_file_directory, | |
env_name: "FL_RESULTS_FILE_DIRECTORY", | |
description: "Path for integration test results", | |
optional: true, | |
default_value: nil) | |
] | |
end | |
def self.authors | |
["dddnuts"] | |
end | |
def self.is_supported?(platform) | |
[:ios].include?(platform) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment