Hands-on Demo – Integrating GitHub repository with Azure Pipelines
In this demo, we'll walk through the process of integrating a GitHub repository with Azure Pipelines, creating a basic pipeline to automate builds, tests, and deployments.
Here is the Step-by-Step Guide to Integrate GitHub Repository with Azure Pipelines.
Step 1: Create a GitHub Repository
Create a New Repository in GitHub:
Log in to GitHub.
Click on + New repository.
Fill in the necessary details (Repository name, Description, etc.) and click Create repository.
Push Code to GitHub:
Clone the newly created repository to your local machine.
Add a simple
README.mdfile or a simple project like a.NETproject.Commit and push changes back to GitHub.
Step 2: Set Up Azure DevOps Project
Create a New Azure DevOps Project:
Log in to Azure DevOps.
Click + New Project and provide the necessary details (Project name, Visibility, etc.).
Connect GitHub Repository to Azure DevOps:
Navigate to Pipelines –> New Pipeline.
Choose GitHub as the source.
Authenticate with GitHub if required.
Select the repository from GitHub and proceed.
Step 3: Create a Basic Pipeline
Define a Pipeline Using YAML:
In the Azure DevOps pipeline creation screen, choose YAML.
Azure DevOps will generate a basic YAML pipeline.
Modify YAML Pipeline:
Replace the generated YAML with the following simple build pipeline:
xxxxxxxxxx231trigger2main3pool4vmImage'ubuntu-latest'5stages6stageBuild7jobs8jobBuild9steps10checkoutself11script12echo "Building application"13dotnet build -c Release14displayName: 'Build Job'15stageTest16dependsOnBuild17jobs18jobTest19steps20script21echo "Running tests"22dotnet test --no-restore --no-build23displayName: 'Test Job'Commit and Run the Pipeline:
Commit the changes to the YAML file in your GitHub repository.
Azure Pipelines will automatically pick up the changes and trigger the pipeline.
Step 4: Monitor Pipeline Execution
View Pipeline Execution:
Navigate to Pipelines –> Select your pipeline.
Monitor the build and test jobs in real-time.
Review Logs: Inspect detailed logs for builds and tests to ensure everything runs smoothly.
Summary
After completing these steps, your GitHub repository is integrated with Azure Pipelines. Each commit or pull request to the GitHub repository can trigger builds and tests, automating the development workflow.






















Leave a Reply