From Commit to Deployment

Software development is a complex process. A seemingly simple application often hides a multitude of factors that can lead to its failure. Unstable networks, erroneous connection strings, inconsistent data formats, forgotten memory cleanups, unreleased log spaces, and so on, all contribute to uncertainties that force developers to tread carefully. In a typical software project, especially one with some scale that involves multiple teams, we see a process like this happening daily: modify code, transfer to testing, reject and revise, re-test, integrate, jointly debug, discover new issues, reject and revise again, re-test again, and so forth.

Software development shouldn't be like this, and it can be different. The crux of the matter lies in gaining confidence in software behavior before release, and in the efficiency of rolling back to a previous working version when a problem is discovered. In other words, if we are 90% confident in new changes at the time of release, we will release it. Additionally, if an issue arises online, we can switch back to a previous version in a very short time. If we can achieve these two points, we probably don't need to worry about things like transferring to testing, joint debugging, etc., after all, we can always fall back to the previous version.

However, achieving this is not easy. We need to build many protective mechanisms and infrastructure in advance. Each code change triggers rigorous automated tests, each file modification adheres to predefined rules, each merge triggers all automated regression tests, acceptance tests, and end-to-end tests, and eventually forms a deployable software package (sometimes an image file). That is, we eliminate error-prone issues with automation from the beginning, and if they can't be eliminated, we can promptly remediate.

This is the essence of this book: through writing automated build scripts and implementing continuous delivery practices, we can achieve a more efficient and developer-friendly delivery method. The main purpose of this book is to teach you through a real example how to define build scripts, how to use these scripts in local and continuous integration environments, and how to perform common development tasks such as translation (translation+compiling), static checking, packaging, automated testing, automated deployment, etc., to achieve continuous delivery, improve efficiency, and ensure product quality.


Introduction

This chapter introduces the foundational concepts and objectives of the course 'From Commit to Deployment.' It outlines the journey from coding to deployment, covering key practices in modern software development.

Shell and Command Line Basics

This chapter demystifies the Shell and command-line interface, fundamental to computer operating systems. It introduces shell prompts, command composition, and the power of CLI for various tasks like file operations, system administration, and network communications. The chapter also covers executing commands, including understanding command structure, arguments, and options, with practical examples of Shell scripts.

Static Page Implementation

Chapter 3 focuses on developing a static 'Quote of the Day' app. It guides through initializing a Node.js project, creating directories, and working with basic Shell commands. The chapter also introduces the `http-server` for local testing and covers the creation of the first static version of the app, including HTML and CSS implementation.

Convert to React Application

Chapter 4 transitions the 'Quote of the Day' app into a React application. It covers installing React, setting up a basic React structure, and introduces esbuild for compiling JSX into browser-readable JavaScript. The chapter also includes the implementation of a new feature, where clicking a button displays a new quote.

Test Automation

Chapter 5 introduces automated testing in the development process, focusing on User Acceptance Testing (UAT) using Cypress. It guides through setting up Cypress, writing and running end-to-end tests, and ensuring that new features work as expected without breaking existing functionality. The chapter emphasizes the importance of automated testing in collaborative and complex projects.

Communicating with Backend API

Chapter 6 guides the transformation of the 'Quote of the Day' app to fetch quotes from a remote server using the Quotable API. It explains how to make network requests, handle JSON data, and update the frontend with fetched data. The chapter also delves into using Cypress for testing network interactions, including stubbing API responses for consistent test results.

Enable Static Analysis

Chapter 7 focuses on incorporating ESLint for static code analysis in the 'Quote of the Day' app. It covers installing and configuring ESLint, integrating Git Hooks for automated code quality checks, and using Husky to manage Git Hooks for a consistent development environment. The chapter emphasizes the importance of maintaining code quality and consistent coding styles, especially in collaborative projects.

Implementing Continuous Delivery

Chapter 8 explores the implementation of Continuous Integration (CI) and Continuous Delivery (CD) using GitHub Actions for the 'Quote of the Day' app. It covers automating the build, test, and deployment processes to ensure code correctness and seamless transition from development to production. The chapter emphasizes setting up GitHub Actions workflows, running automated tests with Cypress, packaging the app, and deploying it to GitHub Pages, thereby achieving a reliable and efficient development-to-deployment pipeline.

Epilogue

The final chapter serves as a reflective epilogue, summarizing the comprehensive journey of building the 'Quote of the Day' app. It recaps the progression from a simple static page to a complex, automated full-stack application, highlighting key learnings and tools integrated along the way. The chapter emphasizes the transformation in the development process, showcasing the transition from manual methods to automated practices, including React, bundlers, testing, API integration, and CI/CD with GitHub Actions.

© 2023