Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CocoaheadsSKG #3 - Towards Continuous Delivery ...

CocoaheadsSKG #3 - Towards Continuous Delivery with Fastlane

CocoaHeadsSKG

April 03, 2016
Tweet

More Decks by CocoaHeadsSKG

Other Decks in Technology

Transcript

  1. What is Fastlane? What is Fastlane? A set of tools

    written on Ruby. A set of tools written on Ruby. You define and run sets of tasks (lanes) for You define and run sets of tasks (lanes) for different environments and configurations. different environments and configurations. Automates Automates deployment/release process. deployment/release process. 100% open-source, fully extendable and 100% open-source, fully extendable and configurable. configurable. Saves you time Saves you time and frustration. and frustration. 1 1
  2. Fastlane Tools Fastlane Tools Upload screenshots, metadata and your app

    to the Upload screenshots, metadata and your app to the App Store using a single command. App Store using a single command.
  3. Fastlane Tools Fastlane Tools Automate taking localized screenshots of your

    iOS Automate taking localized screenshots of your iOS app on every device. app on every device.
  4. Fastlane Tools Fastlane Tools Automagically generate and renew your push

    Automagically generate and renew your push notification profiles. notification profiles.
  5. Fastlane Tools Fastlane Tools Fixes provisioning issues without you having

    to cut Fixes provisioning issues without you having to cut your wrists. your wrists.
  6. Fastlane Tools Fastlane Tools Create new iOS apps on iTunes

    Connect and Create new iOS apps on iTunes Connect and Developer Portal using the command line Developer Portal using the command line
  7. Fastlane Tools Fastlane Tools Create and maintain iOS code signing

    certificates in Create and maintain iOS code signing certificates in an automatic way an automatic way
  8. Fastlane Tools Fastlane Tools The easiest way to run tests

    of your iOS and Mac The easiest way to run tests of your iOS and Mac apps. apps.
  9. Fastlane Tools Fastlane Tools "Building your iOS app has never

    been easier" "Building your iOS app has never been easier"
  10. Fastlane Tools Fastlane Tools The best way to manage your

    Testflight testers and The best way to manage your Testflight testers and builds from your terminal builds from your terminal
  11. Fastlane Tools Fastlane Tools There are another two or three...

    There are another two or three... Available as standalone from CLI. Available as standalone from CLI. Based on the solid.... Based on the solid.... A Ruby Library that exposes Apple Developer Center and iTunes A Ruby Library that exposes Apple Developer Center and iTunes Connect as API Connect as API
  12. Installation Installation You guessed it. It's a gem. You guessed

    it. It's a gem. $ sudo gem install fastlane --verbose Quickstart Quickstart $ cd MyAwesomeApp; fastlane init Gets you a boilerplate Gets you a boilerplate Fastfile Fastfile Gets you a boilerplate Gets you a boilerplate AppFile AppFile
  13. Appfile Appfile Stores useful information that is used Stores useful

    information that is used across all fastlane tools. across all fastlane tools. Your App Identifier Your App Identifier Your Apple ID Your Apple ID Your iTunes Connect Team Name Your iTunes Connect Team Name Your Apple Dev Portal Id Your Apple Dev Portal Id Your iTunes Connect Account Your iTunes Connect Account
  14. Fastfile Fastfile Where you define your set of tasks (lanes)

    Where you define your set of tasks (lanes) i.e App Store Release, Testflight Release, Ad-Hoc i.e App Store Release, Testflight Release, Ad-Hoc Release, Testing Release, Testing Each lane is comprised of Each lane is comprised of "Actions" "Actions"
  15. Fastfile Fastfile # Fastfile lane :appstore do # whatever actions

    you want for an App Store release end lane :testflight do # whatever actions you want for a Testflight release end Defining lanes is easy Defining lanes is easy
  16. Fastfile Fastfile # Fastfile before_all do |lane| # Executed before

    running the requested lane # Supports the same actions as lanes end after_all do |lane| # Executed after running the requested lane and # the lane ran succesfully. end error do |lane, exception| # Executed when an error occurs in any of the # `before_all`, the lane itself or `after_all` blocks end Helper blocks Helper blocks
  17. Actions Actions # Example Actions cocoapods # this will run

    pod install increment_version_number( # Makes app version from 1.1.0 to 1.2.0 bump_type: "minor" ) changelog_from_git_commits # Turns your git history into CHANGELOG ensure_git_branch( # Makes sure you're on the "release" branch branch: 'release' ) ensure_git_status_clean # Ensures no uncommited changes get deployed push_to_git_remote # Pushes `master` branch to `origin` remote push_git_tags # Pushes only tags and nothing else Numerous predefined "tasks" to use in your lanes. Numerous predefined "tasks" to use in your lanes.
  18. Actions Actions # Run tests scan( workspace: "MyApp.xcworkspace", scheme: "MyTests",

    clean: false ) # Build an IPA out of the app gym( workspace: "MyApp.xcworkspace", configuration: "Debug", scheme: "MyApp", silent: true, clean: true, # clean build folder first output_directory: "path/to/dir", output_name: "my-app.ipa" ) Fastlane tools are also actions! Fastlane tools are also actions!
  19. Real-life example Real-life example before_all do ENV["SLACK_URL"] = "https://hooks.slack.com/services/[REDACTED]" cocoapods

    end lane :test do desc "Run all tests in an iPad Air 2 Simulator" test_app end def test_app scan( scheme: "RevealFootball", configuration: "Testing", clean: false, device: "iPad Air 2", skip_slack: true ) end
  20. lane :appstore do test_app ensure_git_branch(branch: 'release') ensure_git_status_clean increment_version_number( bump_type: "minor"

    ) gym( scheme: "RevealFootball", configuration: "Release", output_directory: "./build/release", silent: true, clean: true ) deliver( ipa: "./build/release/Reveal Football.ipa", app_identifier: "com.insightreplay.Reveal-Football", skip_screenshots: true, skip_metadata: true ) commit_version_bump( message: "Build version bump by build script", force: true ) version_number = Actions.lane_context[Actions::SharedValues::VERSION_NUMBER] add_git_tag( tag: "Release-v#{version_number}" ) push_to_git_remote slack( message: "Reveal Football (#{version_number}) submitted to the App Store for review and release ", channel: "#reveal-ios", success: true, ) end
  21. lane :testflight do ensure_git_branch('develop') ensure_git_status_clean increment_build_number commit_version_bump gym( scheme: "RevealFootball",

    configuration: "Testflight", output_directory: "./build/beta", silent: true, clean: true ) pilot( ipa: "./build/beta/Reveal Football.ipa", app_identifier: "com.insightreplay.Reveal-Football.testflight", skip_submission: true ) slack( message: "New Testflight build pushed to ITC.", channel: "#reveal-ios", success: true, ) end Real-life example (testflight lane) Real-life example (testflight lane)