continuous integration · 2018-11-09 · continuous integration and build server written in java...

Post on 27-May-2020

2 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Continuous Integration

Svetlana OmelkovaSoftware Engineer

Taxify

About me● (till Oct.18) Nevercode.io Full Stack Software Engineer

○ CI service for mobile (Android, iOS, Cordova, Ionic frameworks)

○ Python, Django, AWS, MacMiniVault

● (currently) Full Stack Software Engineer at Taxify○ Nodejs stack, Javascript, Jenkins CI

● TA for software engineering and testing courses

AgendaTheory

● What is Continuous Integration? ● Why to practice CI?● What are CI steps?● CI best practices

Practice

● Tools and technologies

● Cloud based vs. self hosted solutions

Demo: Travis CI for open source projects

What is “Continuous”

What is Continuous Integration(CI)?It is

❏ It is a development methodology

❏ of continuous developer integrations

❏ verified by automated builds

It is not

❏ Nightly builds❏ Developer branches❏ Scheduled integration

points❏ Builds using IDE

Why should we do CI?Risk 1: Fixing bugs late is costly

Why software is still built with waterfall?

Why should we do CI?Risk 2: Luck of team cohesion

❏ “Changes are incompatible, how to merge?”❏ “Why did you update a Magic library to version

2.0.1-beta?”❏ “I thought you fixed it month ago”

Why should we do CI?Risk 3: Poor quality of code

❏ “We have 3 classes doing the same thing”❏ “Why I can’t just include FooBar and not require all the

13 libraries”❏ “Why part of our code uses spaces and another part tabs?”

Why should we do CI?Risk 4: Lack of project visibility

❏ “What do you mean the tests are failing?”❏ “What is in version 1.2.3 of the build?”❏ “What is our code coverage now?”

Why should we do CI?Risk 5: Lack of deployable software

❏ “It works on my machine”❏ “I need a new build to test this”❏ “The boss|customer|peer is coming we need a working demo

asap”

Why should we do CI?Risk 5: Lack of deployable software

❏ “It works on my machine”❏ “I need a new build to test this”❏ “The boss|customer|peer is coming we need a working demo

asap”

With CI build softwareBetter

❏ Quality❏ tested early

and often❏ follows best

practices and coding standards

Faster

❏ Test in parallel

❏ no scheduled integrations

❏ build is not an event

Cheaper

❏ Identify defects earlier

❏ fix is least costly

❏ repeatable automated testing

Build steps (phases)❏ Compilation

Compilation❏ Compile code from sources❏ Compile for each target platform (different OS, browsers,

mobile runtimes etc.)

Build steps (phases)❏ Compilation❏ Test Execution

Test Execution❏ Ensure software functions as expected using unit,

integration, component tests etc.❏ Code coverage (measure to which degree source code is

executed when tests run)

Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection

Code inspection❏ Ensures healthy source code❏ Enforces best practices❏ Indicate problems earlier

Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection❏ Status notification

Status notification❏ Ensure that all interested parties

(developers|management|customers) are on the same page❏ Easy build results access over direct links

Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection❏ Status notification❏ Automated deployment (optional, part of CD process)

Automated deployment❏ Product can be released at any time❏ Continuous demo-able state of the software❏ Eliminates “works on my machine” problem

CI best practices❏ Build at each commit❏ Build every time dependency changes❏ Use single build script❏ Do not depend on local environment (IDE, local packages)❏ Use dedicated server

CI best practices (advices)❏ Commit often❏ Do not commit broken code❏ Fix build failures immediately❏ Build and test on every target environment (browsers, OS,

mobile runtimes)❏ Create and store artifacts

It was all lyrics so far, let’s move to tools and technologies

Continuous Integration CycleCode (manual) Compile

Test/code qualityReport/Artifacts

Deploy

Continuous Deployment

(Some) Tools and Technologies❏ IDEs (IntelliJ, Eclipse, Atom etc.)❏ Git ❏ Webhooks (next slide)❏ Jenkins ❏ Travis CI❏ Code quality tools (Code climate, coverall, etc.)❏ Slack❏ Deployment services (AWS, Heroku, etc.)

Webhook as a technology to enable CI● Webhook is a method to augment the behaviour of a web app

with custom callbacks● Callbacks can be managed by any third-party, who may not

be affiliated with the originating web app

git add .git commit

git push webhook trigger build

Jenkins● Continuous integration and build server● Written in Java● Can be used to automate such tasks as build, test,

distribute software● Server based system running in servlet container(e.g

Tomcat, Jetty)● Completely free and open source/ Commercial support● Has tons of plugins, supports everything● May be a problem to configure, unstable, need dedicated

engineer to maintain

Travis CI● Cloud platform that provides hosted CI for GitHub

repositories● Free for open source● Does not store artifacts (use third party services)

Cloud-hosted alternatives● Codeship CI ● Circle CI● TeamCity from JetBrains

And many others

Comparison between self-hosted and cloud-hosted CISelf-hosted CI Cloud-hosted CI

Application Service

“Free” of charge (need to maintain) Commercial (usually free for open-source)

Highly flexible Easy to use

Install all you need yourself Pre-installed build and test tools

Need to deal with security issues yourself

Need to provide uname/pwd; ssh keys for your repos

Fast (usually) Builds can be queued

Demo● CI for Java project using Travis CI

○ Demo project: ○ Setup○ Build○ Test○ Test coverage with Jacoco and CodeClimate○ Notification: Email○ Status badges

Check docs for more features: https://docs.travis-ci.com/

Thank you for your attention

In case of any questions:

svetlana.omelkova@gmail.com

https://careers.taxify.eu/ (We have office in Tartu)

top related