Automate your build on Android with Jenkins

28
1 DEVELOPER MOBILE iOS Android BlackberryBadaWindowsPhone7 Tech Lead Mathieu Hausherr [email protected]

description

By Mathieu Hausherr (@mhausherr) from Octo Technology http://blog.octo.com/en/

Transcript of Automate your build on Android with Jenkins

Page 1: Automate your build on Android with Jenkins

1

DEVELOPER MOBILE iOS Android Blackberry Bada Windows Phone7 Te c h Lead

Mathieu Hausherr [email protected]

Page 2: Automate your build on Android with Jenkins

2

Continuous …

Continuous Integration

Continuous Delivery

Continuous Deployment

Page 3: Automate your build on Android with Jenkins

3

! Continuous Integration !   Each commit or per batch, the source code is :

!   Compiled !   Tested !   Deployed on Integration environment

! Continuous Delivery !   Each commit or per batch, the source code is :

!   […] !   Delivered to next team (QA, validation, production, …)

! Continuous Deployment

!   Each commit or per batch, the source code is : !   […] !   Deployed on Production environment

Definitions

Page 4: Automate your build on Android with Jenkins

4

Continuous Integration

Page 5: Automate your build on Android with Jenkins

5

One developer

Source Repository Compile

Deploy

Execute Tests

Check Code Quality

Document

Package

Testing

Page 6: Automate your build on Android with Jenkins

6

Many developers

Source Repository

Compile

Execute Tests

Check Code Quality

Document

Compile

Execute Tests

Check Code Quality

Document

Compile

Execute Tests

Check Code Quality

Document

Testing

Page 7: Automate your build on Android with Jenkins

7

Remove the anarchy with a Software Factory

Source Repository

Testing

Compile

Deploy

Execute Tests

Check Code Quality

Document

Package

Continuous Integration Server

Notifications

Page 8: Automate your build on Android with Jenkins

8

Advanced Software Factory

Source Repository

Continuous Integration Server

Notifications

Task and Issue Repository

Compile

Deploy

Execute Tests

Check Code Quality

Document

Package

Fetch Dependencies

Binary Repository

Documentation & KPIs

Test Platform

Page 9: Automate your build on Android with Jenkins

9

1- Two things

ü Source repository

ü One machine to build

How ?

Page 10: Automate your build on Android with Jenkins

10

2- Many principles to apply :

ü Maintain a code repository ü Automate the build ü Make the build self-testing ü Everyone commits more often ü Everyone can see the results of the latest build ü Automate deployment

How ?

Source : http://en.wikipedia.org/wiki/Continuous_integration

Page 11: Automate your build on Android with Jenkins

11

Continuous Delivery

Continuous Deployment

Page 12: Automate your build on Android with Jenkins

12

One big difference

Source : http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment

Team

1

Source Repository

2

Continuous Integration

Server

3

Tests (UAT, QA)

4

Deploy to production

5

Continuous Deployment auto

Continuous Delivery manual

Page 13: Automate your build on Android with Jenkins

13

Samples (for the backend)

1 deployment per day

~10 deployments per day

~25 deployments per day

~50 deployments per day

1 deployment every 11 seconds

2009/2010

Page 14: Automate your build on Android with Jenkins

14

! Continuous deployment, not continuous delivery ! Many factors prevent from doing continuous delivery

!   On iOS and WP the Store validation process !   On Android the regression testing process is long

!   Facebook is going for crowd testing on Android !   Android Beta Program

!   New releases are marketed towards the users and they expect them ! !   “42 new levels for Candy Crush !” !   “A new hero in Clash of Clans !” !   “A new budget feature for my mobile banking app !”

! The emerging standard is going to release every month

What about mobile Apps ?

Page 15: Automate your build on Android with Jenkins

15

! Improve TTM and feedback in real life

Why deploy continuously ?

IDEAS

CODE DATA

CODE FAST

MEASURE FAST

LEARN FAST

Page 16: Automate your build on Android with Jenkins

16

! Deploy every day at 4PM to the product team

! Product team come on the open space at 4:30 and give feedbacks

Meetic sample

Page 17: Automate your build on Android with Jenkins

17

! By decreasing deployment size !  Minimize risks !  Reduce the Mean Time To Repair (MTTR)

And quality ?

Page 18: Automate your build on Android with Jenkins

18

Installing Jenkins

! Manual Installation

!   Install Java ! Download jenkins.war !  Start the server

! Directly java –jar jenkins.war

!  Or with a Java Web Application Server !  Jenkins is accessible at : http://localhost:8080/

Page 19: Automate your build on Android with Jenkins

19

http://localhost:8080/

Page 20: Automate your build on Android with Jenkins

20

Install plugins

Page 21: Automate your build on Android with Jenkins

21

Distributed jobs

! Sometimes the CI Server can’t execute the build directly on the server !  For example on windows it’s impossible to build

Objective-C source code, you need a Mac for that.

! It’s the master/slave notion

MASTER SLAVE

execute the build on

Page 22: Automate your build on Android with Jenkins

22

Source code + tests

Source code + tests

Continuous Integration SOFTWARE FACTORY

Application checked

SCM

Automatic func. tests

Work Station

Work Station

Building Application

Automatic dev. tests

Check Quality rules

Deployment

Publish metrics

Document

Documentation

Page 23: Automate your build on Android with Jenkins

23

Source code + tests

Source code + tests

Continuous Integration on Android SOFTWARE FACTORY

Application checked

SCM

Automatic func. tests

Work Station

Work Station

Building Application

Automatic dev. tests

Check Quality rules

Deployment

Publish metrics

Document

Documentation

JAVADoc

LINT Emma

Page 24: Automate your build on Android with Jenkins

24

Quality-tools for Android

BUILD

Android – Focus

github.com/stephanenicolas/Quality-Tools-for-Android

Junit forAndroid

TESTS VM

è  Not running on JVM. Dalvik is necessary.

è Graphic environment and VirtualBox are necessary è No simultaneous run

Page 25: Automate your build on Android with Jenkins

25

! Specific solutions exist to handle deployment on mobile devices

! Specific MAM actors

! MDM solution also have this features

! Many plugins available

Deployment

Page 26: Automate your build on Android with Jenkins

26

Deployment

Page 27: Automate your build on Android with Jenkins

27

CI Server on the cloud

Page 28: Automate your build on Android with Jenkins

28

GUI & Metrics

Unit tests

Readability