Created
March 18, 2019 03:35
-
-
Save chan-bo/4f15b2f4f87c854457748b762c05e87e to your computer and use it in GitHub Desktop.
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
default_platform(:android) | |
platform :android do | |
desc "Assemble Build" | |
lane :assemble_build do |options| | |
gradle(task: "assemble", flavor: options[:build_flavor], build_type: options[:build_type]) | |
end | |
desc "Run Unit Tests" | |
lane :unit_tests do |options| | |
gradle(task: "test", flavor: options[:build_flavor], build_type: options[:build_type]) | |
end | |
desc "Run UI Test in Firebase Test Lab" | |
lane :instrumentation_tests_testlab do |options| | |
assemble_build(build_flavor:options[:build_flavor], build_type:"Debug") | |
@app_apk = Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | |
assemble_build(build_flavor:options[:build_flavor] + "Debug", build_type:"AndroidTest") | |
@android_test_apk = Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | |
run_tests_firebase_testlab( | |
project_id: "sampleappcicd", | |
app_apk: @app_apk, | |
android_test_apk: @android_test_apk, | |
devices: [ | |
{ | |
model: "Nexus6P", | |
version: "27" | |
} | |
], | |
delete_firebase_files: true | |
) | |
end | |
desc "Send Apk to Slack" | |
lane :send_apk_to_slack do |options| | |
assemble_build(build_flavor:options[:build_flavor], build_type:options[:build_type]) | |
file_path = Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | |
file_name = options[:build_flavor] + " " + options[:build_type] | |
sh "curl https://slack.com/api/files.upload -F token=\"your_token\" \ | |
-F channels=\"your_channel_id\" -F title=\"" + file_name + "\" -F file=@" + file_path | |
end | |
desc "Beta Deployment" | |
lane :beta do |options| | |
assemble_build(build_flavor:"Beta", build_type:"Release") | |
upload_to_play_store( | |
track: 'beta', | |
apk: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | |
) | |
crashlytics( | |
apk_path:Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], | |
api_token:'your_api_token', | |
build_secret:'your_build_secret' | |
) | |
end | |
desc "Release Deployment" | |
lane :release do |options| | |
assemble_build(build_flavor:"Pro", build_type:"Release") | |
upload_to_play_store( | |
apk: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | |
) | |
crashlytics( | |
apk_path:Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], | |
api_token:'your_api_token', | |
build_secret:'your_build_secret' | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment