Skip to content

Quick simple setup using TAB defaults

Neil Horton edited this page Mar 28, 2017 · 8 revisions

The following describes the easiest, quickest way to setup fastlane for your awesome iOS project. First things first make sure you have fastlane added to your Gemfile or at least on your local machine.

Setting up your Fastfile and Appfile

To setup your project to use the master Fastfile go to your project root directory and run the following command

$ curl https://raw.githubusercontent.com/theappbusiness/MasterFastfile/master/setup.sh | sh

This will download and execute a small shell script which will create all the necessary default files.

The TABMasterFastfile defines the following lanes

  • test
    • runs tests
  • hockey
    • runs tests
    • sets build number
    • adds build info to app icon
    • builds and archives project
    • generates changelog from git commits
    • uploads app to hockey
  • hockey_no_test
    • sets build number
    • adds build info to app icon
    • builds and archives project
    • generates changelog from git commits
    • uploads app to hockey

Setting up your environment

Before we can run our any of our lanes we need to set up our environment. This for once is a relatively pain free experience so fret not!!! Fastlane uses .env files to define a list of environment variables. If we create a .env.default file any environment variable declared here will automatically be set when fastlane executes. In the .env.default file we define environment variables as follows

ENV_VARIABLE_NAME=value

To complete setup fill in the variables created for you in the .env files created by the shell script. Each variable has a short description of the nature of the variable and the following section acts as a reference for more details

Fastlane Environment variables

GYM_SCHEME - REQUIRED

Name of xcode scheme to build

GYM_CODE_SIGNING_IDENTITY - REQUIRED

Code Signing identity to use

FL_HOCKEY_TEAMS - REQUIRED

Hockey team that has access to app

FL_HOCKEY_API_TOKEN - REQUIRED

Your Hockey API token

FL_UPDATE_PLIST_PATH - REQUIRED

The path to your app Info.plist

FL_UPDATE_PLIST_APP_IDENTIFIER - REQUIRED

The value for the app bundle ID

FL_HOCKEY_PUBLIC_IDENTIFIER - REQUIRED

Hockey App ID

FL_HOCKEY_OWNER_ID - REQUIRED

ID of the organisation or individual who owns the app

FL_HOCKEY_NOTIFY

1 to email hockey team that new build is ready 0 to not notify

FL_UPDATE_PLIST_DISPLAY_NAME

The display name of your app

FL_PROJECT_SIGNING_PROJECT_PATH

Path to your project file (not workspace), If this and FL_PROJECT_TEAM_ID are set all MasterFastfile builds will explicitly set the TEAM ID used to build the app.

FL_PROJECT_TEAM_ID

Team ID you want to set. If this and FL_PROJECT_TEAM_ID are set all MasterFastfile builds will explicitly set the TEAM ID used to build the app.

TAB Environment variables

ICON_OVERLAY_ASSETS_BUNDLE - REQUIRED

Location of Assets.xcassets can be replaced by ICON_OVERLAY_SOURCE_PATH if not using xcassets.

ICON_OVERLAY_SOURCE_PATH

Loaction of AppIcons when not using xcassets REQUIRED if ICON_OVERLAY_ASSETS_BUNDLE not set

XCODE_PATH

Path to Xcode app to use

TAB_USE_TIME_FOR_BUILD_NUMBER

Boolean value if set to true will set the apps build number to the current time.

If value set to false or missing the build number will be set as the jenkins or teamcity build number.

Running fastlane

We can now run fastlane from our project root with the following

$ fastlane test

or

$ fastlane hockey

or

$ fastlane hockey_no_test

Next: Supporting multiple environments

Home