An introduction to CircleCI

Prithvi A Parit
Fasal Engineering
Published in
4 min readFeb 3, 2022

CircleCI is the continuous integration & delivery platform that helps the development teams to automate the build, test, and deployment of their codes. CircleCI can be configured to run very complex pipelines efficiently with caching, docker layer caching, resource classes, and many more.

What is Continuous Integration?

Continuous Integration is a practice that encourages developers to push small, frequent changes in their code into the main branch of a shared repository. Instead of building out features in isolation and integrating them at the end of a development cycle, code is integrated with the shared repository by each developer continuously.

Salient features of CircleCI

  • Serves around 30000 clients and is capable of running a million tasks per day.
  • Offers performance-based scaling options.
  • Incorporates SSH into the build and test runs to debug.
  • Enables setting up parallel builds for faster execution of the process.
  • Runs every task as a new container which prevents stale build data from causing issues.
  • Announces the end of task execution via Email Notification.
  • Offers numerous orbs (plugins) that help in connecting the existing tools setup.

Next, we will go over some key elements of CircleCI.

- Pipelines

CircleCI pipelines are the highest-level unit of work and a full set of processes you run when you trigger work on your projects. Pipelines contain workflows that coordinate your jobs. They have a fixed, linear lifecycle, and are associated with a specific actor. Pipelines trigger when a change is pushed to a project that has a CircleCI configuration (.circleci/config.yml) file included. can also be scheduled, triggered manually through the CircleCI app, or using the API.

- Workflows

Workflows are a collection of jobs and a set of rules to define their run order. CircleCI workflows provide much more advanced configurations for running a single set of jobs. Below are some workflow examples:

  • Sequential workflow: This type of workflow follows a sequential order where each job starts only when a required job finishes successfully as shown in the diagram.
Sequential workflow
  • Fan-out/fan-in workflow: This type of workflow runs a common build job, then fans-out to run a set of acceptance test jobs concurrently, and finally fans-in to run a common deploy job.
Fan-out/fan-in workflow

- Caching and Artifacts

Caching allows reusing the data from expensive fetch operations from previous jobs. It is usually used to avoid downloading content, like dependencies or libraries, each time you run a job. After the initial job run, future instances of the job will run faster by not redoing work.

Artifacts are used for longer-term storage of the outputs of your build process. They are the files created by the build process, such as distribution packages, WAR files, logs, and reports. E.g., a .apk file required to package and upload an Android app to Google Play is an artifact.

- Executors

CircleCI offers several execution environments also called executors. An executor defines the underlying technology or environment in which to run a job. You can set up to run your jobs in the docker, machine, macOS, or windows executor and specify an image with the tools and packages they need.

- Resource classes

The resource_class feature of CircleCI allows one to configure the CPU and RAM for each job. Different resource classes are available for different executors.

- Orbs

CircleCI orbs are open-source, shareable packages of parameterizable reusable configuration elements, including jobs, commands, and executors. They are used to reduce configuration complexity and are easy to integrate with other software and services stack quickly across many projects.

How does CircleCI work?

A software repository on a supported version control system needs to be authorized and added as a project on circleci.com. CircleCI integrates with GitHub, GitHub Enterprise, and Bitbucket. Every time a code commit is made, CircleCI creates a pipeline. Every code change then triggers automated tests in a clean container or virtual machine. CircleCI runs each job in a separate container or virtual machine.

CircleCI then sends an email notification of success or failure after the tests are complete. CircleCI also includes integrated slack and IRC notification.

Code test coverage results are available from the details page for any project for which a reporting library is added.

CircleCI may be configured to deploy code to various environments, including:

  • AWS CodeDeploy
  • AWS EC2 Container Service (ECS)
  • AWS S3, Google Kubernetes Engine (GKE)
  • Microsoft Azure
  • Heroku

In conclusion, CircleCI is a powerful continuous integration and continuous delivery platform to automate your software builds, tests and deployments efficiently.

--

--