Thoughtful Development & Automation

About

Evgeniy Maslovskiy (@Spleshka)

  • CTO @ SystemSeed
  • Active Drupal contributor

Long Term Projects

Story Time!

  • Planned development 5 years ahead

  • Resulting architecture should have had ~15 microservices

  • Experienced massive development overhead

  • After 1 year of development we threw the old architecture away and rewrote the application

Local Dev Automation

Docker

  • The most obvious & most flexible local dev choice

  • Problems: devs need to learn Docker

  • Problems: real life is different from Hello World samples

  • Problems: too long commands / arguments

Makefiles

  • Old School Linux tool

  • Ships out of the box in Linux* & Mac

  • One file to rule them all

Makefiles. File example

Makefiles. Example of usage

Makefiles. Example

  • One command project installation [make install]

  • One command code checks & fixes [make code:check]

  • One command tests run [make tests:run]
  • One command sync [make sync:db] or [make sync:files]

Makefiles. Real life example

  • Open source projects

  • Removes entrance complexity

  • https://github.com/systemseed/drupal_reactjs_boilerplate

  • https://github.com/systemseed/falcon

Code Quality

Code Quality

  • Set up at the beginning of the project

  • Aim for simple make code:check and make code:fix

  • Make code check in Git pre-commit hook

  • Make code check first step in CI

Automated Testing

Automated Testing

MUST HAVE

Automated Testing

Writing tests is not

harder than writing code

What tests to use?

  • Unit / Functional? Yes, if connected to Drupal API & Database

  • End to end? Yes, but only for business critical parts

Continuous Integration

Continuous Integration

CircleCI

  • Creates isolated environment for every git push
  • Docker friendly
  • Super flexible & powerful
  • Free*

Continuous Integration. Makefiles

  • Runs the same commands as developers locally

  • Guarantees working commands at all times

  • Makes CI process transparent for the developers

  • Eventually has very positive efficiency boost

Continuous Integration. Testing

  • Runs the same set of tests as locally

  • Unit / Functional tests are invoked within CI container

  • End to end tests must be checked against real hosting env

Continuous Integration

  • First, [make code:check]

  • Then, [make install]

  • After that [make tests:run functional]

  • Fail fast (3-5 mins)

  • If all good, deploy to the clone of Production environment

  • Finally, [make tests:run acceptance]

Continuous Deployment

Continuous Deployment

  • Every feature is branched from stage branch

  • When feature is accepted, Pull Request gets merged into stage

  • Stage acts as hands-off dev environment

  • At the end of stage CI job, it opens PR to master & merge it

  • Master CI job makes backup & deploys code to Production

Thank you

Thoughtful development & automation

By Evgeniy Maslovskiy

Thoughtful development & automation

  • 691