Skip to main content

Circle CI

Circle 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

πŸ’‘ BETA mode. Your feedback is highly appreciated!

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

Configuration

Key

Description

Env Var(s)

Default

api_token

TESTAPPIO_API_TOKEN

app_id

You can get it from your app page at https://portal.testapp.io/apps

TESTAPPIO_APP_ID

release

It can be either both Android or iOS

TESTAPPIO_RELEASE

apk

Path to the Android APK file

TESTAPPIO_ANDROID_PATH

ipa

Path to the iOS IPA file

TESTAPPIO_IOS_PATH

release_notes

Manually add the release notes to be displayed for the testers.

TESTAPPIO_RELEASE_NOTES

git_release_notes

Collect release notes from the latest git commit message to be displayed for the testers: true or false

TESTAPPIO_GIT_RELEASE_NOTES

true

git_commit_id

Include the last commit ID in the release notes (works with both release notes options): true or false

TESTAPPIO_GIT_COMMIT_ID

false

notify

Send notifications to your team members about this release: true or false

TESTAPPIO_NOTIFY

false

Check TA-CLI for more info


iOS

Circle CI provides macOS executors to CI/CD pipeline, and it has Fastlane installed, so we don't need to install Fastlane in our pipeline.

We will use the testappio-ios-sample-app project to demonstrate how to use our ta-cli tool to upload your IPA file to TestApp.io.

Setup Circle CI project

Set up two project environment variables as below.

Project Settings -> Environment Variables -> Add Environment Variable

TESTAPPIO_API_TOKEN=
TESTAPPIO_APP_ID=

Check the configuration for more info

Configure iOS project for Fastlane

1. Install Fastlane


The below command works for most cases; however, please see Setup Fastlane if not.

bundle install 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 etc.

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 Git address if integrating with Circle CI

4. Generate the certificate and provision profile

bundle exec fastlane match adhoc

You can use ad-hoc, development, and enterprise.

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

πŸ’‘ You will be asked to provide a matching password for encrypting the certificates and profiles on the Git repository.

5. 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.

⚠️ Please don't choose Automatically manage signing

6. Using testappio plugin for Fastlane


In our project folder:

bundle exec fastlane add_plugin testappio

7. Upload IPA file to TestApp.io


Add an action, upload_to_testappio; the lane looks like the below:

# fastlane/fastfile
default_platform :ios

platform :ios do

before_all do
setup_circle_ci
end

...

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...", #TESTAPPIO_RELEASE_NOTES
git_release_notes: true, #TESTAPPIO_GIT_RELEASE_NOTES
git_commit_id: false, #TESTAPPIO_GIT_COMMIT_ID
notify: true #TESTAPPIO_NOTIFY
)
end
end

8. Add one step in the pipeline to install the plugin


In Circle CI's config.yml, add bundle install, e.g.

# ...
adhoc:
macos:
xcode: 12.5.1
steps:
# ...
- run: bundle install
- run: bundle exec fastlane adhoc
# ...

9. Make sure that the codesign is configured to "manual," or the gym step of the Circle CI pipeline will fail with the error "no provisioning profile found."

10. Push all the changes to the Git repository

Circle CI will build your project and upload your IPA file to TestApp.io for distribution πŸŽ‰


Android Project

We will use the Gestapo-android-sample project to demonstrate how to use our ta-cli tool to upload your APK file to TestApp.io.

Setup Circle CI project

Set up two project environment variables as below.

Project Settings -> Environment Variables -> Add Environment Variable

TESTAPPIO_API_TOKEN=
TESTAPPIO_APP_ID=

Check the configuration for more info

Create the Circle CI pipeline

Create .circleci/config.yml file under to project directory and copy the below snippet.

version: 2.1

orbs:
android: circleci/[email protected]

jobs:
build-and-upload:
executor:
name: android/android-machine
environment: #You can change the following
release_notes: "My release notes here..."
git_release_notes: false
git_commit_id: false
notify: true
steps:
# Checkout the code as the first step.
- checkout

# And next run the debug build
- run:
name: Assemble debug build
command: |
./gradlew assembleDebug
- run:
name: upload to TestApp.io
command: |
export INSTALL_DIR=/tmp
curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
$INSTALL_DIR/ta-cli publish --api_token=$TESTAPPIO_API_TOKEN --app_id=$TESTAPPIO_APP_ID --release="android" --apk=./app/build/outputs/apk/debug/app-debug.apk --release_notes=$release_notes --notify=$notify --git_release_notes=$git_release_notes --git_commit_id=$git_commit_id --source="Circle CI"

workflows:
default:
jobs:
- build-and-upload

If you already have the .circleci/config.yml file, you could copy the build-and-upload job to your pipeline.


If you want to choose the release version job:

      # And next run the release build
- run:
name: Assemble release build
command: |
./gradlew assembleRelease
- run:
name: upload to TestApp.io
command: |
export INSTALL_DIR=/tmp
curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash
$INSTALL_DIR/ta-cli publish --api_token=$TESTAPPIO_API_TOKEN --app_id=$TESTAPPIO_APP_ID --release="android" --apk=./app/build/outputs/apk/release/app-release.apk --release_notes=$release_notes --notify=$notify --git_release_notes=$git_release_notes --git_commit_id=$git_commit_id --source="Circle CI"


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?