A previous article guided you through setting up your repository. You did this by creating multiple branches that reflect the GitFlow model and protecting those branch use policies. Then, I gave you an overview of how pull requests work. This article — the final installment in the Azure series — will show you how to implement Azure’s continuous testing, integration, and deployment mechanisms.

Continuous Integration

Continuous Integration (CI) is a practice that allows multiple developers to frequently merge code changes into a remote repository by automating the build, test, and run processes. To implement your own CI pipeline in Azure, follow these steps:

  • From the dashboard, select Pipelines.
  • Click the New Pipeline button.
  • Select Azure Git Repos as a source that will trigger our pipeline.
  • From the multiple templates that Azure DevOps will suggest, select **Starter Pipeline **and paste the following code in it.
trigger:
- main

pool:
  vmImage: ubuntu-latest
variables
  buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

Continuous Testing

As mentioned before, the continuous integration pipeline can perform both static and dynamic tests automatically. Static testing is a technique to improve the quality of your application by detecting bugs, vulnerabilities, and code smells without executing your application’s code. Dynamic testing, on the other hand, focuses on the behavior of your application; it requires execution of your application’s code.

This tutorial will teach you how to perform static testing using SonarCloud.

Install the SonarCube Extension

To be able to use the SonarCloud functionalities, you must install the SonarCloud extension in your organization using the following steps:

  • Sign in to your Azure DevOps organization.
  • Go to Organization Settings.
  • Select Extensions.
  • Click on Browse Marketplace at the top right.
  • As the Marketplace opens, search for **SonarCloud. **Click on the correct SonarCloud result as shown below.
  • Click on the Get it Free button.
  • Select your target organization from the dropdown, then click Install to complete the procedure.

#microsoft #azure-devops #continuous-integration #testing

How Azure can help your company expand in multiple regions (5 of 5)
1.25 GEEK