Introduction

On this research I am going to talk about Automated Builds with Continuous Integration and Continuous Deployment, I will explain the basics concepts of this topic, how to implement it on your repositories and the different uses that we can give to them.

Automated Builds

Build automation is the process of automating the retrieval of source code, compiling it into binary code, executing automated tests, and publishing it into a shared, centralized repository.

Build automation is a critical first step of any CI/CD process. You must have build automation in place in order for Continuous Integration (CI) and Continuous Deployment (CD) to occur.

Automated Builds advantages:

  • A necessary precondition for continuous integration and continuous testing
  • Improve product quality
  • Accelerate the compile and link processing
  • Eliminate redundant tasks
  • Minimize “bad builds”
  • Have history of builds and releases in order to investigate issues
  • Save time and money - because of the reasons listed above.

    We can find different types of automation softwares for different code languages that can be applied on Github Actions (what I will talk about later), there are all the avaiable ones for each automated build task:

For Continuous Deployment:

For Continuous Integration:

Continuous Integration (CI)

Continuous Integration (CI) is a software development strategy that increases the speed of development while ensuring the quality of the code that teams deploy. Developers continually commit code in small increments, which is then automatically built and tested before it is merged with the shared repository.

Continuous integration benefits:

  • Improve team productivity and efficiency
  • Accelerate speed to market
  • Identify product/market fit
  • Release higher quality, more stable products
  • Increase customer satisfaction
  • Keep developers happy and shipping code

How Continuous Integration works?

When the developer performs a push on the source code Continuous Integration automatically builds the code and test it, once is test it, the software reports if the code works, if the code is correct automatically will release it to the selected branch.

Continuous Deployment (CD)

Continuous Deployment builds on Continuous Integration, is the methodology of creating a robust testing framework and automatically pushing your code out when tests pass. When new code is committed and passes the CI tests, the code is automatically deployed to production.

Continuous deployment also encourages other kinds of continuous action, like analytics, error reporting, and testing.

Continuous deployment benefits:

  • Automate the repetitive tasks and focus on actual testing
  • Connect your existing tools and technologies (such as CI providers or scripts) into a harmonious workflow
  • Integrate teams and processes with a unified pipeline
  • Create workflows across the development, testing, and production environments
  • Ship both cloud-native and traditional applications in a unified pipeline
  • Improve overall productivity

How Continuous Deployment works?

As mentioned before, Continuous Deployment works on Continuous Integration, the work of Continuous Deployment Software or Continuous Delivery is to push and commit the code after the Continuous Integration tests finished.

On the diagram above we can see all the phases of an Automated Build with the Continuous Integration and Continuous Deployment working on it. As you can see, the CI software is the first one working, it builds and test the code, after that the CD software enters in scene testing the release to deploy it and finally operate it.

GitHub Actions

GitHub Actions is the way we will integrate Automated Builds in our GitHub projects, with this tool we can automate, customize, and run our software development workflows (what I will talk more deeply later) directly in our repository. We can discover, create and share actions to perform any job you want, including CI / CD, and combine actions into a completely customized workflows. Thanks to GitHub we will be capable to download actions already programmed by other users and use them directly in our project.

We know what Automated Builds are and how they work, but how we set up automated builds with Github Actions?

1- Go to your repository main page 2- Click on “Actions” below your repository name

3- Find the software you want that matches the code you are gonna work with and click “Set up this workflow” (these are the above mentioned softwares for CI) in my case I used “Jekyll” that is based on HTML

4- Click on “Start Commit”

5- Select “Create new branch for this commit and start a pull request” and name it as you want and click on “Propose new file”

6- Click on “Create pull request”

Workflows

Now we have our Continuous Integration workflow added on our GitHub, but what exactly are these workflows? How they work?

Workflows are all the processes of Build Automation. They are an automated procedure made up of one or more jobs that is added to a repository and can be triggered by an event. They are defined using yaml. or yml. files and with it you can build, test, package, release, or deploy our code on GitHub.

Basic Concepts:

Event

They are specific activities that trigger the execution of a workflow.

Job

It is a set of steps that are executed in the runner of our process. Jobs can be run independently or sequentially depending on whether the success of our work depends on the previous one.

Steps

It consists of a set of tasks to be able to execute a job. These can execute commands or actions.

Actions/Commands

It is the smallest building block in a workflow and can be combined as steps to create a job.

Runner

It is a machine with the GitHub Actions application already installed, whose function is to wait for the jobs to be available and then be able to execute the actions and report the progress and results.

Some GitHub Actions uses and benefits

One of the defining characteristics of GitHub Actions is the flexibility it provides, which translates into opening up a wide range of possibilities in which developers can unleash their creativity. Here are some other benefits that GitHub Actions offers:

Developing on GitHub

The Actions option is fully integrated into GitHub, so it doesn’t require an external site. This means that we can manage everything in the same place where we have the functions related to the repository.

Big variety of CI templates

The platform provides many templates for all kinds of Continuous Integration configurations, making it much easier to get started. In addition, you also have the option to create your own templates to later publish them on GitHub Marketplace.

Free for everyone

GitHub Actions is free for all open source repositories, and allows you to download and create your own workflows.

Create your own workflow

You can create your own workflows for GitHub Actions:

1- Go to Github and select “New workflow”

2- Click on “Set Up This Workflow” on Simple workflow

3- Now you can modify the code as you want for create the workflow you want, if you want a more detailed guide of how the workflows works I recommend you to visit this website
which explains much more deeper how the workflow code works

Automatically zip. and Upload

One of the best things of Github Actions is to create your own release based on your code, this is a basic tutorial for you to do it easily:

1- Follow all the last tutorial guidelines and stay on the code editor

2- We are gonna use two Github Actions from the Marketplace, one will be Zip Release
for creating our personalized zip on our release and the other will be Create Release
which combined with the other one, will make the release on our tags section

3- We need to implement the github actions by copying and pasting on our code, is so easy to implement but be sure to align the commands at the correct distance otherwise they won’t work. You can modify the two of them as you want, for example on the Zip Release you can exclude the elements you don’t need on your zip or select the folder directory that you want to zip, for thr Create Release code there are a bunch of options too, you can implement any as you want in order to personalize your release.

This is a functional basic code that creates a release on your tags to have it as an example.

Automatic Builds and Notifications

You can receive Automated Builds notifications on your gmail if you want, is so easy to activate this feature:

If this option is enabled you will recieve a notification each time the push fails or the CD makes a release, is activated by default

Automatic Builds Uses

There are a lot of actions that you can do with Automatic Builds in GitHub Actions, like compress files or folders, make releases, change the readme version, upload releases, etc. With the Marketplace and your own code the limit of possibilities is your own imagination!

Conclusions

I think Automated Builds are an essential for big projects, they make much more comfortable to work on your project.

Pros:

  • Save time on making our releases
  • Personalize your project with practically no limitations
  • Your project will be much more professional
  • Eliminate repetitive tasks like updating your Readme or zip your releases

Cons:

  • They are not essential on small projects
  • What other cons could the automatic builds have? Use them!

https://www.youtube.com/watch?v=cP0I9w2coGU&ab_channel=GitHub

https://docs.github.com/es/actions/guides/setting-up-continuous-integration-using-workflow-templates

https://www.perforce.com/blog/vcs/build-automation#:~:text=Build%20automation%20is%20the%20process

https://circleci.com/continuous-integration/?utm_medium=SEM&utm_source=gnb&utm_campaign=SEM-gb-DSA-Eng-emea&utm_content=&utm

https://circleci.com/blog/a-brief-history-of-devops-part-iv-continuous-delivery-and-continuous-deployment/

https://www.plainconcepts.com/es/que-es-github-actions/

https://gabrieltanner.org/blog/an-introduction-to-github-actions

https://github.com/marketplace/actions/create-release

https://github.com/marketplace/actions/zip-release

Contact

Gmail: davidlira1909@gmail.com

GitHub: https://github.com/davidlira19