implementing continuous integration in .net for cheapskates

21
Implementing Continuous Integration in .NET for cheapskates Matt Henroid @mhenroid November 13, 2015

Upload: mhenroid

Post on 14-Jan-2017

254 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Implementing Continuous Integration in .NET for Cheapskates

Implementing Continuous Integration in .NET for cheapskates

Matt Henroid@mhenroidNovember 13, 2015

Page 2: Implementing Continuous Integration in .NET for Cheapskates
Page 3: Implementing Continuous Integration in .NET for Cheapskates

3

• Intro to Continuous Integration• Environment Setup• Source Control• Automated Build• Build Server• Automated Testing• Automated Deployment

Agenda

Page 4: Implementing Continuous Integration in .NET for Cheapskates

4

cheapskateA stingy person. Somebody who buys cheap in favor of higher quality or better stuff. Even though they might be able to afford better…by verseguru August 20, 2004http://urbandictionary.com

What is a cheapskate?

Page 5: Implementing Continuous Integration in .NET for Cheapskates

5

frugal developerA developer who encourages• Saving money by favoring free, open source or

inexpensive but high quality tools whenever possible

• Saving time by automating processes as much as possible

• Saving yourself from disaster by mitigating the inevitable risk that comes with continuous changes to software projects.

What is a cheapskate?

Page 6: Implementing Continuous Integration in .NET for Cheapskates

6

• Code new features• Build, Test and Deploy* automatically• Repeat

* Deploy to test environment, not to production (i.e. continuous delivery)

What is Continuous Integration?

Page 7: Implementing Continuous Integration in .NET for Cheapskates

7

• Reduces integration problems• Reduce mistakes from manual processes• Promotes rapid feedback• Promotes testable software

Benefits of Continuous Integration

Page 8: Implementing Continuous Integration in .NET for Cheapskates

8

CI - It’s Not Rocket Science

Page 9: Implementing Continuous Integration in .NET for Cheapskates

9

• Practices– Things you and your team should do

• Automation– Eliminate repetitive boring work– Reduces human errors– Reproducible every time

• Tools– Numerous free / open source tools available

CI = Practices + Automation + Tools

Page 10: Implementing Continuous Integration in .NET for Cheapskates

10

• Purpose– Enable testing in multiple staged environments

• Practices– Create multiple environments

• Small project – DEV, INTG, PROD• Medium project – DEV, INTG, QA, PROD• Large project – DEV, INTG, QA, UAT, PROD

– Keep all environments similar– Automate server setup– Support data replication

Environment Setup

Page 11: Implementing Continuous Integration in .NET for Cheapskates

11

• Purpose– Keep track of all source code changes

• Practices– Store all artifacts required to build project– Fresh checkout should always be buildable– Avoid storing unnecessary artifacts

• Use ignore file / feature– Use package management to store

dependencies– Define branching / merging strategy– Commit early and often (daily, hourly)

Source Control

Page 12: Implementing Continuous Integration in .NET for Cheapskates

12

Source Control - Demo

https://github.com/mhenroid/CIDemo

Page 13: Implementing Continuous Integration in .NET for Cheapskates

13

• Purpose– Ensure build can be done without human

interaction• Practices

– Automate the entire build process– Use a build server to build on every commit– Keep the build fast– Don’t break the build– Fix broken builds immediately

Automated Build

PowerShell MSBuild

Page 14: Implementing Continuous Integration in .NET for Cheapskates

14

• Purpose– Watch for changes to source control– Perform build / test / deployment automatically

• Benefits– Provide stable, reproducible environment for

builds– Ensure no check-in breaks the build– Easily determine who broke the build– Reporting

Build Server

Page 15: Implementing Continuous Integration in .NET for Cheapskates

15

• NAnt / MSBuild• Cruise Control

Automated Build - Demo

Page 16: Implementing Continuous Integration in .NET for Cheapskates

16

• Purpose– Test your code continuously and automatically– Test conditions that may be difficult to

reproduce from UI• Practices

– Unit test – class / method level– Integration test – test multiple classes together– Enable tests to execute on build server– Use Code Coverage to verify test coverage– All tests should pass

Automated Testing

Page 17: Implementing Continuous Integration in .NET for Cheapskates

17

• Test Framework– MSTest

• Mock Framework– Moq

• Code Coverage– Open Cover

Automated Testing - Demo

Page 18: Implementing Continuous Integration in .NET for Cheapskates

18

• Purpose– Package project artifacts and deploy to

environment– Enables immediate testing on non-developer

machine• Benefits

– Reproducible– Deploy automatically– Testers can provide feedback more quickly– First step towards Continuous Delivery

Automated Deployment

Page 19: Implementing Continuous Integration in .NET for Cheapskates

19

Automated Deployment - Demo

Page 20: Implementing Continuous Integration in .NET for Cheapskates

20

Questions???

Page 21: Implementing Continuous Integration in .NET for Cheapskates