What is Fastlane
Fastlane can be confusing because it’s more than just one thing. It is a bunch of different tools that are used separately or together in lanes to give you whatever build you want. Some of the underlying tools are for iOS and some are for Android and some of these available tools work for both platforms. Figure 1 shows three different example lanes.
The first lane uses scan to run your tests followed by snapshot to generate screenshots for iTunes on all devices so you don’t have to spend any time generating them. Scan and snapshot both use underlying Xcode commands but they hide its complexity.
Lane 2 scans again but then adds pilot to upload and distributes your builds on Testflight. Slack sends a message on a slack channel to tell your colleagues that your app has been built and to go and install it.
Lane 3 first scans and takes snapshots again. This is followed by sigh which manages your provisioning profiles, gym builds your app and deliver deploys your app to iTunes in a single command.
And that’s not every tool there’s also frameit, pem, supply, screengrab as well as a number of other third party tools.
How To Create Lanes
To create your own fastlane take the following steps
1. Download and install fastlane using the brew cask install fastlane command
2. Run fastlane init which will gather your iTunes or Google Play information and create a fastlane directory and config file called Fastfile
3. Edit the config file and create your own lane, in the example below we’re using gym to build the ETAMock app.
4. Run fastlane [lane_name] or in our case fastlane beta
lane :beta do gym(scheme: "ETAMock", workspace: "ETAMock.xcworkspace", include_bitcode: true) end Listing 1: Fastfile config file
Fastlane also has an interactive tool for building more complicated Fastfile config files.
Fastlane is an open source Ruby project that was created by Felix Krauze. It’s been around since 2014 in one form or another and is part of Fabric suite of tools. Up until Jan 2017 it was under the Twitter umbrella but is now owned by Google. However Fastlane will work for both iOS and Android builds.
Fastlane brings a great deal of speed and simplicity to a task that can be confusing and error prone. It codifies the complexity of the build process so that cross training teams to do the builds becomes trivial. You can use it from the command line or preferably from a Continuous Integration server.