In a large engineering team, while mobile developers work on different modules and features, collaboration can become a little challenging. For things to go seamlessly, teams can automate their tasks by using different tools and services, such as fastlane, to unify their processes across all team members.
In our previous article about fastlane actions, we already collected some of the best actions you can use to make your life easier. Now it's time to talk about the plugins!
fastlane is an open-source platform aimed at simplifying Android and iOS deployment. It lets you automate every aspect of your development and release workflow and it’s the easiest way to build and release mobile apps.
- fastlane’s automation tasks can save you hours, especially every time you push a new release to the store or beta testing service.
- It integrates with more than 400 tools and services
- It offers easy setup, runs on your machine, and integrates with all major CI systems such as Bitrise, CircleCI, GitHub Actions, and more
- It supports iOS, Mac, Android, and cross-platform apps, such as Flutter
Getting started with fastlane
fastlane supports Ruby versions 2.5 or newer. More about the setup can be found here.
Then you can initialize fastlane into your iOS or Android app by the following command:
After that, you will have a fastlane folder with a Fastfile in it. You can start adding your lanes for different tasks like running unit tests, UI tests, check code style, deploy your app, and more.
Now, let’s explore which fastlane plugins are the most useful and most commonly used by developers:
1. XCOV: Code coverage reporting without hassle
2. trainer: Convert xcodebuild plist and xcresult files to JUnit reports
3. test_center: This plugin makes testing your iOS app easier by providing you actions that give you greater control over everything related to testing your app. You can use multi_scan to improve the iOS test results, reduce test run time, inspect partial results periodically during a test run, and provide better results reporting.
4. fastlane-plugin-room: A S3 cache tool for Carthage, Rome is a tool that allows developers on Apple platforms to use: Amazon's S3, Minio, Ceph, other S3 compatible object stores, or/and a local folder.
5. fastlane-plugin-appicon: Generate required icon sizes and icon sets from a master application icon.
6. fastlane-plugin-changelog: Automate changes to your project CHANGELOG.md with actions like read_changelog and update_changelog.
7. Fastlane-plugin-flutter: Automates end-to-end tests (download Flutter, create an app, build it) on different platforms such as macOS (iOS and Android), Ubuntu Linux (Android), and Windows (Android).
8. firebase App Distribution: Makes distributing your apps to trusted testers painless. By getting your apps onto testers' devices quickly, you can get feedback early and often.
9. fastlane-plugin-aws_device_farm: This allows you to run the XCUITests for iOS, Android Instrumentation tests, and Appium tests on AWS device Farm.
10. fastlane-plugin-xchtmlreport: Fastlane plugin for XCHTMLReport
11. fastlane-plugin-firebase_test_lab: This lets you easily test your apps on a variety of real or virtual devices and configurations. It allows you to submit your app to Firebase Test Lab by adding action into your Fastfile.
12. fastlane-plugin-bitrise-automation: This lets you interact with Bitrise projects from fastlane. It allows you to trigger a Bitrise Workflow and its related information using the Bitrise API.
How to add a fastlane plugin into the Fastfile?
You can add your preferred fastlane plugin by running the following commandline:
You will notice that a new file will be created inside the fastlane folder called Pluginfile.
Now you can use the plugin inside your Fastfile, for example, the multiscan for iOS test parallelization.
Bitrise and fastlane
With Bitrise, you can run your fastlane lanes with the same commands you would use locally. Bitrise’s automated Steps provide extra functionality to your lanes and speed up your builds.
Bitrise has an automated Step for running your lanes in the CI/CD pipelines, and there is another step called Fastlane Match which takes care of the code signing your project by cloning your private certificate/profile repository and registering the certificates and profiles in the keychain. For more information, read the guide for Integrating Fastlane into Bitrise.
For more info about fastlane, check out this article by Alex Logan, Senior iOS Engineer: Automate iOS builds & tests with fastlane
Thank you for reading this article. Stay safe and happy learning!