Github Actions goes to production
The role of CI/CD tools is becoming more and more important. Most of the enterprises adapt such techniques to automate internal processes. The next step for CI/CD was the migration to the Cloud (into Software as a Service (SAAS)). Most of the leading cloud service providers suggest CI/CD tools as a service. In this context, GitHub decided to join the race. They have announced “GitHub Action” which is a branch of Azure Pipelines and allows you to build and deploy various applications in the cloud. The product will go to production very soon, thus we provide you with introductory information about GitHub Actions.
The Idea behind GitHub Actions is to bring everything to the same place. It allows you to track changes in your GitHub repository and trigger builds on various events such as push requests, pull requests, branch or tag creation. Moreover, to do this you don’t have to discover new scripting language, they support the well known YAML format which allows you to list the logical steps of your build process.
Below you can find an example of a simple action file that runs simple Linux commands:
name: My First Action on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Run a one-line script run: echo Hello, world! - name: Run a multi-line script run:| echo Add other actions to build, echo test, and deploy your project.
Moreover, the native GitHub editor will assist you with autocomplete, you may use Control + Space to trigger autocomplete in most situations.
The YAML file is located in the code repository under the following folder “repo:/.github/workflows/”.
You can have more than one action in the workflows folder. The workflow file consists of jobs. Every job may run independently on wait for another job. Moreover, every job might run on a separate OS. Please see the example below:
on: push: tags: - '*’ #trigger when new tag is created Jobs: Backend: runs-on: windows-latest steps: - uses: actions/checkout@v1 - name: build run: | echo “Hello from Windows” Frontend: runs-on: macOS-latest steps: - uses: actions/checkout@v1 run: | echo “Hello from Ubuntu”
In this scenario, the jobs will be executed parallelly.
Multiple OS support in GitHub Actions
One of the major advantages of GitHub Actions is the ability to build in various Operating Systems, including MAC OS. Which is crucial if you work on an iOS project. In the meantime, it is possible to run Mac OS only on MAC hardware that is why most of the cloud service providers avoid resource provisioning in a MAC environment (Google, AWS, etc.).
Moreover, in GitHub Actions they went even further and announced matrix builds. This means that you can run your scripts parallelly in several types of OS (Windows, Linux, and MacOS) as well as with several versions of software (e.g. NodeJS version 10, 11, 12, etc.). This is a great feature that allows simplifying the YAML file while expending the functionality.
One more traditional advantage of GitHub is the huge and motivated community. This is also the case with GitHub Actions. It provides the ability to include prepared process actions in your build process. You may find a big list of such actions in GitHub Marketplace (such as code checkout, execution of SSH commands on a remote host, etc.)
The main drawback at this moment is the unpredictable behavior of the system, meaning that in some cases console might be stuck and show the logs only after a refresh or the same build might be crashed on the first run but finished successfully after the second one.
Another issue is the everyday changes that occur to the system, one environmental variable might have one format and be changed on the next day. However, most probably this is the case for all beta products and we hope that everything will be fixed after it goes to production (which was not the case with Azure pipelines :D).
GitHub Actions Pricing & Plans
One of the most motivating parts of GitHub Actions is the pricing. It supports open source projects and is totally free without any limitations. Thus, making it a nice tool for community-wide projects. The billing is calculated on a per-minute basis. Free users have 2000 minutes per month for their private projects. Others get the following rates:
- Pro – 3,000 minutes per month
- Team – 10,000 minutes per month
- Enterprise – 50,000 minutes per month
Additionally, GitHub Actions can become more beneficial if you consider a combination with GitHub Releases and GitHub Packages. Releases allows you to store your deployment artifacts and access them anytime from anywhere.
GitHub Packages is a package repository for most of package based systems such as NuGet or npm.
Conclusion: Is GitHub Actions the tool you need for CI CD?
GitHub Actions has the potential to become a leading player in the market of Cloud CI/CD tools with the great support of the community. We have started to use GitHub Actions on the first stages and there were some tricky moments all the time. However, the community is very open-minded and willing to share their experiences.
We will continue to work in this direction and we will keep you updated with new insights of building various apps with GitHub Actions.
Bewerten Sie jetzt diesen Artikel
Es tut uns sehr leid, dass Ihnen der Artikel nicht Ihren Erwartungen entspricht.
Vielen Dank, Ihre Meinung ist uns wichtig!
Dr. Aram Kocharyan ist bei P&M für den Bereich DevOps zuständig. Aram stammt aus dem wunderschönen Armenien, lebt nun aber in Hamburg. Für den P&M Blog schreibt er auf Englisch.