Skip to content

Commit 65bf398

Browse files
authored
[ci] Enable CI for Maestro bot PRs (dotnet#5837)
Context: dotnet#5830 We'd like to have our PR builds and tests run automatically against dependency bump PRs created by the dotnet Maestro bot. To do this, I've overridden the CI triggers in the Xamarin.Android-PR pipeline to include branches that begin with `darc-*`. These branches will now trigger a build automatically, but it will be building an individual commit and not a merge commit. The xaprepare tool has been updated to enable all test jobs in these cases.
1 parent bf4f4f4 commit 65bf398

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,32 @@ protected override async Task<bool> Execute (Context context)
1616
{
1717
Log.StatusLine ("Determining test jobs to run...");
1818

19+
var runAllTestsLoggingCommand = "##vso[task.setvariable variable=TestAreas;isOutput=true]MSBuild,MSBuildDevice,BCL,Designer";
20+
1921
string commitRevision = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION");
2022
string commitMessage = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSIONMESSAGE");
2123
if (string.IsNullOrEmpty (commitRevision) || string.IsNullOrEmpty (commitMessage)) {
22-
Log.ErrorLine ("One or more source version variable values were empty:");
23-
Log.ErrorLine ($"BUILD_SOURCEVERSION='{commitRevision}' BUILD_SOURCEVERSIONMESSAGE='{commitMessage}'.");
24-
return false;
24+
Log.WarningLine ("One or more source version variable values were empty:");
25+
Log.WarningLine ($"BUILD_SOURCEVERSION='{commitRevision}' BUILD_SOURCEVERSIONMESSAGE='{commitMessage}'.");
26+
Log.MessageLine (runAllTestsLoggingCommand);
27+
return true;
2528
}
2629

27-
// Assume we're building a merge commit as part of an Azure Pipelines PR build. Otherwise, this step will fail.
30+
// Assume we're building a merge commit as part of an Azure Pipelines PR build. Otherwise, run all tests.
2831
// Example: Merge 0b66502c8b9f33cbb8d21b2dab7c100629aec081 into 0bef8aa5cd74d83d77c4e2b3f63975a0deb804b3
2932
var commitMessagePieces = commitMessage.Split (new string [] { " " }, StringSplitOptions.RemoveEmptyEntries);
3033
if (string.IsNullOrEmpty (commitMessagePieces [3])) {
31-
Log.ErrorLine ($"Unable to parse merge commit message from: '{commitMessage}'.");
32-
return false;
34+
Log.WarningLine ($"Unable to parse merge commit message from: '{commitMessage}'.");
35+
Log.MessageLine (runAllTestsLoggingCommand);
36+
return true;
3337
}
3438

3539
var git = new GitRunner (context);
3640
var filesChanged = await git.RunCommandForOutputAsync (BuildPaths.XamarinAndroidSourceRoot, "diff", "--name-only", commitRevision, commitMessagePieces [3]);
3741
if (filesChanged == null || filesChanged.Count < 1) {
38-
Log.ErrorLine ($"Unable to determine if any files were changed in this PR.");
39-
return false;
42+
Log.WarningLine ($"Unable to determine if any files were changed in this PR.");
43+
Log.MessageLine (runAllTestsLoggingCommand);
44+
return true;
4045
}
4146

4247
var testAreas = new HashSet<string> ();

0 commit comments

Comments
 (0)