Skip to content

Instantly share code, notes, and snippets.

@FranzBusch
Created January 17, 2018 14:32
Show Gist options
  • Save FranzBusch/ea805fd52b560a0a1ea53ff76546c9af to your computer and use it in GitHub Desktop.
Save FranzBusch/ea805fd52b560a0a1ea53ff76546c9af to your computer and use it in GitHub Desktop.
Sixt CI Fastfile
fastlane_version "2.76.1"
default_platform :ios
platform :ios do
####### Certificates #######
desc "Installs the certificates and profiles locally"
lane :certificates do |options|
if options[:use_temporary_keychain]
create_temporary_keychain
end
readonly = (options[:refresh_certificates] ? false : true)
force_for_new_devices = !readonly
match(
git_branch: "Company-Enterprise",
app_identifier: "com.sixt.MediumTest-dev",
team_id: "XXX",
type: "development",
readonly: readonly,
force_for_new_devices: force_for_new_devices
)
match(
git_branch: "Company",
app_identifier: "com.sixt.MediumTest",
team_id: "XXX",
type: "appstore",
readonly: readonly
)
match(
git_branch: "Company-Enterprise",
app_identifier: "com.sixt.MediumTest-alpha",
team_id: "XXX",
type: "enterprise",
readonly: readonly
)
if options[:use_temporary_keychain]
sh "security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k #{ENV["KEYCHAIN_NAME"]} #{ENV["KEYCHAIN_PASSWORD"]}"
end
end
private_lane :create_temporary_keychain do
keychain_name = "temporary_keychain"
ENV["KEYCHAIN_NAME"] = keychain_name
ENV["KEYCHAIN_PASSWORD"] = keychain_name
ENV["MATCH_KEYCHAIN_NAME"] = keychain_name
ENV["MATCH_KEYCHAIN_PASSWORD"] = keychain_name
create_keychain(
default_keychain: true,
unlock: true,
timeout: 3600,
add_to_search_list: true
)
end
####### Testing #######
desc "Runs all the tests"
lane :tests do
unit_tests
ui_tests
end
desc "Runs all unit tests"
lane :unit_tests do
scan(
workspace: "MediumTest.xcworkspace",
scheme: "MediumTest",
devices: ["iPhone 7"],
clean: true
)
end
desc "Runs all ui tests"
lane :ui_tests do
scan(
workspace: "MediumTest.xcworkspace",
scheme: "MediumTest",
devices: ["iPhone 7"],
clean: true
)
end
####### Builds #######
desc "Submit a new Alpha Build to Fabric"
lane :alpha do |options|
changelog = sh("git log --pretty=format:'* %s <%an>%n' --first-parent --abbrev-commit #{ENV['GIT_PREVIOUS_SUCCESSFUL_COMMIT'] || 'HEAD^^^^^'}..HEAD")
increment_build_number( build_number: ENV["CIRCLE_BUILD_NUM"])
certificates(
use_temporary_keychain: options[:use_temporary_keychain],
refresh_certificates: options[:refresh_certificates]
)
gym(
workspace: "MediumTest.xcworkspace",
scheme: "MediumTest",
configuration: options[:configuration],
clean: true
)
crashlytics(
crashlytics_path: './Pods/Crashlytics/',
notes: "#{changelog.to_s}",
notifications: true,
groups: ["Group"]
)
end
desc "Submit a new build to iTunes Connect"
lane :appstore do |options|
certificates(
use_temporary_keychain: options[:use_temporary_keychain],
refresh_certificates: options[:refresh_certificates]
)
increment_build_number(
build_number: ENV["BUILD_NUMBER"]
)
gym(
verbose: true,
workspace: "MediumTest.xcworkspace",
configuration: "Release",
scheme: "MediumTest",
clean: true,
include_symbols: true,
export_method: "app-store"
)
testflight(
skip_submission: true,
skip_waiting_for_build_processing: true
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment