From 4a64fa2fc10559248f16e6b3a9ac836f38541e78 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Wed, 6 May 2020 04:49:06 -0600 Subject: [PATCH] Setup more specific 2017 apk/ipas for testing lanes (#10569) * set provisionator sdks from pipeline * - 2017 specific ui test builds * - env * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - arg * - build configuration * - build configuration * - build configuration * - build configuration * - check for signVmImage before running nuget signing * Update provisioning.csx * - build downloads update --- .../Nuget2019.Build.targets | 2 +- azure-pipelines.yml | 21 ++++++++-- build.cake | 8 +++- build/provisioning/provisioning.csx | 39 +++++++++++++++++++ build/steps/build-android.yml | 21 ++++++++-- build/steps/build-nuget.yml | 4 +- build/steps/build-osx.yml | 17 +++++++- 7 files changed, 99 insertions(+), 13 deletions(-) diff --git a/Xamarin.Forms.ControlGallery.Android/Nuget2019.Build.targets b/Xamarin.Forms.ControlGallery.Android/Nuget2019.Build.targets index 02369be44..aea0f9900 100644 --- a/Xamarin.Forms.ControlGallery.Android/Nuget2019.Build.targets +++ b/Xamarin.Forms.ControlGallery.Android/Nuget2019.Build.targets @@ -1,7 +1,7 @@ - 0.7.1 + 0.10.0 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44ec81297..ce56104a0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,4 @@ variables: -- name: DefaultBuildConfiguration - value: Debug - name: DefaultBuildPlatform value: 'any cpu' - name: ApkName @@ -206,6 +204,23 @@ stages: parameters: vmImage: $(macOSXVmImage) provisionatorPath : 'build/provisioning/provisioning.csx' + buildForVS2017: false + buildConfiguration: $(DefaultBuildConfiguration) + + - stage: android_2017 + displayName: Build Android 2017 + condition: eq(variables['System.TeamProject'], 'devdiv') + ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: + dependsOn: windows + ${{ if eq(variables['System.TeamProject'], 'public') }}: + dependsOn: [] + jobs: + - template: build/steps/build-android.yml + parameters: + vmImage: 'macOS-10.14' + provisionatorPath : 'build/provisioning/provisioning.csx' + buildForVS2017: true + buildConfiguration: $(DefaultBuildConfiguration) - stage: build_osx displayName: Build OSX @@ -274,6 +289,6 @@ stages: msbuild steps: - template: build/steps/build-sign.yml - condition: and(succeeded(), or(eq(variables['Sign'], 'true'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/')))) + condition: and(succeeded(), ne(variables['signVmImage'], ''), or(eq(variables['Sign'], 'true'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/')))) diff --git a/build.cake b/build.cake index 85c989c13..dc13857d6 100644 --- a/build.cake +++ b/build.cake @@ -40,7 +40,9 @@ var packageVersion = Argument("packageVersion", ""); var releaseChannelArg = Argument("CHANNEL", "Stable"); releaseChannelArg = EnvironmentVariable("CHANNEL") ?? releaseChannelArg; var teamProject = Argument("TeamProject", ""); -bool buildForVS2017 = Convert.ToBoolean(Argument("buildForVS2017", "false")); + +var buildForVS2017Arg = EnvironmentVariable("buildForVS2017") ?? Argument("buildForVS2017", "false"); +bool buildForVS2017 = Convert.ToBoolean(buildForVS2017Arg); string artifactStagingDirectory = Argument("Build_ArtifactStagingDirectory", (string)null) ?? EnvironmentVariable("Build.ArtifactStagingDirectory") ?? EnvironmentVariable("Build_ArtifactStagingDirectory") ?? "."; var ANDROID_HOME = EnvironmentVariable("ANDROID_HOME") ?? @@ -52,6 +54,8 @@ string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;androi Information ("ANDROID_HOME: {0}", ANDROID_HOME); Information ("Team Project: {0}", teamProject); Information ("buildForVS2017: {0}", buildForVS2017); +Information ("EnvironmentVariable buildForVS2017: {0}", EnvironmentVariable("buildForVS2017")); +Information ("Argument buildForVS2017: {0}", Argument("buildForVS2017", "not set")); var releaseChannel = ReleaseChannel.Stable; if(releaseChannelArg == "Preview") @@ -69,7 +73,7 @@ string monoPatchVersion = ""; string monoMajorVersion = ""; string monoVersion = ""; -if(buildForVS2017 || teamProject == "DevDiv") +if(buildForVS2017) { // VS2017 monoMajorVersion = "5.18.1"; diff --git a/build/provisioning/provisioning.csx b/build/provisioning/provisioning.csx index 6044ca40c..51394d6c6 100644 --- a/build/provisioning/provisioning.csx +++ b/build/provisioning/provisioning.csx @@ -14,6 +14,8 @@ string macSDK_macos = "";//$"https://download.visualstudio.microsoft.com/downloa +Console.WriteLine ("buildForVS2017: {0}", Environment.GetEnvironmentVariable ("buildForVS2017")); + if (IsMac) { if (!Directory.Exists ("/Library/Frameworks/Mono.framework/Versions/Current/Commands/")) @@ -26,6 +28,10 @@ if (IsMac) Item (XreItem.Java_OpenJDK_1_8_0_25); string releaseChannel = Environment.GetEnvironmentVariable ("CHANNEL"); + Console.WriteLine ("ANDROID_SDK_MAC: {0}", Environment.GetEnvironmentVariable ("ANDROID_SDK_MAC")); + Console.WriteLine ("IOS_SDK_MAC: {0}", Environment.GetEnvironmentVariable ("IOS_SDK_MAC")); + Console.WriteLine ("MONO_SDK_MAC: {0}", Environment.GetEnvironmentVariable ("MONO_SDK_MAC")); + Console.WriteLine ("MAC_SDK_MAC: {0}", Environment.GetEnvironmentVariable ("MAC_SDK_MAC")); if(releaseChannel == "Preview") { @@ -35,6 +41,22 @@ if (IsMac) XamarinChannel("Stable"); } + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("ANDROID_SDK_MAC"))) + Item ("Xamarin.Android") + .Source (_ => Environment.GetEnvironmentVariable ("ANDROID_SDK_MAC")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("IOS_SDK_MAC"))) + Item ("Xamarin.iOS") + .Source (_ => Environment.GetEnvironmentVariable ("IOS_SDK_MAC")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("MONO_SDK_MAC"))) + Item ("Mono") + .Source (_ => Environment.GetEnvironmentVariable ("MONO_SDK_MAC")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("MAC_SDK_MAC"))) + Item ("Xamarin.Mac") + .Source (_ => Environment.GetEnvironmentVariable ("MAC_SDK_MAC")); + if(!String.IsNullOrEmpty(monoSDK_macos)) Item ("Mono", monoVersion) .Source (_ => monoSDK_macos); @@ -53,6 +75,23 @@ if (IsMac) } else { + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("ANDROID_SDK_WINDOWS"))) + Item ("Xamarin.Android") + .Source (_ => Environment.GetEnvironmentVariable ("ANDROID_SDK_WINDOWS")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("IOS_SDK_WINDOWS"))) + Item ("Xamarin.iOS") + .Source (_ => Environment.GetEnvironmentVariable ("IOS_SDK_WINDOWS")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("MONO_SDK_WINDOWS"))) + Item ("Mono") + .Source (_ => Environment.GetEnvironmentVariable ("MONO_SDK_WINDOWS")); + + if(!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable ("MAC_SDK_WINDOWS"))) + Item ("Xamarin.Mac") + .Source (_ => Environment.GetEnvironmentVariable ("MAC_SDK_WINDOWS")); + if(!String.IsNullOrEmpty(androidSDK_windows)) Item ("Xamarin.Android", "10.0.0.43") .Source (_ => androidSDK_windows); diff --git a/build/steps/build-android.yml b/build/steps/build-android.yml index fcccf96da..a320d3f21 100644 --- a/build/steps/build-android.yml +++ b/build/steps/build-android.yml @@ -29,30 +29,33 @@ jobs: android_legacy: renderers: 'LEGACY' outputfolder: 'legacyRenderers' + buildForVS2017: ${{ parameters.buildForVS2017 }} android_preAppCompat: renderers: 'PREAPPCOMPAT' outputfolder: 'preAppCompat' + buildForVS2017: ${{ parameters.buildForVS2017 }} android_newRenderers: renderers: 'FAST' outputfolder: 'newRenderers' + buildForVS2017: ${{ parameters.buildForVS2017 }} steps: - checkout: self clean: true - task: xamops.azdevex.provisionator-task.provisionator@1 displayName: 'Provisionator' - condition: eq(variables['provisioning'], 'true') + condition: and(eq(variables['provisioning'], 'true'), eq(variables['buildForVS2017'], 'false')) inputs: provisioning_script: ${{ parameters.provisionatorPath }} provisioning_extra_args: ${{ parameters.provisionator.extraArguments }} - task: Bash@3 displayName: 'Cake Provision' - condition: eq(variables['provisioningCake'], 'true') + condition: or(eq(variables['provisioningCake'], 'true'), eq(variables['buildForVS2017'], 'true')) inputs: targetType: 'filePath' filePath: 'build.sh' - arguments: --target provision --TeamProject="$(System.TeamProject)" + arguments: --target provision --TeamProject="$(System.TeamProject)" --buildForVS2017=$(buildForVS2017) - task: UseDotNet@2 displayName: 'Install .net core $(DOTNET_VERSION)' @@ -102,7 +105,7 @@ jobs: inputs: solution: ${{ parameters.androidProjectPath }} configuration: ${{ parameters.buildConfiguration }} - msbuildArguments: '/t:"Rebuild;SignAndroidPackage" /p:ANDROID_RENDERERS="$(renderers)" /bl:$(Build.ArtifactStagingDirectory)/android-$(renderers).binlog' + msbuildArguments: '/t:"Rebuild;SignAndroidPackage" /p:ANDROID_RENDERERS="$(renderers)" /bl:$(Build.ArtifactStagingDirectory)/android-$(renderers)-2017_$(buildForVS2017).binlog' - task: CopyFiles@2 displayName: 'Copy $(renderers)' @@ -115,12 +118,22 @@ jobs: - task: CopyFiles@2 displayName: 'Copy Android apk $(renderers) for UITest' + condition: eq(variables['buildForVS2017'], 'false') inputs: Contents: | Xamarin.Forms.ControlGallery.Android/$(outputfolder)/$(ApkName) TargetFolder: '$(build.artifactstagingdirectory)/androidApp' CleanTargetFolder: true + - task: CopyFiles@2 + displayName: 'Copy Android apk $(renderers) for UITest 2017' + condition: eq(variables['buildForVS2017'], 'true') + inputs: + Contents: | + Xamarin.Forms.ControlGallery.Android/$(outputfolder)/$(ApkName) + TargetFolder: '$(build.artifactstagingdirectory)/androidApp_2017' + CleanTargetFolder: true + - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: AndroidApps' condition: always() diff --git a/build/steps/build-nuget.yml b/build/steps/build-nuget.yml index 9a81c22e1..d4daf814c 100644 --- a/build/steps/build-nuget.yml +++ b/build/steps/build-nuget.yml @@ -53,7 +53,7 @@ steps: } failOnStderr: true displayName: 'Update nuspecs' - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/'))) + condition: and(succeeded(), or(eq(variables['DefaultBuildConfiguration'], 'Release'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/'))) - task: NuGetCommand@2 displayName: 'Make NuGet Package Release' @@ -64,7 +64,7 @@ steps: packDestination: '$(Build.ArtifactStagingDirectory)/nuget/release' versioningScheme: byEnvVar versionEnvVar: nugetPackageVersion - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/'))) + condition: and(succeeded(), or(eq(variables['DefaultBuildConfiguration'], 'Release'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'],'refs/tags/'))) - task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: nuget' diff --git a/build/steps/build-osx.yml b/build/steps/build-osx.yml index f9f8473d9..1484b220b 100644 --- a/build/steps/build-osx.yml +++ b/build/steps/build-osx.yml @@ -68,6 +68,7 @@ steps: displayName: 'Build solution Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj' inputs: solution: Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj + configuration: $(buildConfiguration) msbuildArguments: /bl:$(Build.ArtifactStagingDirectory)/tasks.binlog - task: InstallAppleCertificate@2 @@ -112,7 +113,6 @@ steps: OverWrite: true flattenFolders: true - - task: CopyFiles@2 displayName: 'Copy iOS Files for UITest' condition: eq(variables['buildForVS2017'], 'false') @@ -129,6 +129,21 @@ steps: CleanTargetFolder: true flattenFolders: true + - task: CopyFiles@2 + displayName: 'Copy iOS Files for UITest 2017' + condition: eq(variables['buildForVS2017'], 'true') + inputs: + Contents: | + **/$(IpaName) + Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/Newtonsoft.Json.* + Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/nunit.* + Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/NUnit3.* + Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/Plugin.* + Xamarin.Forms.Core.iOS.UITests/bin/$(BuildConfiguration)/Xamarin.* + + TargetFolder: '$(build.artifactstagingdirectory)/ios_2017' + CleanTargetFolder: true + flattenFolders: true - task: CopyFiles@2 displayName: 'Copy Android Files for UITest'