continous integration of (js) projects & check-build philosophy

28
Continous Integration of (JavaScript) projects & check-build philosophy

Upload: francois-guillaume-ribreau

Post on 16-Jul-2015

664 views

Category:

Technology


2 download

TRANSCRIPT

Continous Integration of (JavaScript) projects

&check-build philosophy

The story

“Let’s start with a little story...”

“My name is François-Guillaume Ribreau”

BringrCo-founder Founder

“I’m the co-founder (CTO) of Bringr and the founder (C[E|T]O) of Redsmin. Some month back, our team grew in size.”

Bringr

A B FC D E G

“At Bringr & Redsmin we work a lot at creating micro-services (SOA), so each of the new time member was given micro-services to build.”

D.R.Y YAGNI

KISS

C.Q.R.SSRP

OCP

LSPISP

DIP

2 spaces

no tabs

syntax

documentation

“Since they were junior developers (sometimes interns), at each code-review I had to explain software principles and our conventions”

conventions&

principles

“... and I had to do it at every code-review, each-time. Sometimes — it happened — I would not even respect my own conventions...”

When you ask developersto follow coding conventions

Try to make the human out of the loop

“... so I came across this principle...”

Don't rely on principle, rely on automation.

“... that I rewrote”

“People are fallible, automated workflows are* not.“ — FG

“... that I rewrote (again)”

Solutions?

“Now let’s see what our current options are...”

Code-style checking

“We could use JSCS...”

Syntax checking

“... along with JSHint and so on...”

Bringr

A B FC D E G

“... but installing JSHINT/JSCS on each project is not DRY at all”

Documentation checking ?

D.R.Y checking ?

Security* checking ?

“But then what about other code dimension?”

Jenkins

A

B

F

C

D

E

G

...

...

...

...

...

...

...

Tests

Tests

Tests

Tests

Tests

Tests

Tests

“... another way was to install JSHint/JSCS plugins on the CI,

but that’s like creating high coupling...

Not a good idea either.”

“moreover, these plugin configurations can’t be

versioned inside the project git repository...”

Solution.

“... here is what I came up with.”

Check-build

Verifies that your NodeJS project follows team conventions, is well written,

up to date and secure*...

5Security

Fresh

ness

Code styleD.R.Y.ness

Syntax/Complexity

JSI!"p#$%

D&v'( N"p r#%'r#.)" *"+,/10

p-&%. *"+,/19

“Check-build ensure 5 points of control”

SecurityFresh

ness

Code styleD.R.Y.ness

Syntax/Complexity

DocumentationI!$/.)" *"+,/8

6

“Documentation is a work in progress, don’t hesitate to send a PR”

{ "checkbuild": { "enable": ["jshint", "jscs", "jsinspect", "nsp", "david"], // don't exit immediately if one of the tools reports an error (default true) "continueOnError": true, // don't exit(1) even if we had some failures (default false) "allowFailures": false }, "jshint": { "args": ["src/**/*.js"] }, "jscs": { ...}

.checkbuild

.jshintrc

“Check-build does not reinvent the wheel, it leverages existing stuff in a declarative way”

Jenkins

A

B

F

C

D

E

G

...

...

...

...

...

...

...

Tests

Tests

Tests

Tests

Tests

Tests

Tests

Jenkins

A

B

F

C

D

E

G

Tests

Tests

Tests

Tests

Tests

Tests

Tests

npm i check-build -g && check-build

npm i check-build -g && check-build

npm i check-build -g && check-build

npm i check-build -g && check-build

npm i check-build -g && check-build

npm i check-build -g && check-build

npm i check-build -g && check-build

“Check-build removes high coupling between the CI & projects and between projects and quality tools.

Always install the latest version, we make sure check-build will always be backward compatible”

./scripts/ci-start

@weekly

hook

Run tests (unit & integration)

./scripts/ci-publish Zero downtimedeploy

Jenkins

&

git push

“By building automatically daily/weekly, check-build can ensure that our projects are secure* and up-to-date, even if we don’t push new code”

“ Administrate everything, monitor in real-time.Visualizing and editing Redis data-structures has never been so simple. ”

Founder of Redsmin redsmin.com

BringrCofounder & CTO of

“ Create value for your business on Social Media, from discussion to conversion ”

Professor @EPSI_Nantes & @UnivNantes on JavaScript (RIA/NodeJS), Design Patterns and NoSQL databases

bringr.net