Travis 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 | You can get it from https://portal.testapp.io/settings/api-credentials | 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 or 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
We will demonstrate with our sample iOS project testappio-ios-sample-app to integrate TestApp.io with Travis-CI.
Configure iOS project for Fastlane
- Install Fastlane
The below command works for most cases. If not, please read this - Setup Fastlane
bundle install fastlane
- 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.
- Init
Match
Fastlane match is a tool for generating all necessary certificates and 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
.
- 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.
- 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.
- Configure
MATCH_PASSWORD
environment parameter in Travis CI
Go to Travis's repository Settings
page, add an environment parameter MATCH_PASSWORD
as below.
-
Configure
FASTLANE_PASSWORD
environment parameter in Travis CI
This is used for login your Apple ID to the Apple Developer's portal. -
Configure
GITHUB_API_TOKEN
environment parameters in Travis CI
Navigate to Tokens to generate a Personal Access Token, and create a GITHUB_API_TOKEN
environment parameter in Travis CI.
- Using
testappio
plugin for Fastlane
bundle exec fastlane add_plugin testappio
- Add environment parameters for
testappio
Fastlane plugin
AddTESTAPPIO_API_TOKEN
andTESTAPPIO_APP_ID
to Travis environment parameters.
Run the pipeline
- 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
More info on the Fastlane plugin: https://help.testapp.io/fastlane-plugin/#testappio-actions
You may already have your lane in place; copy the upload_to_testappio
action and put it into your pipeline after the IPA export.
- The Travis pipeline:
Create: .travis.yml
file under your project root folder. E.g.
language: swift
osx_image: xcode13.3
cache:
bundler: true
install:
- bundle install # install fastlane and its dependencies
script:
- echo "machine github.com login $GITHUB_API_TOKEN" >> ~/.netrc
- bundle exec fastlane ios development # run the lane
- Commit and push the change to trigger the Travis pipeline.
Android
We will demonstrate with our sample Android project testappio-android-sample to integrate TestApp.io with Travis-CI.
-
Add Travis environment parameters for
ta-cli
a.TESTAPPIO_API_TOKEN
b.TESTAPPIO_APP_ID
Check the configuration for more info -
Create
.travis.yml
file
language: android
jdk: openjdk11
dist: trusty
env:
- release_notes="My release notes here..." git_release_notes=false git_commit_id=false notify=true
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
before_script:
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
- OLDPATH=$PATH
- export PATH=$JAVA_HOME/bin:$PATH
- echo yes | sdkmanager "build-tools;30.0.3"
- echo yes | sdkmanager "platforms;android-31"
- export JAVA_HOME=~/openjdk11
- export PATH=$OLDPATH
script:
- ./gradlew assembleDebug
- 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=$release --apk=./app/build/outputs/apk/debug/app-debug.apk --release_notes=$release_notes --git_release_notes=$git_release_notes --git_commit_id=$git_commit_id --notify=$notify --source="Travis CI"
If you already have your Travis pipeline for testing/building your Android app, you could just put the below sections:
...
env:
- release_notes="My release notes here..." git_release_notes=false git_commit_id=false notify=true
...
script:
...
- 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=$release --apk=./app/build/outputs/apk/debug/app-debug.apk --release_notes=$release_notes --git_release_notes=$git_release_notes --git_commit_id=$git_commit_id --notify=$notify --source="Travis 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 🎉