|
| 1 | +--- |
| 2 | +title: DevOps with .NET and GitHub Actions - Compare GitHub Actions with Azure Pipelines |
| 3 | +description: GitHub Actions and Azure Pipelines compared and contrasted for decision makers |
| 4 | +author: colindembovsky |
| 5 | +ms.date: 03/04/2021 |
| 6 | +--- |
| 7 | + |
| 8 | +# Compare and contrast GitHub Actions and Azure Pipelines |
| 9 | + |
| 10 | +[GitHub Actions](https://docs.github.com/actions) and [Azure Pipelines](/azure/devops/pipelines/get-started/what-is-azure-pipelines?view=azure-devops&preserve-view=true) have a common history. In fact, the Actions agent is a fork of the Pipelines agent. There are many similarities between GitHub Actions and Azure Pipelines and it's worth comparing and contrasting them. |
| 11 | + |
| 12 | +## Pipelines as code |
| 13 | + |
| 14 | +Before you compare GitHub Actions and Azure Pipelines, you should consider the benefits of _pipelines as code_. Pipelines as code: |
| 15 | + |
| 16 | +> [!div class="checklist"] |
| 17 | +
|
| 18 | +> * Benefit from standard source control practices (such as code reviews via pull request and versioning). |
| 19 | +> * Can be audited for changes just like any other files in the repository. |
| 20 | +> * Don’t require accessing a separate system or UI to edit. |
| 21 | +> * Can fully codify the build, test, and deploy process for code. |
| 22 | +> * Can usually be templatized to empower teams to create standard processes across multiple repositories. |
| 23 | +
|
| 24 | +> [!NOTE] |
| 25 | +> The term "pipelines" can also be referred to by several different interchangeable words: _pipeline_, _workflow_ and _build_ are common terms. In this article, references to _Azure Pipelines_ are referring to [YAML Pipelines](/azure/devops/pipelines/get-started/pipelines-get-started?view=azure-devops&preserve-view=true#define-pipelines-using-yaml-syntax), and not the older UI-based [Classic Pipelines](/azure/devops/pipelines/get-started/pipelines-get-started?view=azure-devops&preserve-view=true#define-pipelines-using-the-classic-interface). |
| 26 | +
|
| 27 | +## Agents and runners |
| 28 | + |
| 29 | +Before you examine pipelines themselves, you should consider how these pipelines _execute_. Both GitHub Actions and Azure Pipelines are really _orchestration engines_: when a pipeline is triggered, the system finds an "agent" and tells the agent to execute the jobs defined in the pipeline file. |
| 30 | + |
| 31 | +Azure Pipelines run on _agents_. The agent is written in .NET, so it will run wherever .NET can run: Windows, macOS, and Linux. Agents can even run in containers. Agents are registered to a [pool](/azure/devops/pipelines/agents/pools-queues?view=azure-devops&preserve-view=true) in Azure Pipelines or to a repository or organization in GitHub. Agents can be _hosted_ or _private_. |
| 32 | + |
| 33 | +GitHub Workflows execute on _runners_. The runner code is essentially a fork of the Azure Pipelines code, so it's very similar. It's also cross-platform and you can also use _hosted_ or _self-hosted_ runners. |
| 34 | + |
| 35 | +### Hosted agents and runners |
| 36 | + |
| 37 | +Hosted agents (Azure Pipelines) and hosted runners (GitHub) are agents that are spun up and managed by Azure DevOps or GitHub respectively. You don't need to maintain any build infrastructure. When a pipeline triggers that targets a hosted agent, an instance of the specified agent image is created. The job is run by the agent on the instance, and once the job completes, the instance is destroyed. The same applies for hosted runners running GitHub workflows. |
| 38 | + |
| 39 | +> [!NOTE] |
| 40 | +> The list of software installed on Azure Pipeline images is listed in [this repository](https://github.com/actions/virtual-environments/tree/master/images). You can select the platform folder and examine the *README.md* files. You can find information on GitHub hosted runners [here](https://docs.github.com/actions/reference/specifications-for-github-hosted-runners). |
| 41 | +
|
| 42 | +### Private agents and self-hosted runners |
| 43 | + |
| 44 | +There are times when you can't use hosted images. For example, when you: |
| 45 | + |
| 46 | +- Require SDKs or other software that isn't installed on the images. |
| 47 | +- Need to access resources that aren't public (such as an internal SonarQube server or an internal Artifactory instance). |
| 48 | +- Need to deploy to private networks. |
| 49 | +- Need to install licenses for third-party software required for building your code. |
| 50 | +- Need more storage or memory than is provided to the hosted agent images. |
| 51 | +- Need more time than the maximum build time limit for hosted agents. |
| 52 | + |
| 53 | +> [!IMPORTANT] |
| 54 | +> It's possible to install tools and SDKs when running pipelines on hosted agents. If the install steps don't take long, this is viable. However, if the tools/software take a long time to install, then you may be better off with a private agent or self-hosted runner, since the install steps will need to execute for every run of the workflow. |
| 55 | +
|
| 56 | +### Azure DevOps agents |
| 57 | + |
| 58 | +Every Azure DevOps account has a hosted pool with a single agent that can run one job at a time. Also included is a set number of free build minutes. You may purchase additional "hosted pipelines" in Azure DevOps. When you purchase an additional hosted pipeline, you're really removing the build minutes limit and adding _concurrency_. One pipeline can run one job at a time. Two pipelines can run two jobs simultaneously, and so on. |
| 59 | + |
| 60 | +### Comparison of agents |
| 61 | + |
| 62 | +|Feature|GitHub|Azure Pipelines|Links| |
| 63 | +|-------|------|---------------|-----| |
| 64 | +|Hosted agents for public repos/projects|Free|[No free minutes](https://devblogs.microsoft.com/devops/change-in-azure-pipelines-grant-for-public-projects/) for public projects|[Azure Pipelines](/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml&preserve-view=true#capabilities-and-limitations) [GitHub](https://github.com/features/actions)| |
| 65 | +|Hosted agents for private repos/projects|2,000 minutes free per month, 3,000 minutes for Pro and Team licenses, 50,000 minutes for Enterprise license. Additional minutes may be purchased.|One free parallel job that can run for up to 60 minutes each time, until you've used 1,800 minutes (30 hours) per month. You can pay for additional capacity per parallel job. Paid parallel jobs remove the monthly time limit and allow you to run each job for up to 360 minutes (6 hours).|| |
| 66 | +|Cross-platform|Yes|Yes|| |
| 67 | +|Scale set agents|No|Yes|Read about scale-set agents [here](/azure/devops/pipelines/agents/scale-set-agents?view=azure-devops&preserve-view=true)| |
| 68 | + |
| 69 | +## Comparison of GitHub Actions and Azure Pipelines |
| 70 | + |
| 71 | +Azure Pipelines (YAML pipelines) provide a mature set of features. Features include approvals, artifact storage, deployment jobs, environments, gates, stages, templates, triggers, variable groups, and more. For a full list of Azure Pipelines features, refer to the table [here](/azure/devops/pipelines/get-started/pipelines-get-started?view=azure-devops&preserve-view=true#feature-availability). |
| 72 | + |
| 73 | +GitHub Actions are evolving rapidly and provide features such as triggers for almost all GitHub events, artifact storage, environments and environment rules, starter templates, and matrices. Read more about the full GitHub Actions feature set [here](https://docs.github.com/actions). |
| 74 | + |
| 75 | +### Feature comparison |
| 76 | + |
| 77 | +(As of March 2021) |
| 78 | + |
| 79 | +|Feature|Description|GitHub Actions|Azure Pipelines| |
| 80 | +|-------|-----------|--------------|---------------| |
| 81 | +|Approvals|Define approval conditions before moving further in the pipeline|Yes|Yes| |
| 82 | +|Artifacts|Upload, store, and download artifacts from jobs|Yes|Yes| |
| 83 | +|Caching|Cache folders or files for subsequent runs|Yes|Yes| |
| 84 | +|Conditions|Specify conditions for steps or jobs|Yes|Yes| |
| 85 | +|Container Jobs|Run jobs inside a container|Yes|Yes| |
| 86 | +|Demands|Specify demands that must be met to match jobs to agents|No|Yes| |
| 87 | +|Dependencies|Specify dependencies between jobs or stages|Yes|Yes| |
| 88 | +|Deployment Groups|A logical set of target machines for deployments|No|Yes| |
| 89 | +|Deployment Jobs|Job that targets a deployment group|No|Yes| |
| 90 | +|Environments|A collection of resources to target or a logical environment|Yes|Yes| |
| 91 | +|Gates|Automatic collection and evaluation of signals to control continuation|No|Yes| |
| 92 | +|Jobs|Sequence of steps that are executed on an agent|Yes|Yes| |
| 93 | +|Service Containers|Manage the lifecycle of a containerized service instance available during a job|Yes|Yes| |
| 94 | +|Service Connections|Abstract credentials to external systems|No|Yes| |
| 95 | +|Stages|Organize jobs in a pipeline|No|Yes| |
| 96 | +|Templates|Define reusable, parameterized building blocks for steps, jobs, or variables|No|Yes| |
| 97 | +|Starter Templates|Defines a starter workflow based on the type of code detected in a repository|Yes|No| |
| 98 | +|Triggers|Set of events that cause the pipeline to trigger|Yes|Yes| |
| 99 | +|Variables|Variables that can be passed in, statically or dynamically defined|Yes|Yes| |
| 100 | +|Variable Groups|Store values for use across multiple pipelines|No|Yes| |
| 101 | + |
| 102 | +## Recommendation table for common scenarios |
| 103 | + |
| 104 | +The following table shows some common scenarios and platform recommendations for each. As always, there will be exceptions. Consider your exact scenario carefully. |
| 105 | + |
| 106 | +|Requirement|Platform| |
| 107 | +|-----------|--------| |
| 108 | +|I need to create reusable templates to standardize how jobs are executed across multiple teams|Azure Pipelines| |
| 109 | +|I need to have automated gates control pipeline progress|Azure Pipelines| |
| 110 | +|I need to define multiple stages|Azure Pipelines| |
| 111 | +|I need multiple jobs to target the same environment|Azure Pipelines| |
| 112 | +|I need to model multiple, complex environments|Azure Pipelines| |
| 113 | +|I need to use the same environments across multiple projects/repos|Azure Pipelines| |
| 114 | +|I have repos that aren't in GitHub|Azure Pipelines| |
| 115 | +|I need to create custom tasks that aren't open-source|Azure Pipelines| |
| 116 | +|I need a simple workflow for building and deploying open-source repositories to a small set of environments|GitHub Actions| |
| 117 | +|I need to model workflows for scenarios other than CI/CD. For example, custom alerts on pull requests|GitHub Actions| |
| 118 | +|I need to create custom tasks that are open-source|Both| |
0 commit comments