Code in GitHub, Build in Azure DevOps for Free
Learn how to use Azure DevOps's free build pipelines to build projects in GitHub.
Join the DZone community and get the full member experience.
Join For Freewhen you create a new open-source project in github, one of the first steps is to set up continuous integration; the usual question is, what ci engine should i use? thanks to azure devops, you can use free build pipelines to build projects even if they are in github (not hosted in azure devops).
azure devops, formerly known as vsts, allows you to define free build pipelines to build projects in github. after you've created a new project in github, you can simply log into your azure devops account , then go to azure pipelines and start creating a new pipeline.
wizard to create a new pipeline in azure devops.
as you can see, you can choose github repository or azure repositories. this is the latest ui available for azure pipelines and allows you to create a pipeline with yaml (definition with code). since i really prefer this approach than the usual graphical editor, i choose to create my new pipeline with yaml, so i simply press git hub to specify that i want to build a project hosted in github.
pressing "authorize," you can authorize with oauth in github. if you prefer, you can use a token or install the azure devops app from the github marketplace, but for this example, i'm using oauth, because it is the simpler approach.
once logged in, i can browse and search for the repository i want to build.
when you choose the repository, the wizard analyzes the code in the repository, suggesting the template that best suits your need. in my example, the code is a standard .net desktop application (a console app).
you can choose another template or you can start from an empty template. whatever is your choice, you can always change the template later, so i chose .net desktop and moved on.
thanks to the new wizard, you can start with a template and a yaml definition that contains basic steps to use as a starting point.
once i've chosen the template, the wizard generates a yaml build definition based on that template, as shown here:
clearly, the yaml code for the build should be in the repository, so i press the save and run button, then choose to create the file in another special branch.
once the wizard commits the yaml definition, the build immediately starts, so you can verify if everything is ok. the nice aspect is that you do not need to configure a build agent because the build will be executed by hosted agent, an agent automatically managed by microsoft, which is hosted in azure. for open-source projects, azure devops gives you 10 concurrent builds with unlimited minutes per month, this is really cool. azure pipelines gives you free minutes month and 10 concurrent builds for open-source projects.
the yaml definition is created on the root folder of the repository, if you do not like the position you can simply manually change location and name of the file, then update the build definition to use the new location. usually, i change the location, add the list of branches i want to monitor with continuous integration and add my gitversion task to assign build number with gitversion.
just push with the new definition and now you define triggers that automatically builds every push to standard master, develop, feature, release, and hotfix branches. thanks to the yaml definition, everything regarding the build is defined in the yaml file.
once the build is up and running, you can go to the summary of the pipeline definition and you can grab the link for the badge to use in the readme in github.
pressing the status badge will show you links to render build badges. usually, you can put these links into the readme.md of your repository. if you look at the badge url, you can verify that you can specify any branch name; for a gitflow-enabled repository, at least, i'm going to show the status for the master and development branches.
et voilĂ , badges can be included in the github readme.
thanks to azure pipelines i've setup with few minutes of work a continuous integration pipeline; absolutely for free, without the need to install any agent and directly with yaml code.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments