Fastlane (iOS)

(5 minute setup time)

Install the plugin

The Emerge Fastlane Plugin makes it easy to upload iOS builds in your CI pipeline. You can add it to your project by running:

fastlane add_plugin emerge

Call the upload API

In your Fastfile, provide the API key as an environment variable (ideally without including it in source control, for security) and run the Emerge action like so:

ENV['EMERGE_API_TOKEN'] = 'COPIED_FROM_EMERGETOOLS_PROFILE'

platform {:ios} do
  lane :app_size do
    emerge(file_path: "/path/to/your/.xcarchive")
  end
end

This will upload the provided archive to Emerge for processing and print a URL to view the results.

πŸ“˜

Fastlane Context

The archive path can be shared from your other lane steps using lane_context. If you're already building the app in Fastlane with build_app you can omit the file_path parameter and it will be automatically inferred from context.

Setup PR diffs

A few extra arguments are required for PR comments to work:

  • sha: The SHA of the commit that your app was built from.
  • base_sha: The SHA of the base commit your app was built from. For example, the last commit from main before you created the current branch.
  • branch: The name of your current Git branch.
  • repo_name: Name of your GitHub repository.
  • pr_number: Number of the pull request that triggered this build.

Optionally, include the following for additional information:

  • build_type: A string indicating what type of build this is, defaults to "development".

These parameters work with the Emerge GitHub app to find the base build that was already uploaded and post the comment to your PR.

emerge(
  file_path: "/path/to/your/.xcarchive",
  repo_name: "EmergeTools/MyAwesomeApp",
  pr_number: "2",
  sha: "full git SHA",
  base_sha: "full git SHA",
  build_type: "Optional, 'development' by default"
)

πŸ‘

Congrats on integrating Fastlane with Emerge!

Please feel free to contact support with any issues or feedback!


What’s Next

Set up Github integration so a PR comment can be automatically posted.