Skip to main content

Bitrise

Bitrise CI pipeline allows you to build and upload both Android & iOS apps to TestApp.io to notify your testers for testing and feedback

Updated over 2 years ago

Bitrise CI pipeline allows you to build and upload both Android & iOS apps to TestApp.io to notify your testers for testing and feedback.

iOS

We will demonstrate with our sample project testappio-ios-sample-app to integrate TestApp.io with Bitrise CI.

git clone https://github.com/testappio/ios-sample-app.git
git checkout integration-bitrise

Configure iOS project for Fastlane

1. Install Fastlane

  • Create a ./Gemfile in the root directory of your project with the content below:

source "https://rubygems.org" gem "fastlane"
  • Run bundle update and add the ./Gemfile and the ./Gemfile.lock to version control.

For more details, please check Setup Fastlane


2. Init Fastlane


In the iOS project folder

bundle exec fastlane init

And follow the wizard; it will create ./fastlane/Appfile with your Apple ID and team.

3. Init Match

Fastlane match is a tool for generating all necessary certificates, provisioning profiles, and storing them in a GIT repository encrypted.

Create a private empty GitHub repository for storing certificates and provisioning profiles.

bundle exec fastlane match init

Follow the instruction, give the new empty git repository when asked, and it will create the Matchfile.

⚠️ Please use the HTTPS GIT repository address.

4. Generate the certificate and provision profile

bundle exec fastlane match adhoc

Following the instruction, it will generate certificates/profiles and store them in the GIT repository specified in the previous step.

⚠️ Provide a matching password for encrypting the certificates and profiles in the GIT repository.

5. Using testappio plugin for Fastlane

bundle exec fastlane add_plugin testappio

6. Select provisioning profiles in Xcode


The newly created certificates and profiles should now be possible to select inside our project. Open up Xcode and go to Signing & Capabilities.

⚠️ Note: Don't choose Automatically manage signing


Setup Bitrise

1. Configure MATCH_PASSWORD the secret parameter in Bitrise


Go to your Bitrise project page, and then Workflow, add a Secret parameter MATCH_PASSWORD as below.

2. Setup Bitrise Secret

Configure GITHUB_API_TOKEN secret parameter in Bitrise CI

Navigate to Tokens to generate a Personal Access Token, and create a GITHUB_API_TOKEN secret in Bitrise CI. This is for accessing the private certificate's repository.

3. Add secret parameters for testappio Fastlane plugin

TESTAPPIO_API_TOKEN
TESTAPPIO_APP_ID


Add TESTAPPIO_API_TOKEN and TESTAPPIO_APP_ID to Bitrise secret parameters.

Run the pipeline

4. Finally, create the lane

Create: ./fastlane/Fastfile And copy the below content:

default_platform(:ios)

platform :ios do

desc "Build the adhoc and upload to TestApp.io"
lane :beta do
match(type: "adhoc")
gym(export_method: "ad-hoc")
upload_to_testappio(
release_notes: "My release notes here...",
git_release_notes: true,
git_commit_id: false,
notify: true
)
end

end

You may already have your lane in place; copy the upload_to_testappio action and put it into your pipeline after the IPA export.

5. The Bitrise pipeline:


Create or update: bitrise.yml File under your project root folder. Or update your bitrise.yml accordingly if you have the bitrise.yml file stored and managed on bitrise.io.

---
format_version: '11'
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git'
project_type: ios
app:
envs:
- FASTLANE_XCODE_LIST_TIMEOUT: '120'
- opts:
is_expand: false
FASTLANE_WORK_DIR: .
- opts:
is_expand: false
FASTLANE_LANE: ios development
- opts:
is_expand: false
TESTAPPIO_NOTIFY: 'true'
- opts:
is_expand: false
MATCH_SKIP_CERTIFICATE_MATCHING: 'true'
workflows:
primary:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6: {}
- script@1:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x

# write your script here
echo "machine github.com login $GITHUB_API_TOKEN" >> ~/.netrc
- fastlane@3:
inputs:
- lane: $FASTLANE_LANE
- work_dir: $FASTLANE_WORK_DIR
meta:
bitrise.io:
stack: osx-xcode-13.2.x
machine_type_id: g2.4core
trigger_map:
- push_branch: main
workflow: primary

6. Commit and push the change to trigger the Bitrise pipeline.


Android

Sample project we used for following instructions, android-sample-app.

git clone https://github.com/testappio/android-sample-app.git

git checkout integration-bitrise

Configure the Android project for Fastlane.

1. Install Fastlane

  • Create a ./Gemfile in the root directory of your project with the content below:

source "https://rubygems.org" gem "fastlane"

  • Run bundle update and add the ./Gemfile and the ./Gemfile.lock to version control.

For more details, please see Setup Fastlane


2. Init Fastlane


In the Android project folder

bundle exec fastlane init

And follow the wizard; it will create ./fastlane/Appfile with the required information.

Setup Bitrise

1. Add secret parameters for testappio Fastlane plugin.

TESTAPPIO_API_TOKEN
TESTAPPIO_APP_ID


Add TESTAPPIO_API_TOKEN and TESTAPPIO_APP_ID to Bitrise secret parameters.

2. The Bitrise pipeline:


Create or update: bitrise.yml File under your project root folder. Or update your bitrise.yml accordingly if you have the bitrise.yml file stored and managed on bitrise.io.

---
format_version: '11'
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git'
project_type: android
app:
envs:
- FASTLANE_XCODE_LIST_TIMEOUT: '120'
- opts:
is_expand: false
FASTLANE_WORK_DIR: .
- opts:
is_expand: false
FASTLANE_LANE: android beta
workflows:
primary:
steps:
- activate-ssh-key@4:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@6: {}
- fastlane@3:
inputs:
- lane: $FASTLANE_LANE
- work_dir: $FASTLANE_WORK_DIR
meta:
bitrise.io:
stack: linux-docker-android-20.04
machine_type_id: elite
trigger_map:
- push_branch: main
workflow: primary

3. Commit and push the change to trigger the Bitrise pipeline.


Feedback & Support

Developers built TestApp.io to solve the pain of app distribution for mobile app development teams.

Join our community for feedback and support.

Happy releasing 🎉

Did this answer your question?