Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Fastlane

Gabriela Coelho edited this page Jan 7, 2021 · 18 revisions

fastlane

https://fastlane.tools/

fastlane is a suite of tools to automate the construction and deploy of Android and iOS applications.

In Beagle, fastlane is used to perform actions within Github Actions.

TL;DR

Project lanes by platform:

Setup overview

Installation

fastlane can be installed in multiple ways. The installation of fastlane in the Beagle repository is done by creating the ./Gemfile file and adding the gem "fastlane" command to the file.

To use fastlane in a Github Actions workflow, it is necessary to install it in one step of the workflow, as shown below:

(…)
steps:
    -   name: Install Fastlane
        run: bundle config set path '~/.gem' && bundle install
(…)

Configuration

fastlane configuration is done by adding the ./fastlane directory to the repository. This directory contains two important files:

  • Appfile which defines configuration information that is global to your app
  • Fastfile which defines the "lanes" that drive the behavior of fastlane

Fastfile

Fastfile contains the definition of all the lanes that can be executed by fastlane in the project. The basic structure of a Fastfile is:

platform :yourPlatform do
  desc "A fastlane lane"
  lane :aFastlaneLane do
    ...
  end
  desc "Another fastlane lane"
  lane :anotherFastlaneLane do
    ...
  end
end

A lane definition may be done outside of a platform block. The platform bock is only a way to group platform specific lanes.

lanes

A lane is a block of code similar to a function definition. It can have parameters and return values. See the official documentation for more information.

How to run a lane

To run a lane in fastlane, use the command bundle exec fastlane [platform] [lane] [params]

Actions and Plugins

fastlane has a list of standard actions, which can be found at fastlane actions.

It is also possible to add plugins to Fastlane. The plugins make it possible to add new actions to the set of standard Fastlane actions. Here you can find the fastlane officially supported plugins list.

Plugins used by Beagle pipeline:

danger

Official documentation

Danger is an action used to formalize the rules of a pull request.

In Beagle pipeline, danger is used to perform some checks and analysis of reports depending on the context of the pull request.

The installation of danger in the Beagle repository is done by adding the command gem "danger" in the ./Gemfile file.

The actions that the danger performs are configured in a file called Dangerfile. In Beagle repository, this file is located in the ./danger directory. In this directory, we have the Dangerfile files separated by platform, so, depending on the context of the pull request, a different Dangerfile is used.

danger-checkstyle_format

Official documentation

This plugin receives the report generated by the gradle task detekt as input, parses it and adds the report's warnings and errors to the PR.

The installation of danger-checkstyle_format in Fastlane is done by adding the command gem "danger-checkstyle_format" in the ./Gemfile file.

danger-android_lint

Official documentation

This plugin receives as input the report generated by the gradle's lintDebug task, parses it and adds the code snippets identified as a problem by the lint as a change request in the PR.

The installation of danger-checkstyle_format in Fastlane is done by adding the command gem "danger-android_lint" in the ./Gemfile file.

danger-junit

Official documentation

This plugin receives the report generated by the gradle task test, parses it and adds the errors that occurred in the unit tests to the PR.

The installation of danger-junit in Fastlane is done by adding the command gem "danger-junit" in the ./Gemfile file.

danger-flutter_lint

Official documentation

This plugin receives the file flutter_analyze_report.txt as input and adds the code snippets identified as a problem by the lint as a change request in the PR.

The flutter_analyze_report.txt file is generated through the flutter analyze command in the flutter's pull_request_verification lane.

The installation of danger-junit in Fastlane is done by adding the command gem "danger-flutter_lint" in the ./Gemfile file.

danger-swiftlint

Official documentation

The installation of danger-swiftlint in Fastlane is done by adding the command gem "danger-swiftlint" in the ./Gemfile file.

fastlane-plugin-codecov_reporter

Official documentation

The installation of fastlane-plugin-codecov_reporter on fastlane is done by adding the command gem "fastlane-plugin-codecov_reporter" to the ./fastlane/Pluginfile file.

This plugin uploads the code coverage information for the project to Codecov.

fastlane-plugin-semantic_release

Official documentation

The installation of fastlane-plugin-semantic_release on fastlane is done by adding the command gem "fastlane-plugin-semantic_release" to the ./fastlane/Pluginfile file.

This plugin is used to generate release notes.