Github Actions - Auto Test— Github -> Docker Hub -> Azure Deploy Pipeline Part 3

Hasan Şahin
HardwareAndro
Published in
3 min readFeb 18, 2021

With Part 3, we’ll see how to use Github Actions. While explaining this, I will go over the scenario we use the most. We have a .Net project and a Test Project.

We will run this test project automatically in the push and pull operations of team members on Github. By defining more than one action, we can also manage different branches and projects. One of the best things about it is that GitHub automatically sends you an e-mail for the test result.

Let’s learn how to do it.

First, after entering our repository, click on the Action tab. Create a new workflow file by clicking ‘Set up a workflow yourself’ on the screen. As an example, it will create a schema for you.

The created file is located under the .github/workflows directory.

The workflow created is set to run compatible with .NET core 3.1

workflow.test

name : Workflow name .
on : The part where we manage when action will run.
workflow_dispath : To run the action at manually.
main : We’ve set it to run when the main branch push and pull request come in. You can set it for multiple branches or just push operations. is completely optional .

jobs : This is where we manage the pipeline. Here, we run different processes on different operating systems and depending on each other. In the event of an error, it will give us a failed warning.
Test_Build : Job name.
runs-on : Operating System.
steps : Job Steps.
name : Step name. When Action works, we’ll see where it is through the names.
uses : Package Name
with : Version
working-directory : Project Path
run : Run package command on working directory.

To summarize the operations have done briefly when the main branch receives push or pull, compiled our project on ubuntu and run the test project by running the ‘dotnet test’ command.

Preview
Success Result
Error Result

With Part 4, If these operations finish successfully, get an image with Docker File and upload it to Docker Hub. then publish it on the virtual machine have created in Azure.

Part 1 : https://medium.com/@hasansahinn/install-docker-on-azure-virtual-machine-github-docker-hub-azure-deploy-pipeline-part-1-4b1e73dd0d7

Part 2 : https://hasansahinn.medium.com/docker-file-and-net-core-project-github-docker-hub-azure-deploy-pipeline-part-2-4526bc02581d

Part 3 : https://hasansahinn.medium.com/github-actions-auto-test-github-docker-hub-azure-deploy-pipeline-part-3-105d9002acae

Part 4 : https://hasansahinn.medium.com/publishing-in-dockerhub-and-azure-github-docker-hub-azure-deploy-pipeline-part-4-d6efde5aca1e

--

--