ci-workshop

CI Workshop

This workshop guides you through setting continuous integration and delivery in a sample React and Node application. You will learn:

The goal is to dip your hands in enough aspects of CI/CD, but not go into depth on any one aspect. This workshop consists mostly of reading and copying and pasting, just like real web development ;)

Lessons

  1. Linting
  2. Continuous Integration
  3. Storybook
  4. Code Coverage
  5. React Tests
  6. Server Tests
  7. Continuous Delivery
  8. Monitoring and Notifications
  9. End-to-End Tests
  10. Error Monitoring
  11. Dependency Upgrades and Security Checks
  12. GitHub Status Checks
  13. Dark Launching with Feature Flags
  14. Learn More

Please read the background below before starting on the lessons.

Contact

Contact me:

Reference App

The reference app you will be working on and deploying is here: jonathanong/ci-reference-app. This app is based on my personal reference app IMS, so feel free to explore it. If you wish to cheat, there are solutions in the solution branch.

What is Continuous Integration/Delivery?

There are a lot of blog posts on this topic. Here is one graph that explains it:

We will be implemented continuous integration and delivery, but not continuous deployment. We will also be implementing a barebones version feature flags. See this post and company for more details:

What is the CI/CD workflow in a few bullet points?

Why Continuous Integration/Delivery?

Testing Philosophy

There’s a lot of testing philosophies on the internet. The most common is the testing pyramid:

The latest philosophy, which I prescribe to, in the JS community is the testing trophy:

What do each of these sections mean? It depends on a lot on the context. Here’s one breakdown (actual definitions do not matter in real life):

This list is just a guideline, but definitions could change based on your scenario. The main tenets of the testing trophy is:

Here is how our custom setup for monitors and automation differ for us at Dollar Shave Club:

              Unit / Integration face-monitor face-e2e
Speed Fast Moderate Slow
Runs in production No Yes Not Yet
Runs in staging No Yes Not Yet
Runs in review apps No Yes Yes
Supports Selenium No No Yes
Supports Puppeteer No Yes Yes
Supports testing all browsers No No Yes
Supports Sauce Labs No No Yes
Supports retries Maybe Yes Yes
Supports retries on Sauce Labs No No Yes
Supports BDD Yes No Yes
Flakiness (1-5) 2 3 4
Hooked up to Datadog and/or alerts No Yes No
Ability to disable analytics Yes Yes No
Google Timeline Viewer No Yes No
Browser Screenshots Percy Storybook Implemented Not Implemented

face- are our suites of monitors and e2e tests with a lot of customization involved.

Tools

Backend:

Frontend:

Testing:

SaaS:

Setup

Install node@8.9 or later:

# If you install via homebrew:
brew install node
# brew upgrade node

# If you install via nvm:
nvm install 8

Install (or upgrade) Selenium and friends:

brew install selenium-server-standalone chromedriver
# brew upgrade selenium-server-standalone chromedriver

Install Heroku’s CLI: https://devcenter.heroku.com/articles/heroku-cli

Implicit Steps