Learn about the CircleCI tool

Tram Ho

This is an article that summarizes my knowledge when I started to learn about CircleCI. And a simple guide to use it.

What is CI?

CI stands for Continuous Integration which translates as "Continuous Integration". This is considered an optimal method of software development, every time there is a change to the code, there will be a server that automatically builds, runs tests to check and ensures no errors occur during development. development. This also requires team members to constantly update their code to the repositories on a regular basis.

What is CD?

CD (Continuous Deployment) roughly translates as "Continuous Deployment" is a process of product or software release, code changes are automatically deployed on staging, production servers, along with running the test to ensure accuracy.

Introducing the CircleCI tool

CircleCI is a platform that helps us to apply CI / CD to projects easily. Just log in with a github account and your repos can connect to CircleCI.

The process of running a job on CircleCI is as follows:

  1. When the code is merged into a branch, CircleCI will automatically catch this event and run the corresponding job that was configured.
  2. CircleCI creates an environment on its server, pulls docker images, and runs steps to build the code against our config.
  3. After running all the steps, its job is done, you can see the success or failure status on Dashboard screen.

Next are some concepts when working with CIrcleCI.

configuration

Your entire installation with CircleCI is located in the .circleci/config.yml file

For more details you can refer to https://circleci.com/docs/2.0/configuration-reference/

pipelines

A pipeline is all of your configuration as you work on a project. Can be seen through the CircleCI cloud. The pipeline includes your workflows, and the workflow includes jobs.

workflows

Responsible for arranging many jobs. For example a workflow to build -> run test -> deploy.

jobs

The steps are usually responsible for executing the steps is usually a series of statements.

Run it on a rails app

First, I create a new repository on github.

After creating, you can go to the projects section on CircleCI and you can see the project you just created.

Next, you can create a rails project, install rspec, rubocop … and push the code to repo. For convenience, I have to fork the circle's demo project to see and it configs as follows:

The run commands are available in the orb here, but depending on the job you can also write your own commands.

After having the config file, every time we have any commit, CircleCI will automatically run our workflow, you can reinstall in Project Setting> Advanced.

The interface and how to use CircleCI at its basic level are quite simple and easy to use. Hopefully after my article, you can have more excitement to try this platform out.

Share the news now

Source : Viblo