GitHub Actions
#GitHub

GitHub Actions

What is GitHub Actions and why do we need it?

  • It is a CI/CD platform that allows you to automate your build, test, and deployment pipeline.
  • It is useful to automate developer workflows.
  • Github provides Linux, Windows and macOS virtual machines to run your workflows or you can host your own self-hosted runners in the data centre or cloud infrastructure.
  • We don't need any third-party tool like Jenkins for Continuous integration.
  • At a time, we can test and build our code in different Operating Systems.
  • By using GitHub Actions you can run a workflow that tests and builds your code.

GitHub Actions

What is a workflow?

A workflow is a configurable automation process that will run one or more jobs. A YAML file defines workflow in the .github/workflows directory and runs whenever an event is triggered in the GitHub repository.

Ex: Whenever someone raises a pull request or pushes a commit to your GitHub repository, you want to ensure that new changes shouldn't break the existing code and pass all the tests and build.

How can we trigger a workflow?

  • We can trigger a workflow by using events or by scheduling also.
  • An event is a specific activity in a repository like opening a pull request, deleting a branch, pushing a commit to the repository, open a new issue. etc

What is meant by jobs?

  • A job is a set of steps in a workflow that is executed on the same runner.
  • Each step is either a shell script that is executed or an action to be run.
  • Steps are dependent on each other so we can share data among that.
  • By default jobs will run in parallel in a workflow.

In the above example, testing your code is one job and building your code is another job

What is meant by actions?

  • An action is a reusable unit of code that performs a specific task for a workflow.
  • Actions are building blocks of GitHub workflows that automate tasks such as testing, building, and deployment.
  • Ex: For any workflow pulling the latest code from the GitHub repository to the current virtual machine is necessary. So GitHub provides an action (actions/checkout@v2) that we can directly use in our workflow.

What is meant by a runner?

  • A runner is a server that runs your workflows when they are triggered.
  • Each runner can do a single job at a time.
  • Each workflow runs in a fresh, newly provisioned virtual machine.


Sample YAML file

workflow.yaml

Thanks for reading ??

In the next article, we will see a detailed way to create and run a workflow with one real-time use case.





Vincent Granville

Co-Founder, BondingAI.io

7 个月

See also this platform for GitHub actions and integration: https://mltblog.com/4cu6j7c

  • 该图片无替代文字
回复
Om Prakash

Frontend Developer | Immediate Joiner | React JS | Angular | Javascript | HTMl | CSS

8 个月

Having everything under a single tool is incredibly exciting! It would be so helpful during PR reviews. Thank you Tirupathi Rao Bolla .

回复
Maddineni Venkateswarlu

Software Engineer | Distributed systems , Java , AWS | React/Angular

8 个月

This was incredibly helpful, exciting for real time use case

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了