First steps on GitHub Actions
GitHub is one of the most widely used platforms by developers for hosting repositories stored in the cloud. Continuous Integration (IC) is a practice that requires frequently adding new shared code to a repository to detect errors in the shortest possible time. For this reason, GitHub proposed not only to host our code in their repositories, but to automate the compilation and testing steps of our projects.
Recently, GitHub was acquired by Microsoft, and they have been adding new features and functionalities, such as GitHub Actions, whose function is to facilitate the execution of code. Today, developers must take a lot of steps to build, execute, and deploy their projects. And this often involves installing packages or development environments. From here arises Git Hub Actions.
What is GitHub?
GitHub is a platform created to host the code of any developer’s applications and tools to facilitate collaboration among the community and allow the downloading of others’ code.
It was acquired in 2018 by Microsoft and uses the Git version control system designed by Linus Torvalds. It is one of the most used worldwide by developers thanks to its simplicity and its cross-platform feature.
What is GitHub for?
GitHub allows developers to host projects by creating repositories for free. In addition, it offers several proprietary tools such as:
- Create a Wiki for each project to annotate all changes to different versions.
- Issue tracking system so that other people can make suggestions or improvements.
- Forum around these annotations to improve the code.
- Charts to see how developers are working on their projects.
- Social networking-like features such as a system to follow your favorite creators.
What is GitHub Actions?
GitHub Actions is a tool that allows to reduce the chain of actions necessary for the execution of code, by creating a workflow responsible for the Pipeline. Being configurable for GitHub to react to certain events automatically according to our preferences.
Thus, GitHub Actions allows you to create workflows that can be used to compile, test, and deploy code. In addition, it gives the possibility to create integration flows and continuous deployment within our repository.
Actions uses code packages in Docker containers, which run on GitHub servers and which, in turn, are compatible with any programming language. This makes them run on local servers and public clouds.
GitHub Actions secrets
To better understand how it works and what parts or actions it is composed of, let’s define the basics of GitHub Actions:
It consists of a set of tasks to be able to execute a job. They can execute commands or actions.
It is a set of steps that run-in runner of our process. The works can be executed independently or sequentially depending on whether the success of our work depends on the previous one.
It is an automated procedure composed of one or more jobs that is added to a repository and can be activated by an event. They are defined by YAML files and with it you can build, test, package, relay or deploy a project.
These are specific activities that trigger the execution of a workflow.
It is the smallest building block of a workflow and can be combined as steps to create a job.
It is a machine with the GitHub Actions application already installed, whose function is to wait for the work to be available and then be able to execute the actions and report the progress and the results.
Benefits of GitHub Actions
One of the defining characteristics of GitHub Actions is the flexibility it provides, which translates into openness to a wide range of possibilities in which developers can unleash their creativity.
These are other advantages offered by GitHub Actions:
Develop in GitHub
The Actions option is fully integrated into GitHub, so it does not require an external site. This means that we can manage everything in the same place where we have the repository related functions.
Wide variety of CI templates
The platform provides many templates for all types of CI configurations (Continuous Integration), which makes it very easy to start work. In addition, you also have the option to create your own templates and then publish them in GitHub Marketplace.
Testing of multiple containers
Actions lets you test multi-container configurations once we’ve added Docker and composition file support to our workflow.
Attractive free plan
This functionality is free for all open source repositories and includes 2000 minutes per month of free compilation for private repositories. If, on the other hand, this is not enough for your needs, you can choose another plan easily.
We recommend you to skip to the post written by our colleague Luis Fraile «Getting started with GitHub Actions«