Continues Integration for Android

Post on 15-Apr-2017

621 views 2 download

Transcript of Continues Integration for Android

Introducing

Continuous Integrationfor Android

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Benefits

Time is saved and responsibilities are delegated

- less management and oversight, more regularity

Signing credentials safety

On-a-plate project's health statistics

Immediate information sharing among team's members

- success/failure, health

Benefits

Drawbacks

Initial setup overhead

A server is needed

Drawbacks

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Components

Components

Setup

Setup (partial diagram)

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Jenkins

Well known (has many plugins and good support)

For each project there is one or more jobs

A job's execution is called a build

So called build steps allow to chain multiple actions

A finished build can trigger another job

Each job starts a new emulator instance

Jenkins - key facts

Gradle

Currently recommended build tool for Android

Highly flexible, very powerful

Transparent configuration format

Unified building process across machines

Dependencies resolved efficiently

Executes so called tasks, e.g. 'assemble', 'test',

'connectedCheck'

Gradle - key facts

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Secure signing

Well known (has many plugins and good support)

For each project there is one or more jobs

A job's execution is called a build

So called build steps allow to chain multiple actions

A finished build can trigger another job

Each job starts a new emulator instance

Secure signing

Requirements:each public build should be signedsigning keys for release builds should be kept safe

Secure signing

Solution:keep release keys only on the CI serverconfigure Gradle to use release keys if available(server case)otherwise make it use debug keys(dev's computer case)

Testing

Tests' types:unit testsUI tests on an emulator

Testing

Automation gains:verify codebase frequently to discover new bugs rapidlyrun all tests periodically to ensure full regression compliance

Code quality analysis

Automation gains:verify codebase frequently to discover new bugs rapidlyrun all tests periodically to ensure full regression compliance

Prevents bugs introduction

Improves future development's speed

Encourages good practices

Automatic inspections save developers' time

High-quality code makes developers happy

Code quality analysis

Team notification

Push messages to a Slack channel of choice

Post a job status change

E-mail notifications are also available but…

people tend to ignore those (or mark them as spam)

Team notification

Distribution

Easy APK sharing via Crashlytics (e.g. for QA teams)

Dedicated jobs use only special commits

(e.g. with a release tag)

Distribution

Is it worth it?

What's inside - unboxing

Who (and how) is pulling the strings

What can we automate

Summary

Agenda

Setup

Setup (full diagram)

Jenkinsresponsibilities

Fetches the code

Starts an emulator

Starts code analysis (Sonar Runner)

Invokes Gradle (!)

Collects and publishes artifacts and results

- APKs

- reports: lint, tests

Pushes notifications to Slack

Jenkins - responsibilities

Gradleresponsibilities

Builds the app (APK)

Signs the app

Performs Android-specific analysis (lint)

Performs unit tests

Performs UI tests

Gradle - responsibilities

What's next?

Other frameworks for UI tests

- Espresso, Android Testing Support Library

Other tools for continuous integration

- Team City

Direct APKs' upload to Google Play

Running tests on multiple emulators

Customized Slack notifications

What's next?

Thank you for your attention