Skip to content

Commit 3078a28

Browse files
committed
[ci] Stop building monodroid in builds from forks
Removes all usage of provisionator and monodroid build and test steps when building a PR from a fork.
1 parent afd1274 commit 3078a28

File tree

22 files changed

+87
-124
lines changed

22 files changed

+87
-124
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ resources:
3737
endpoint: xamarin
3838

3939
parameters:
40-
- name: provisionatorChannel
41-
type: string
42-
default: latest # Support for launching a build against a Provisionator PR (e.g., pr/[github-account-name]/[pr-number]) as a means to test in-progress Provisionator changes
4340
- name: macTestAgentsUseCleanImages # Test agents we do not need to clean up when finished because they are not reused
4441
default: true
4542

@@ -83,8 +80,6 @@ variables:
8380
# Stage and Job "display names" are shortened because they are combined to form the name of the corresponding GitHub check.
8481
stages:
8582
- template: yaml-templates/build-macos.yaml
86-
parameters:
87-
provisionatorChannel: ${{ parameters.provisionatorChannel }}
8883

8984
- template: yaml-templates/build-windows.yaml
9085

@@ -107,7 +102,6 @@ stages:
107102
- template: yaml-templates/setup-test-environment.yaml
108103
parameters:
109104
provisionClassic: false
110-
provisionatorChannel: ${{ parameters.provisionatorChannel }}
111105
installLegacyDotNet: false
112106
restoreNUnitConsole: false
113107
updateMono: false
@@ -267,8 +261,6 @@ stages:
267261
- template: yaml-templates/setup-ubuntu.yaml
268262

269263
- template: yaml-templates/setup-test-environment.yaml
270-
parameters:
271-
provisionatorChannel: ${{ parameters.provisionatorChannel }}
272264

273265
- task: DownloadPipelineArtifact@2
274266
inputs:
@@ -347,7 +339,6 @@ stages:
347339
parameters:
348340
xaSourcePath: $(Build.SourcesDirectory)/xamarin-android
349341
provisionClassic: false
350-
provisionatorChannel: ${{ parameters.provisionatorChannel }}
351342
installLegacyDotNet: false
352343
restoreNUnitConsole: false
353344
updateMono: false

build-tools/automation/yaml-templates/build-macos.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ parameters:
1111
jobName: mac_build_create_installers
1212
jobDisplayName: macOS > Build
1313
nugetArtifactName: $(NuGetArtifactName)
14-
provisionatorChannel: latest
1514
repositoryAlias: self
1615
stageName: mac_build
1716
stageDisplayName: Mac
@@ -49,7 +48,6 @@ stages:
4948
parameters:
5049
installerArtifactName: ${{ parameters.installerArtifactName }}
5150
nugetArtifactName: ${{ parameters.nugetArtifactName }}
52-
provisionatorChannel: ${{ parameters.provisionatorChannel }}
5351
testAssembliesArtifactName: ${{ parameters.testAssembliesArtifactName }}
5452

5553
- powershell: |

build-tools/automation/yaml-templates/commercial-build.yaml

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ parameters:
33
xaSourcePath: $(System.DefaultWorkingDirectory)/xamarin-android
44
makeMSBuildArgs: ''
55
nugetArtifactName: $(NuGetArtifactName)
6-
provisionatorChannel: latest
76
testAssembliesArtifactName: $(TestAssembliesArtifactName)
87

98
steps:
@@ -19,55 +18,49 @@ steps:
1918
inputs:
2019
forceReinstallCredentialProvider: true
2120

22-
- task: provisionator@2
23-
displayName: Install Xcode
24-
inputs:
25-
github_token: $(GitHub.Token)
26-
provisioning_script: ${{ parameters.xaSourcePath }}/build-tools/provisioning/xcode.csx
27-
provisioning_extra_args: '-v -v -v -v'
28-
env:
29-
PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}
30-
3121
- script: make prepare-update-mono CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1
3222
workingDirectory: ${{ parameters.xaSourcePath }}
3323
displayName: make prepare-update-mono
3424

35-
# Clone 'monodroid' without submodules
36-
- checkout: monodroid
37-
clean: true
38-
path: s/xamarin-android/external/monodroid
39-
40-
# Tell git to ignore the 'xamarin-android' submodule, which is large and unneeded
41-
- script: git config submodule."external/xamarin-android".update none
42-
workingDirectory: xamarin-android/external/monodroid
43-
displayName: Ignore XA submodule
44-
45-
# Clone 'monodroid' with the rest of the submodules
46-
- checkout: monodroid
47-
submodules: recursive
48-
path: s/xamarin-android/external/monodroid
49-
persistCredentials: true
50-
51-
- script: rm -rf external/monodroid/external/xamarin-android
52-
workingDirectory: ${{ parameters.xaSourcePath }}
53-
displayName: delete legacy xamarin-android submodule
54-
55-
- script: rm -rf external/opentk
56-
workingDirectory: ${{ parameters.xaSourcePath }}
57-
displayName: delete legacy opentk submodule
58-
59-
- script: rm -rf external/sqlite
60-
workingDirectory: ${{ parameters.xaSourcePath }}
61-
displayName: delete legacy sqlite submodule
25+
# Always checkout a second resource to ensure we are using multi-repo checkout behavior
26+
# https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#checkout-path
27+
- checkout: yaml-templates
28+
29+
- ${{ if ne(variables['System.PullRequest.IsFork'], 'True') }}:
30+
- script: >
31+
ls -l /Applications &&
32+
sudo xcode-select --switch /Applications/Xcode_14.2.app &&
33+
xcode-select --print-path
34+
displayName: Use Xcode 14.2
35+
36+
# Clone 'monodroid' without submodules
37+
- checkout: monodroid
38+
clean: true
39+
path: s/xamarin-android/external/monodroid
40+
41+
# Tell git to ignore the 'xamarin-android' submodule, which is large and unneeded
42+
- script: git config submodule."external/xamarin-android".update none
43+
workingDirectory: xamarin-android/external/monodroid
44+
displayName: Ignore XA submodule
45+
46+
# Clone 'monodroid' with the rest of the submodules
47+
- checkout: monodroid
48+
submodules: recursive
49+
path: s/xamarin-android/external/monodroid
50+
persistCredentials: true
51+
52+
- script: rm -rf external/monodroid/external/xamarin-android
53+
workingDirectory: ${{ parameters.xaSourcePath }}
54+
displayName: delete legacy xamarin-android submodule
55+
56+
- script: make prepare-external-git-dependencies PREPARE_CI=1 CONFIGURATION=$(XA.Build.Configuration)
57+
workingDirectory: ${{ parameters.xaSourcePath }}
58+
displayName: make prepare-external-git-dependencies
6259

6360
- task: CodeQL3000Init@0
6461
displayName: CodeQL 3000 Init
6562
condition: and(succeeded(), eq(variables['Codeql.Enabled'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
6663

67-
- script: make prepare-external-git-dependencies PREPARE_CI=1 CONFIGURATION=$(XA.Build.Configuration)
68-
workingDirectory: ${{ parameters.xaSourcePath }}
69-
displayName: make prepare-external-git-dependencies
70-
7164
# Prepare and Build everything
7265
- script: make jenkins CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1 MSBUILD_ARGS='${{ parameters.makeMSBuildArgs }}'
7366
workingDirectory: ${{ parameters.xaSourcePath }}

build-tools/automation/yaml-templates/run-installer.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
parameters:
22
provisionExtraArgs: -vv -f
3-
provisionatorChannel: latest
43

54
steps:
65
- task: DownloadPipelineArtifact@2
@@ -38,6 +37,4 @@ steps:
3837
provisioning_script: $(XA.Provisionator.Args)
3938
provisioning_extra_args: ${{ parameters.provisionExtraArgs }}
4039
# Disabled on Windows on .NET release branches
41-
condition: and(succeeded(), ne(variables['agent.os'], 'Linux'), or(eq(variables.IsRelOrTargetingRel, 'False'), eq(variables['agent.os'], 'Darwin')))
42-
env:
43-
PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}
40+
condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True'), ne(variables['agent.os'], 'Linux'), or(eq(variables.IsRelOrTargetingRel, 'False'), eq(variables['agent.os'], 'Darwin')))

build-tools/automation/yaml-templates/setup-test-environment.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
parameters:
22
configuration: $(XA.Build.Configuration)
33
xaSourcePath: $(System.DefaultWorkingDirectory)
4-
updateVS: false
54
jdkTestFolder: $(JAVA_HOME_11_X64)
65
remove_dotnet: false
76
installTestSlicer: false
@@ -24,11 +23,6 @@ steps:
2423
clean: true
2524
submodules: recursive
2625

27-
- ${{ if eq(parameters.updateVS, true) }}:
28-
- template: update-vs.yaml
29-
parameters:
30-
xasourcePath: ${{ parameters.xaSourcePath }}
31-
3226
- script: |
3327
echo "##vso[task.setvariable variable=JI_JAVA_HOME]${{ parameters.jdkTestFolder }}"
3428
echo "##vso[task.setvariable variable=DOTNET_TOOL_PATH]${{ parameters.xaSourcePath }}/bin/${{ parameters.configuration }}/dotnet/dotnet"

build-tools/automation/yaml-templates/update-vs.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

build-tools/provisioning/vs2019.csx

Lines changed: 0 additions & 3 deletions
This file was deleted.

build-tools/provisioning/xcode.csx

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public partial class BuildTest : BaseTest
124124
/* debugSymbols */ true ,
125125
/* optimize */ true ,
126126
/* embedassebmlies */ false ,
127-
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
127+
/* expectedResult */ TestEnvironment.CommercialBuildAvailable ? "debug" : "release",
128128
},
129129
new object[] {
130130
/* supportedAbi */ "armeabi-v7a",
@@ -145,7 +145,7 @@ public partial class BuildTest : BaseTest
145145
/* debugSymbols */ false ,
146146
/* optimize */ null ,
147147
/* embedassebmlies */ null ,
148-
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
148+
/* expectedResult */ TestEnvironment.CommercialBuildAvailable ? "debug" : "release",
149149
},
150150
};
151151
#pragma warning restore 414

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
139139
Assert.AreEqual (XABuildConfig.AndroidDefaultTargetDotnetApiLevel.ToString(),
140140
uses_sdk.Attribute (ns + "targetSdkVersion").Value);
141141

142-
bool expectEmbeddedAssembies = !(CommercialBuildAvailable && !isRelease);
142+
bool expectEmbeddedAssembies = !(TestEnvironment.CommercialBuildAvailable && !isRelease);
143143
var apkPath = Path.Combine (outputPath, $"{proj.PackageName}-Signed.apk");
144144
FileAssert.Exists (apkPath);
145145
var helper = new ArchiveAssemblyHelper (apkPath, usesAssemblyStore, rids);
146146
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.dll", shouldContainEntry: expectEmbeddedAssembies);
147-
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: !CommercialBuildAvailable && !isRelease);
147+
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: !TestEnvironment.CommercialBuildAvailable && !isRelease);
148148
helper.AssertContainsEntry ($"assemblies/Mono.Android.dll", shouldContainEntry: expectEmbeddedAssembies);
149149
helper.AssertContainsEntry ($"assemblies/es/{proj.ProjectName}.resources.dll", shouldContainEntry: expectEmbeddedAssembies);
150150
foreach (var abi in rids.Select (AndroidRidAbiHelper.RuntimeIdentifierToAbi)) {
@@ -1030,6 +1030,8 @@ public void MicrosoftExtensionsHttp ()
10301030
[Test]
10311031
public void FastDeploymentDoesNotAddContentProvider ()
10321032
{
1033+
AssertCommercialBuild ();
1034+
10331035
var proj = new XamarinAndroidApplicationProject {
10341036
EmbedAssembliesIntoApk = false,
10351037
};

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,10 @@ public void DuplicateManagedNames ()
605605
}
606606

607607
[Test]
608-
[Category ("Commercial")]
609608
public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ()
610609
{
611-
if (!CommercialBuildAvailable)
612-
Assert.Ignore ("Not required on Open Source Builds");
610+
AssertCommercialBuild ();
611+
613612
const string target = "_GetPrimaryCpuAbi";
614613
var proj = new XamarinAndroidLibraryProject ();
615614
using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
@@ -619,10 +618,10 @@ public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ()
619618
}
620619

621620
[Test]
622-
[Category ("Commercial")]
623621
public void LibraryReferenceWithHigherTFVShouldDisplayWarning ([Values (true, false)] bool isRelease)
624622
{
625-
if (!CommercialBuildAvailable || Builder.UseDotNet)
623+
624+
if (!TestEnvironment.CommercialBuildAvailable || Builder.UseDotNet)
626625
Assert.Ignore ("Not applicable to One .NET or single framework OSS builds.");
627626

628627
var libproj = new XamarinAndroidLibraryProject () {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/DebuggingTasksTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
namespace Xamarin.Android.Build.Tests
1212
{
13-
[Category ("Node-2"), Category ("Commercial")]
13+
[Category ("Node-2")]
1414
[TestFixture, NonParallelizable]
1515
public class DebuggingTasksTests : BaseTest
1616
{
1717
[OneTimeSetUp]
1818
public void SetUp ()
1919
{
20-
if (!CommercialBuildAvailable)
21-
Assert.Ignore ("DebuggingTasksTests require Xamarin.Android.Build.Debugging.Tasks.");
20+
AssertCommercialBuild ();
2221
}
2322

2423
// https://github.com/xamarin/monodroid/blob/63bbeb076d809c74811a8001d38bf2e9e8672627/tests/msbuild/nunit/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests/ResolveXamarinAndroidToolsTests.cs

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,8 @@ public void LinkAssembliesNoShrink ()
694694
[Test]
695695
public void CSProjUserFileChanges ()
696696
{
697+
AssertCommercialBuild ();
698+
697699
var proj = new XamarinAndroidApplicationProject ();
698700
var selectedDevice = "foo";
699701
var csproj_user_file = $"{proj.ProjectName}.csproj.user";

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public void EolFrameworks()
7373
[Test]
7474
public void XA0119 ()
7575
{
76+
AssertCommercialBuild ();
77+
7678
var proj = new XamarinAndroidApplicationProject ();
7779
proj.SetProperty ("_XASupportsFastDev", "True");
7880
proj.SetProperty (proj.DebugProperties, "AndroidLinkMode", "Full");
@@ -86,6 +88,8 @@ public void XA0119 ()
8688
[Test]
8789
public void XA0119AAB ()
8890
{
91+
AssertCommercialBuild ();
92+
8993
var proj = new XamarinAndroidApplicationProject ();
9094
proj.SetProperty ("_XASupportsFastDev", "True");
9195
proj.SetProperty ("AndroidPackageFormat", "aab");

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,14 @@ public class BaseTest
2727

2828
public string Root => Path.GetFullPath (XABuildPaths.TestOutputDirectory);
2929

30-
public static bool CommercialBuildAvailable => TestEnvironment.CommercialBuildAvailable;
31-
3230
/// <summary>
3331
/// Checks if a commercial Xamarin.Android is available
3432
/// * Defaults to Assert.Ignore ()
3533
/// </summary>
3634
public void AssertCommercialBuild (bool fail = false)
3735
{
38-
if (!CommercialBuildAvailable) {
39-
var message = "This test requires a commercial build of Xamarin.Android.";
36+
if (!TestEnvironment.CommercialBuildAvailable) {
37+
var message = $"'{TestName}' requires a commercial build of Xamarin.Android.";
4038
if (fail) {
4139
Assert.Fail (message);
4240
} else {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/DeviceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ protected static void RunProjectAndAssert (XamarinAndroidApplicationProject proj
203203
if (Builder.UseDotNet) {
204204
builder.BuildLogFile = logName;
205205
Assert.True (builder.RunTarget (proj, "Run", doNotCleanupOnUpdate: doNotCleanupOnUpdate, parameters: parameters), "Project should have run.");
206-
} else if (CommercialBuildAvailable) {
206+
} else if (TestEnvironment.CommercialBuildAvailable) {
207207
builder.BuildLogFile = logName;
208208
Assert.True (builder.RunTarget (proj, "_Run", doNotCleanupOnUpdate: doNotCleanupOnUpdate, parameters: parameters), "Project should have run.");
209209
} else {

0 commit comments

Comments
 (0)