In this lesson, you will learn:

  • what is CI
  • how to trigger your code quality tools using CI
  • the key Git and Github components required for CI
  • how to configure GitHub Actions for CI
  • examples and walk-throughs of the GitHub Actions/CI workflow.
You can find the scripts and code for this course within the Automating Python Code Quality repo.

Introduction

Up until this point we have looked at how to run and automate our code quality checks locally. However, what would happen if someone in the team decided not to run any of these tools and to merge their code into the codebase? Well, the code quality of our production code would now be compromised. Not good!

Continuous Integration (CI)

A solution to this is to utilize continuous integration (CI). CI is a fancy term for:

multiple developers integrating their code, into a central codebase, with the addition of automated testing, to catch issues before their code is merged.

For the context of this course, we will use GitHub Actions for our CI workflow.

Git/GitHub Overview

For those of you who are new to Git, let me provide a quick summary of Git, GitHub and the main components that will be key in our CI workflow.

  • Git - Git is a local CLI-based version control system.
  • GitHub - a centralized cloud-based collaboration and version control system.
  • GitHub Actions - CI/CD platform for GitHub. In other words, it allows you to trigger workflows based upon a GitHub event. A centralized cloud-based collaboration and version control system.

Components:

  • Branch - Git branches are used to create separate "copies" of our main (branch/) codebase. Development can then be performed on the branch in isolation without affecting the main branch.
  • Commit - a saved change to your repository.
  • Pull request - a PR is a request for merging one branch into another - for example, merging a feature branch into the main branch. When a PR is raised, tests can then be triggered and the required review be performed before the code is merged.

image4

Source: hackernoon.com/15-tips-to-enhance-your-github-flow-6af7ceb0d8a3]

Members Only Content
Want to Learn Network Automation?
Join our membership to access:

Join Now ➜
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.