Continuous Delivery for Mobile with fastlane

Book description

Learn continuous deployment and automation with code-signing, continuous testing, building, deploying, and releasing of your app.

About This Book

  • A practical guide on automating your mobile development pipeline with Fastlane, Jenkins, and Slack.
  • Build, test, run and deploy your mobile application release with this end to end guide.
  • Implement Continuous Integration, delivery, and deployment practices to optimize your application development workflow for faster and efficient release builds.

Who This Book Is For

This book is intended for mobile developers who are keen on incorporating Continuous integration and deployment practices in their workflow.

What You Will Learn

  • Harness the fastlane tools for the Continuous Deployment strategy
  • Integrate Continuous Deployment with existing Continuous Integration.
  • Automate upload of screenshots across all device screen-sizes
  • Manage push notifications, provisioning profiles, and code-signing certificates
  • Orchestrate automated build and deployments of new versions of your app
  • Regulate your TestFlight users and on-board new testers

In Detail

Competitive mobile apps depend strongly on the development team's ability to deliver successful releases, consistently and often. Although continuous integration took a more mainstream priority among the development industry, companies are starting to realize the importance of continuity beyond integration and testing.

This book starts off with a brief introduction to fastlane—a robust command-line tool that enables iOS and Android developers to automate their releasing workflow.

The book then explores and guides you through all of its features and utilities; it provides the reader a comprehensive understanding of the tool and how to implement them. Themes include setting up and managing your certificates and provisioning and push notification profiles; automating the creation of apps and managing the app metadata on iTunes Connect and the Apple Developer Portal; and building, distributing and publishing your apps to the App Store.

You will also learn how to automate the generation of localized screenshots and mesh your continuous delivery workflow into a continuous integration workflow for a more robust setup. By the end of the book, you will gain substantial knowledge on delivering bug free, developer-independent, and stable application release cycle.

Style and approach

A step by step guide taking the readers through all the tools of fastlane.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Continuous Delivery for Mobile with fastlane
  3. Dedication
    1. Why subscribe?
  5. Foreword
  6. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  8. Introduction to fastlane and Continuous Delivery
    1. Welcome to fastlane
      1. Automation testing
        1. Unit testing
        2. Regression testing
        3. Integration testing
        4. Acceptance testing 
      2. Continuous Integration 
      3. Continuous Deployment
      4. What is continuous delivery?
      5. Benefits of CI, delivery, and deployment
    2. What is fastlane?
      1. Why fastlane?
      2. The fastlane suite of tools
      3. Spaceship under the hood
    3. Accessing the fastlane documentation
    4. Summary
  9. Setting Up fastlane and Our Sample Project
    1. Installing the Xcode command-line tools
      1. Installing Homebrew, Git, and fastlane
        1. Alternative methods of installing fastlane 
      2. Updating fastlane
      3. Installing Carthage
      4. Troubleshooting common problems
    2. Setting up our project – Firefox for iOS
      1. Running Firefox for iOS
    3. Configuring fastlane
      1. Updating fastlane
    4. Summary
  10. Manage Provisioning Profiles with sigh
    1. Introduction
    2. Development distribution overview
      1. Enrollment
        1. Individuals
        2. Organizations
        3. Educational institutions
      2. Develop
      3. Distribute
    3. What are provisioning profiles?
      1. About Bundle IDs
      2. Types of provisioning profiles
        1. The development team provisioning profile
        2. Ad hoc provisioning profile
        3. App Store provisioning profile
        4. Enterprise provisioning profiles
      3. Expiration of provisioning profiles
    4. Introducing sigh
      1. Usage
        1. List of sigh commands
      2. Our project problem
      3. Updating our Fastfile
    5. Summary
  11. Manage Code Signing Certificates with cert
    1. What you will learn
      1. Skills learned
    2. What are certificates?
      1. Developer and distribution certificates
        1. Development certificate
        2. Distribution certificate
      2. Managing certificates manually
        1. Creating a certificate through Xcode
        2. Creating a certificate through the developer portal
        3. Verifying the private/public keys in keychain throughout this workflow, when using your certificate and provisioning profile, you need
        4. Installing missing intermediate certificate authorities
        5. Recreating certificates
        6. Backing up certificates and provisioning profiles
    3. Introducing cert
      1. Usage
      2. List of cert commands
      3. Our project problem
    4. Updating our fastfile
    5. Summary
  12. Sync Profiles and Certificates with match
    1. Collective code signing
      1. Security 
        1. Portal access management
        2. Git access management
        3. Encryption
    2. Introducing match
      1. Create a private Git repository
      2. Initialize match
      3. Running match for the first time
      4. Recreating development certificates and provisioning profiles
      5. Adding new team members
      6. Handling multiple targets
      7. Adding new devices
    3. Our project problem
      1. List of match commands
    4. Summary
  13. Manage Push Notification Profiles with pem
    1. What push notifications are
      1. How push notifications work
        1. Provider
        2. APNs
        3. APNs-device trust connection
      2. Local versus remote push notifications
    2. Enabling push notifications
      1. Enabling push notifications the traditional way via Xcode
    3. Introducing pem
      1. List of pem commands
    4. Updating our Fastfile
    5. Summary
  14. Creating Our iOS and Android Apps with produce and supply
    1. The process of creating an iOS
      1. Registering your App ID with produce
      2. Provisioning your app
      3. Certificating your app
      4. Distributing code-signing identities
      5. Managing push notifications
      6. Building and packaging your app
      7. iTunes Connect versus Developer portal
      8. Adding capabilities
        1. iCloud/CloudKit
        2. Passbook/Wallet
        3. Apple Pay
        4. In-App Purchase
        5. Map/Location
        6. Background Modes
        7. App Groups
        8. Inter-App Audio
        9. HealthKit
        10. Data Protection
        11. Adding HomeKit support
        12. Adding Associated Domains support
        13. Keychain sharing support
        14. Push notifications
    2. Introducing produce
      1. Usage
      2. Enabling services
      3. Optional parameters
        1. App and bundle ID
        2. Skipping iTunes Connect or Dev Center
        3. Creating and associating a new app group
      4. Updating our Fastfile
    3. Introducing supply
      1. Setting up a Google Play developer account
      2. Setting up fastlane and supply
      3. Using supply
    4. Summary
  15. Build and Package Apps for the App Store with gym
    1. Traditional process of building an app
      1. Using Xcode to build an app
        1. Distributing your app for testing
      2. Using xcodebuild to build an app for testing
    2. Introducing gym
      1. Usage
      2. Parameters and options
    3. Manifest files/app thinning
      1. Storing gym configurations externally with a Gymfile
      2. Exporting plist files
    4. Updating our Fastfile
    5. Summary
  16. Distribute to Testers with TestFlight and Crashlytics
    1. An overview of testing
    2. Continuous delivery and testing
    3. Beta testing tools
      1. Overview of TestFlight
        1. Setting up TestFlight
          1. App information
          2. Upload your test build
          3. Managing and adding internal and external testers
          4. View tester information
      2. Crashlytics
        1. Setting up Crashlytics
        2. Distributing to Crashlytics manually
    4. Introducing Pilot
      1. Uploading a TestFlight build with fastlane
        1. Listing all the builds
      2. Managing TestFlight users with fastlane
        1. Onboard new testers on TestFlight with onboard
      3. Updating our Fastfile
        1. Crashlytics and fastlane
    5. Summary
  17. Review Your App Metadata with precheck
    1. An overview of App Store rules
      1. App Store Review Guidelines
        1. Safety
          1. Objectionable content
          2. User-generated content
          3. Child content
          4. Physical harm
          5. Developer information
        2. Performance related issues
        3. Business related issues
        4. Design related issues
        5. Legal related issues
    2. Common app rejections
      1. Handy guideline references
    3. Introducing precheck
      1. Running a precheck
      2. Precheckfile configuration
      3. Updating our Fastfile
    4. Summary
  18. Taking Localized Screenshots with snapshot
    1. An overview of capturing screenshots on iOS simulator
    2. An overview of UI testing
      1. XCTest framework
        1. UI tests
          1. XCUIApplication
          2. XCUIElement
          3. XCUIElementQuery
      2. Accessibility
    3. Introducing snapshot
      1. Setting up snapshot in your project
        1. Creating the UI Test Target
        2. Initializing snapshot
        3. Adding SnapshotHelper.swift to the target
        4. Recording your app interactions
        5. Generating snapshots
        6. Confirming the screenshots
      2. Other snapshot options
      3. Working with snapfiles
      4. Running Xcode simulators concurrently
      5. Updating our Fastfile
    4. An introduction to screengrab
    5. Summary
  19. Put Our Screenshots Inside Frames with frameit
    1. An overview of how to design your App Store product page screenshots
      1. Beautifying screenshots
        1. Downloading the template files
        2. Adding your own screenshots
      2. Exporting the screenshots
        1. Dealing with device variants for screenshots
    2. Introducing frameit
      1. Running a basic frameit command
      2. Making our frames App Store compliant
      3. Updating our Fastfile
    3. Summary
  20. Upload Screenshots and Metadata with deliver
    1. How to manually upload a new build to iTunes Connect
      1. Uploading using Xcode
        1. Updating version and build number
        2. Archiving
        3. Uploading using Application Loader
      2. Entering your app metadata
      3. Submitting your app to be reviewed
    2. Introducing deliver
      1. Generating your deliverfile metadata
      2. Uploading our metadata
      3. Other deliver options
      4. Updating our Fastfile
    3. Summary
  21. Automate Unit Tests with scan
    1. An introduction to testing in iOS 11 and Swift 4
      1. Create a test target
      2. Adding a simple unit test
      3. Examining other test cases
    2. Introducing scan
      1. Running a simple scan
        1. Viewing the output results
      2. Running a specific scan
      3. Generating a Scanfile
      4. Updating our Fastfile
    3. Summary
  22. Integrating Git into the fastlane Workflow
    1. Introducing the various Git actions and commands
      1. ensure_git_status_clean
      2. ensure_git_branch
      3. create_pull_request
      4. git_pull
      5. git_commit
      6. push_to_git_remote
      7. git_tag_exists
      8. add_git_tag
      9. push_git_tags
    2. Calling bash commands using fastlane
    3. Improving and optimizing our fastlane workflow
      1. Working with the before_all lane
        1. Ensuring our fastlane is always the latest
      2. Optimizing our beta distribution workflow
        1. Getting the latest code and ensuring a clean Git status
        2. Building our app and running tests
        3. Getting a list of commits to form the changelog
        4. Bumping our project version, committing, and pushing our changes to Git
    4. Summary
  23. Creating and Using fastlane Action Plugins
    1. Discovering new action plugins
      1. build-in plugins
      2. Third-party plugins
    2. Implementing a fastlane plugin
      2. self.description
      3. self.details
      4. self.available_options
      5. self.example_code
      6. self.category
      7. self.authors
    3. Creating your own fastlane plugin
      1. Creating our new plugin
      2. Creating our first Action
      3. Testing our plugin
    4. Publishing your plugin
    5. Summary
  24. Integrating Slack into the fastlane Workflow
    1. Introducing Slack – a developer's communications platform of choice
    2. Configuring Slack webhooks to connect to fastlane
    3. Adding Slack actions into our workflow
      1. Slack action arguments
    4. Summary
  25. Continuous Delivery Best Practices
    1. Organizing your lanes
      1. before_all and after_all lanes
      2. Managing errors and exceptions
      3. Managing the rest of our lanes
    2. Making use of configuration files
      1. Appfile
      2. Deliverfile
      3. Gymfile
      4. Snapfile
      5. Framefile
      6. Matchfile
      7. Scanfile
      8. Real-world examples of configuration files
    3. Private lanes and lane contexts
    4. Final words
  26. Configurations, Tools, and Resources
    1. What you will learn
      1. Skills learned
    2. Working with fastlane and Gemfiles
    3. Setting up two-factor authentication for your CI
    4. Online resources
  27. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Continuous Delivery for Mobile with fastlane
  • Author(s): Doron Katz
  • Release date: February 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788398510