1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

A Brief on GitHub Actions

Last updated at Posted at 2020-03-11

GitHub Actions?

The Long Story

Here

TL;DR

GitHub Actions is a toolkit that aids in the customization of a software development life cycle. In some cases, it will be rather simple to think of GitHub Actions as a continuous integration/continuous delivery(deployment) (CI/CD) service equivalent hosted by GitHub itself. A short example of GitHub Actions's application would be automating email notifications whenever a merge/pull/whatever request is made.

Jargons

Runners

Runners are preferably Docker containers of which GitHub Actions run on. The context of this article would primarily be restricted to GitHub-hosted runners; however, please be aware that self-hosted runners are always an option and might come in handy when highly-customized workflow is needed.

Events

Events are workflow triggers. Events can be tweaked to listen to a specific activity, say, specified branch merges.

Jobs

Each defined job will run on a separate GitHub-hosted runner. Jobs can run parallelly, sequentially, and/or even conditionally.

Steps

Steps are building blocks of a job and run sequentially without any specifications. Steps that are defined in the same job share the same runner. They can be called to execute commands or use actions that have been created by one or another.

A "Hello World" for GitHub Action (Explanations will come)

  • Create a directory named .github/workflows/ on the same level as your .git folder.

  • Create a YAML(Your Yaml Guide) configuration file ./github/workflows/{YOUR_WORKFLOW_NAME}.yml that resembles the following.

    -bc33a63b-e6db-4505-a18e-43d8fba2d550.png

  • Push it along with your repository.

  • GitHub would automatically scan all .yml and .yaml files contained within the previously mentioned directory and instantiate runners to hold the workflows configured by the YAML files.

But What Exactly Is Going on?

  • The above configuration file defines a task named 'test' that will be triggered whenever a push occurs on the branch master. When the task is triggered, GitHub Actions instantiates a job-running host on its server running the latest version of ubuntu. This host executes two steps, a pre-made action that sets up the python environment for that host and a self-defined hello world action that runs solely on command line.

  • Here's a link to the referenced material

Screenshot from 2020-03-09 07-11-01.png

  • Go to Actions to see the details.

Screenshot from 2020-03-09 07-11-36.png

  • Go to test to see more details

Screenshot from 2020-03-09 07-14-34.png

  • You now can see the statuses of your jobs and the steps within it. This is where you should be looking up primarily for troubleshooting.

Tweaking to Your Heart's Extent

  • GitHub Actions can do many more.
  • You can configure a workflow that triggers on push, pull requests, create, delete, and the list goes on. Check this for more details on event listeners.
  • You can run your host on Ubuntu, Windows, or even MacOS. Note that the pricing may differ, especially for MacOS, which usually is ten times the pricing of setting up a Linux environment. Pricing Details
  • You can use actions made by someone else. They're all in the GitHub Actions Market, here. Their usage might differ, so it's recommended that you read their documentations beforehand.
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?