continuous integration · 2018-11-09 · continuous integration and build server written in java...
TRANSCRIPT
![Page 1: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/1.jpg)
Continuous Integration
Svetlana OmelkovaSoftware Engineer
Taxify
![Page 2: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/2.jpg)
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
![Page 3: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/3.jpg)
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
![Page 4: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/4.jpg)
What is “Continuous”
![Page 5: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/5.jpg)
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
![Page 6: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/6.jpg)
Why should we do CI?Risk 1: Fixing bugs late is costly
Why software is still built with waterfall?
![Page 7: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/7.jpg)
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”
![Page 8: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/8.jpg)
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?”
![Page 9: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/9.jpg)
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?”
![Page 10: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/10.jpg)
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”
![Page 11: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/11.jpg)
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”
![Page 12: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/12.jpg)
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
![Page 13: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/13.jpg)
Build steps (phases)❏ Compilation
![Page 14: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/14.jpg)
Compilation❏ Compile code from sources❏ Compile for each target platform (different OS, browsers,
mobile runtimes etc.)
![Page 15: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/15.jpg)
Build steps (phases)❏ Compilation❏ Test Execution
![Page 16: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/16.jpg)
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)
![Page 17: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/17.jpg)
Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection
![Page 18: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/18.jpg)
Code inspection❏ Ensures healthy source code❏ Enforces best practices❏ Indicate problems earlier
![Page 19: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/19.jpg)
Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection❏ Status notification
![Page 20: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/20.jpg)
Status notification❏ Ensure that all interested parties
(developers|management|customers) are on the same page❏ Easy build results access over direct links
![Page 21: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/21.jpg)
Build steps (phases)❏ Compilation❏ Test Execution❏ Code inspection❏ Status notification❏ Automated deployment (optional, part of CD process)
![Page 22: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/22.jpg)
Automated deployment❏ Product can be released at any time❏ Continuous demo-able state of the software❏ Eliminates “works on my machine” problem
![Page 23: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/23.jpg)
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
![Page 24: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/24.jpg)
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
![Page 25: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/25.jpg)
It was all lyrics so far, let’s move to tools and technologies
![Page 26: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/26.jpg)
Continuous Integration CycleCode (manual) Compile
Test/code qualityReport/Artifacts
Deploy
Continuous Deployment
![Page 27: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/27.jpg)
(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.)
![Page 28: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/28.jpg)
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
![Page 29: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/29.jpg)
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
![Page 30: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/30.jpg)
Travis CI● Cloud platform that provides hosted CI for GitHub
repositories● Free for open source● Does not store artifacts (use third party services)
![Page 31: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/31.jpg)
Cloud-hosted alternatives● Codeship CI ● Circle CI● TeamCity from JetBrains
And many others
![Page 32: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/32.jpg)
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
![Page 33: Continuous Integration · 2018-11-09 · Continuous integration and build server Written in Java Can be used to automate such tasks as build, test, distribute software Server based](https://reader034.vdocuments.us/reader034/viewer/2022042305/5ed10c118e51cf224b58d853/html5/thumbnails/33.jpg)
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/