CI and CD with GitHubActions!!

GitHub Actions make it easy to automate all your software workflows, now with world-class CI/CD.

github.com

Github actions are a tool to run workflow on any GitHub event.

In today’s era DevOps and Continous integration and continuous deployment. Every organization wants to become agile and develope features, build and deploy a daily or hourly basis. To do this every enterprise uses their own set of tools to watch over source version control such as git then generate a build and execute unit test cases, then functional, integration test cases after that based on threshold do some monkey testing in a simulated environment and then deploy to lower environment and then do promotion. 

The above one is the general flow in any enterprise software. Nowadays everyone wants to fail fast, this leads to come up with different tools such as Jenkins, chef, git, sonarqube and many more. Based on the coding language and deployment server you have to choose the tools. If you are using Docker or containers then different tools.

To make things simple yet powerful and efficient github come up with Github Actions. GitHub Actions features a powerful execution environment integrated into every step of your workflow. You can discover, create, and share actions to perform any job you’d like, and combine them to customize your workflow.

Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want.


The best thing about this is you can do this in your github repository itself.

There are different sets of actions such as assign reviewers, revert commit, merge, package, publish, etc. for more details visit below pageGitHub Marketplace: actions to improve your workflow
Menu Types Categories Filters Verification An entirely new way to automate your development workflow. 1712 results…github.com

Some important points:-

  1. GitHub Actions support Node.js, Python, Java, Ruby, PHP, Go, Rust, .NET, and more.
  2. Save time with matrix workflows that simultaneously test across multiple operating systems and versions of your runtime.
  3. Run directly on a VM or inside a container. Use your own VMs, in the cloud or on-prem, with self-hosted runners. Hosted runners for every major OS.
  4. It’s one click to copy a link that highlights a specific line number to share a CI/CD failure. You will get live logs.
  5. Built-in secret store.
  6. Multi-container testing.
  7. Community-powered workflows.
  8. Write and Reuse the workflows.
  9. Built-in github package registry.
  10. Simple, pay-as-you-go pricing.

Pricing:- 

Free for open-source projects.

https://github.com/features/actions

Actions allow us to easily test multiple versions of your project in parallel.

Getting started:-

Let us create one sample repository on your github. Go to that repository and on the top section below your repository name, you will see “Actions” as a menu click on it.

When you click on it you can see the Actions page, where you will see list of predefined templates for it.

Choose the one which is suitable for your requirements. Click on “set up this workflow” click on this button.

It will redirect you to the actual workflow page, where we have to define workflow using “yml” 

Define workflow if require add some workflow tool from the marketplace and commit the code. If you want to preview your flow click on “Preview” button which is next to the edit file. Once you commit it will in the “Actions” menu we can see workflow like below. Here we can see status here also we can define a new workflow. The different workflow may be based on the environment like dev, QA, UAT or PROD.

Check the status and enjoy coding.

Sample yml:-

jobs:
  test:
    name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node_version: [8, 10, 12]
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
    - uses: actions/[email protected]

    - name: Use Node.js ${{ matrix.node_version }}
      uses: actions/[email protected]
      with:
        version: ${{ matrix.node_version }}
    
    - name: npm install, build and test
      run: |
        npm install
        npm run build --if-present
        npm test

Documentation:-

Automating your workflow with GitHub Actions
GitHub Actions features a powerful execution environment integrated into every step of your workflow. You can discover…help.github.com

For more stories

Lets connect on Stackoverflow , LinkedIn , Facebook& Twitter.