Make QualityGate project a test project instead of CLI.
DELETE
WalletWasabi.QualityGate/Program.cs
-using System;
-
-namespace WalletWasabi.QualityGate
-{
- // This software runs on CI and fails if the quality of a pull request does not conform to our rules.
- public static class Program
- {
- public static int Main(string[] args)
- {
- var command = args[0];
- if (command == "prtoolarge")
- {
- return -1;
- // throw new Exception("The pull request is too large. Please break it down to smaller pull requests.");
- }
-
- return 0;
- }
- }
-}

ADD
WalletWasabi.QualityGate/PullRequestSize.cs
+using System;
+using Xunit;
+
+namespace WalletWasabi.QualityGate
+{
+ public class PullRequestSize
+ {
+ [Fact]
+ public void PrTooLarge()
+ {
+ // Do checks here.
+ }
+ }
+}

MODIFY
WalletWasabi.QualityGate/WalletWasabi.QualityGate.csproj
WalletWasabi.QualityGate/WalletWasabi.QualityGate.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
+
+ <IsPackable>false</IsPackable>
</PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
+ <PackageReference Include="xunit" Version="2.4.0" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
+ <PackageReference Include="coverlet.collector" Version="1.0.1" />
+ </ItemGroup>
+
</Project>

MODIFY
WalletWasabi.sln
WalletWasabi.sln
@@ -32,7 +32,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WalletWasabi.Packager", "Wa
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "WalletWasabi.WindowsInstaller", "WalletWasabi.WindowsInstaller\WalletWasabi.WindowsInstaller.wixproj", "{54654468-4F58-4253-84BD-6F53A8D3D2C4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalletWasabi.QualityGate", "WalletWasabi.QualityGate\WalletWasabi.QualityGate.csproj", "{A38BF902-5F18-4A83-A14B-ED8B41D8E699}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalletWasabi.QualityGate", "WalletWasabi.QualityGate\WalletWasabi.QualityGate.csproj", "{A9098C93-016A-42AE-AF74-F3211F793987}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -87,14 +87,14 @@ Global
{54654468-4F58-4253-84BD-6F53A8D3D2C4}.Release|Any CPU.ActiveCfg = Release|x64
{54654468-4F58-4253-84BD-6F53A8D3D2C4}.Release|x64.ActiveCfg = Release|x64
{54654468-4F58-4253-84BD-6F53A8D3D2C4}.Release|x64.Build.0 = Debug|x64
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Debug|x64.Build.0 = Debug|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Release|Any CPU.Build.0 = Release|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Release|x64.ActiveCfg = Release|Any CPU
- {A38BF902-5F18-4A83-A14B-ED8B41D8E699}.Release|x64.Build.0 = Release|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Debug|x64.Build.0 = Debug|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Release|x64.ActiveCfg = Release|Any CPU
+ {A9098C93-016A-42AE-AF74-F3211F793987}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

MODIFY
azure-pipelines-quality.yml
azure-pipelines-quality.yml
@@ -8,8 +8,8 @@ jobs:
inputs:
version: 3.1.x
- task: DotNetCoreCLI@2
- displayName: 'Pull Request Too Large'
+ displayName: 'Quality Gate'
inputs:
- command: run
+ command: test
projects: 'WalletWasabi.QualityGate/WalletWasabi.QualityGate.csproj'
- arguments: --configuration Release -- prtoolarge
+ arguments: --configuration Release

Make QualityGate project a test project instead of CLI.