diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml index 940649b2d823..d9486bea8627 100644 --- a/tools/devops/automation/build-pipeline.yml +++ b/tools/devops/automation/build-pipeline.yml @@ -22,6 +22,10 @@ parameters: type: string default: 'latest' +- name: enableDotnet + type: boolean + default: true + # We are doing some black magic. We have several templates that # are executed with different parameters. # @@ -218,6 +222,7 @@ stages: keyringPass: $(xma-password) gitHubToken: ${{ variables['GitHub.Token'] }} xqaCertPass: $(xqa--certificates--password) + enableDotnet: ${{ parameters.enableDotnet }} - ${{ if eq(parameters.runDeviceTests, true) }}: - ${{ if and(ne(variables['Build.Reason'], 'Schedule'), or(eq(variables['Build.Reason'], 'IndividualCI'), eq(variables['Build.Reason'], 'Manual'))) }}: diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml index 9d868ae6fcf0..16ce4eeb3384 100644 --- a/tools/devops/automation/templates/build/build.yml +++ b/tools/devops/automation/templates/build/build.yml @@ -23,6 +23,10 @@ parameters: - name: xqaCertPass type: string +- name: enableDotnet + type: boolean + default: false + steps: - checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout clean: true # Executes: git clean -ffdx && git reset --hard HEAD @@ -274,13 +278,21 @@ steps: CONFIGURE_FLAGS="--enable-xamarin" fi - CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-dotnet --enable-dotnet-windows --enable-install-source" + if [[ "$EnableDotNet" == "True" ]]; then + echo "Enabling dotnet builds." + CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-dotnet --enable-dotnet-windows" + fi + + CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-install-source" + echo "Configuration falgs are '$CONFIGURE_FLAGS'" cd $(Build.SourcesDirectory)/xamarin-macios/ ./configure $CONFIGURE_FLAGS echo $(cat $(Build.SourcesDirectory)/xamarin-macios/configure.inc) env: IsPR: $(configuration.IsPR) + ${{ if eq(parameters.enableDotnet, true) }}: + EnableDotNet: 'True' displayName: "Configure build" timeoutInMinutes: 5 @@ -312,11 +324,14 @@ steps: timeoutInMinutes: 180 # build nugets -- template: build-nugets.yml +- ${{ if eq(parameters.enableDotnet, true) }}: + - template: build-nugets.yml # only sign an notarize in no PR executions - ${{ if ne(parameters.isPR, 'True') }}: - template: sign-and-notarized.yml + parameters: + enableDotnet: ${{ parameters.enableDotnet }} - template: generate-workspace-info.yml@templates parameters: diff --git a/tools/devops/automation/templates/build/configure.yml b/tools/devops/automation/templates/build/configure.yml index 563080676bb4..cf1a223189d5 100644 --- a/tools/devops/automation/templates/build/configure.yml +++ b/tools/devops/automation/templates/build/configure.yml @@ -1,6 +1,12 @@ # This job will parse all the labels present in a PR, will set # the tags for the build AND will set a number of configuration # variables to be used by the rest of the projects +parameters: + +- name: enableDotnet + type: boolean + default: false + steps: - checkout: self # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout clean: true # Executes: git clean -ffdx && git reset --hard HEAD @@ -24,6 +30,12 @@ steps: if ($buildReason -eq "Schedule") { $tags.Add("cronjob") } + if ($Env:ENABLE_DOTNET -eq "True") { + Write-Host "dotnet will be enabled for the build because ENABLE_DOTNET was '$Env:ENABLE_DOTNET'" + } else { + Write-Host "dotnet will be disabled for the build because ENABLE_DOTNET was '$Env:ENABLE_DOTNET'" + } + if ($buildReason -eq "PullRequest" -or (($buildReason -eq "Manual") -and ($buildSourceBranchName -eq "merge")) ) { Write-Host "Configuring build from PR." @@ -57,7 +69,8 @@ steps: # decide if we add the run-dotnet-tests label (if not present) this is done only for main # we can use $ref for that :) $xharnessLabels = $tags -join "," - if ($ref -eq "main" -and -not ("run-dotnet-tests" -in $xharnessLabels)) { + if ($Env:ENABLE_DOTNET -eq "True" -and -not ("run-dotnet-tests" -in $xharnessLabels)) { + Write-Host "Adding label run-dotnet-tests to xharness." $tags.Add("run-dotnet-tests") if ($xharnessLabels -eq "") { $xharnessLabels = "run-dotnet-tests" @@ -102,6 +115,8 @@ steps: BUILD_REVISION: $(Build.SourceVersion) GITHUB_TOKEN: $(GitHub.Token) ACCESSTOKEN: $(AzDoBuildAccess.Token) + ${{ if eq(parameters.enableDotnet, true) }}: + ENABLE_DOTNET: "True" name: labels displayName: 'Configure build' diff --git a/tools/devops/automation/templates/build/sign-and-notarized.yml b/tools/devops/automation/templates/build/sign-and-notarized.yml index 55b6bb3e5dbc..de458c9ac961 100644 --- a/tools/devops/automation/templates/build/sign-and-notarized.yml +++ b/tools/devops/automation/templates/build/sign-and-notarized.yml @@ -5,6 +5,10 @@ parameters: type: string default: 'Real' +- name: enableDotnet + type: boolean + default: false + steps: - bash: | @@ -86,36 +90,37 @@ steps: zipSources: false # we do not use the feature and makes the installation to last 10/12 mins instead of < 1 min env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) + +- ${{ if eq(parameters.enableDotnet, true) }}: + - pwsh : | + # Get the list of files to sign + $msiFiles = Get-ChildItem -Path $(Build.SourcesDirectory)/package/ -Filter "*.msi" + + # Add those files to an array + $SignFiles = @() + foreach($msi in $msiFiles) { + Write-Host "$($msi.FullName)" + $SignFiles += @{ "SrcPath"="$($msi.FullName)"} + } -- pwsh : | - # Get the list of files to sign - $msiFiles = Get-ChildItem -Path $(Build.SourcesDirectory)/package/ -Filter "*.msi" - - # Add those files to an array - $SignFiles = @() - foreach($msi in $msiFiles) { - Write-Host "$($msi.FullName)" - $SignFiles += @{ "SrcPath"="$($msi.FullName)"} - } + Write-Host "$msiFiles" - Write-Host "$msiFiles" + # array of dicts + $SignFileRecord = @( + @{ + "Certs" = "400"; + "SignFileList" = $SignFiles; + } + ) - # array of dicts - $SignFileRecord = @( - @{ - "Certs" = "400"; - "SignFileList" = $SignFiles; + $SignFileList = @{ + "SignFileRecordList" = $SignFileRecord } - ) - - $SignFileList = @{ - "SignFileRecordList" = $SignFileRecord - } - # Write the json to a file - ConvertTo-Json -InputObject $SignFileList -Depth 5 | Out-File -FilePath $(Build.ArtifactStagingDirectory)/MsiFiles2Notarize.json -Force - dotnet $Env:MBSIGN_APPFOLDER/ddsignfiles.dll /filelist:$(Build.ArtifactStagingDirectory)/MsiFiles2Notarize.json - displayName: 'Sign .msi' + # Write the json to a file + ConvertTo-Json -InputObject $SignFileList -Depth 5 | Out-File -FilePath $(Build.ArtifactStagingDirectory)/MsiFiles2Notarize.json -Force + dotnet $Env:MBSIGN_APPFOLDER/ddsignfiles.dll /filelist:$(Build.ArtifactStagingDirectory)/MsiFiles2Notarize.json + displayName: 'Sign .msi' - bash: | security unlock-keychain -p $PRODUCTSIGN_KEYCHAIN_PASSWORD builder.keychain diff --git a/tools/devops/automation/templates/build/stage.yml b/tools/devops/automation/templates/build/stage.yml index 563debee22db..18f24c3208b1 100644 --- a/tools/devops/automation/templates/build/stage.yml +++ b/tools/devops/automation/templates/build/stage.yml @@ -21,6 +21,10 @@ parameters: - name: xqaCertPass type: string +- name: enableDotnet + type: boolean + default: false + jobs: - job: configure displayName: 'Configure build' @@ -95,6 +99,7 @@ jobs: keyringPass: ${{ parameters.keyringPass }} gitHubToken: ${{ parameters.gitHubToken }} xqaCertPass: ${{ parameters.xqaCertPass }} + enableDotnet: ${{ parameters.enableDotnet }} - job: upload_azure_blob displayName: 'Upload packages to Azure' @@ -115,6 +120,8 @@ jobs: clean: all steps: - template: upload-azure.yml + parameters: + enableDotnet: ${{ parameters.enableDotnet }} - job: upload_vsdrops displayName: 'Upload test results to VSDrops' diff --git a/tools/devops/automation/templates/build/upload-azure.yml b/tools/devops/automation/templates/build/upload-azure.yml index 0bdc93ecf44c..f43384cde9b7 100644 --- a/tools/devops/automation/templates/build/upload-azure.yml +++ b/tools/devops/automation/templates/build/upload-azure.yml @@ -1,3 +1,8 @@ +parameters: +- name: enableDotnet + type: boolean + default: false + steps: - checkout: self @@ -164,7 +169,7 @@ steps: Set-GitHubStatus -Status "error" -Description "msbuild.zip not found." -Context "msbuild.zip" } - if ($Env:SkipNugets -ne "True") { + if ($Env:ENABLE_DOTNET -eq "True" -and $Env:SkipNugets -ne "True") { $nugets = Get-ChildItem -Path $pkgsPath -Filter *.nupkg -File -Name Write-Host $nugets Write-Host "nuget count is $($nugets.Count)" @@ -196,4 +201,6 @@ steps: GITHUB_TOKEN: $(GitHub.Token) ACCESSTOKEN: $(System.AccessToken) STORAGE_URI: $(Parameters.outputStorageUri) + ${{ if eq(parameters.enableDotnet, true) }}: + ENABLE_DOTNET: "True" displayName: 'Set GithubStatus'