Paldom / Mobile-CI

Jenkins based mobile CI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mobile-CI

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.

BDD

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.

Gherkin example

Following test feature definitions are used for this example: Mobile-CI-Gherkin

Mobile applications

Test feature runs on following mobile applications:

Pipeline

CI and CD pipelines (defined in jenkinsfile) contain the following steps:

CI Pipeline

Trigger: new feature branch (with pull request on develop branch).

  1. Code analysis and lint check with Sonarqube.
  2. Run Unit tests.
  3. Run mocked UI test (tagged with @smoke) in cloud with native instrumented test.
  4. Code analysis and lint check with Sonarqube.
  5. Report feedback to GitHub.

CD Pipline

Trigger: new release branch.

  1. Run full e2e regression testsuit (all Gherkin tests) native instrumented test.
  2. Save build to artifactory (JFrog & GitHub in this case) with fastlane.
  3. Upload build to Firebase App Distribution with fastlane.
  4. Upload build to Play Store Beta and Testflight.

Architecture and docker images

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

Requirements and prerequisites

Running this toolchain requires Docker, and a macOS slave with XCode and Android SDK installed.

Instructions

  1. Pull repository:
git clone https://github.com/Paldom/Mobile-CI.git
  1. Run docker-compose:
docker-compose up -d
  1. 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.

Jenkins node on Mac OS

  1. 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 with match.
  • TEAM_ID - Apple Developer Team ID.

Set up the address of your Jenkins master at Manage Jenkins > Configure System > Jenkins Location > Jenkins URL.

  1. Fork example repositories

Fork the following example repositories:

Change the Team ID and Signing Identity according to your Apple Developer account in the iOS project.

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

About

Jenkins based mobile CI.

License:MIT License