Continuous Integration and Delivery toolchain for native Android and iOS applications, built with Docker, Jenkins, Sonarqube, Fastlane, GitHub, Xcode, Android SDK, Cucumber and Firebase. Testing steps are based on a BDD workflow.
Automated BDD tests are written in Gherkin definitions (.feature
files). Gherkin tests are implemented with native Android instrumented tests and iOS XCUITests, feature files are interpreted by GreenCoffee and Cucumberish.
Following test feature definitions are used for this example: Mobile-CI-Gherkin
Test feature runs on following mobile applications:
- Android: Mobile-CI-Android-Example
- iOS: Mobile-CI-iOS-Example
CI and CD pipelines (defined in jenkinsfile) contain the following steps:
Trigger: new feature
branch (with pull request on develop
branch).
- Code analysis and lint check with Sonarqube.
- Run Unit tests.
- Run mocked UI test (tagged with @smoke) in cloud with native instrumented test.
- Code analysis and lint check with Sonarqube.
- Report feedback to GitHub.
Trigger: new release
branch.
- Run full e2e regression testsuit (all Gherkin tests) native instrumented test.
- Save build to artifactory (JFrog & GitHub in this case) with fastlane.
- Upload build to Firebase App Distribution with fastlane.
- Upload build to Play Store Beta and Testflight.
- nginx: Used as a simple reverse proxy for this stack. But features of nginx can be expanded (e.g. with load balancing).
- Jenkins: Custom Jenkins master slave prepared with plugins and slaves for mobile DevOps. dpal/docker-jenkins-mobile-ci
- SonarQube: SonarQube with plugins installed for this mobile DevOps stack dpal/docker-sonarqube-mobile-ci
- Artifactory: JFrog is used for current example. Nexus can be an alternative, but JFrog CLI commands need to be replaced.
Running this toolchain requires Docker, and a macOS slave with XCode and Android SDK installed.
- Pull repository:
git clone https://github.com/Paldom/Mobile-CI.git
- Run
docker-compose
:
docker-compose up -d
- Set up a Jenkins slave
Follow the guide below about how to set up a Jenkins slave for Android and iOS on a physical device.
- Configure Jenkins, environment variables, connect slave
Enable registration on Jenkins, create an admin user, after that enable security for login.
Find default configuration of mac
slave and set the correct address, credentials and connection protocol.
Set up proper environment variable values for mac
slave:
APP_STORE_API_ISSUER_ID
,APP_STORE_API_KEY_CONTENT
,APP_STORE_API_KEY_ID
- App Store Connent API key.APPLE_ID
- Your Apple Developer ID.FASTLANE_PASSWORD
- Your Apple Developer password.ITC_TEAM_ID
- Itunes Connect Team ID.KEYSTORE_ALIAS
,KEYSTORE_ALIAS_PASSWORD
,KEYSTORE_PASSWORD
- defaullt keystore setup, it is preferred to use different credentials for each of your android project.MATCH_PASSWORD
- Password to encrypt/decrypt profiles generated withmatch
.TEAM_ID
- Apple Developer Team ID.
Set up the address of your Jenkins master at Manage Jenkins > Configure System > Jenkins Location > Jenkins URL.
- Fork example repositories
Fork the following example repositories:
- Android: Mobile-CI-Android-Example
- iOS: Mobile-CI-iOS-Example
Change the Team ID and Signing Identity according to your Apple Developer account in the iOS
project.
- Add your forked repositories to Jenkins, configure Jenkins to scan branches periodically. Commit and watch pipline running.
Add multi branch pipeline on Jenkins Admin, or with Jenkins Blue Interface (/blue/create-pipeline
). Configure pipeline to scan branches periodically so that new branches or commits can trigger a run.