Skip to content

Commit

Permalink
[CI] Allow to enable or disable the dotnet builds. (#11358)
Browse files Browse the repository at this point in the history
Create a new parameter that can be used to decide if we build or not the
dotnet parts of the project. If we do not, we make sure that we do not
have any errors in all the other steps.
  • Loading branch information
mandel-macaque authored May 3, 2021
1 parent 47f273b commit 19482a7
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 29 deletions.
5 changes: 5 additions & 0 deletions tools/devops/automation/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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'))) }}:
Expand Down
19 changes: 17 additions & 2 deletions tools/devops/automation/templates/build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
17 changes: 16 additions & 1 deletion tools/devops/automation/templates/build/configure.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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."
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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'

Expand Down
55 changes: 30 additions & 25 deletions tools/devops/automation/templates/build/sign-and-notarized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ parameters:
type: string
default: 'Real'

- name: enableDotnet
type: boolean
default: false

steps:

- bash: |
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tools/devops/automation/templates/build/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ parameters:
- name: xqaCertPass
type: string

- name: enableDotnet
type: boolean
default: false

jobs:
- job: configure
displayName: 'Configure build'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
9 changes: 8 additions & 1 deletion tools/devops/automation/templates/build/upload-azure.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
parameters:
- name: enableDotnet
type: boolean
default: false

steps:

- checkout: self
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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'

7 comments on commit 19482a7

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

Packages generated

View packages

Test results

1 tests failed, 192 tests passed.

Failed tests

  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed

Pipeline on Agent XAMBOT-1028'
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Catalina (10.15) ❌

Tests failed on Mac Catalina (10.15).

Failed tests are:

  • apitest
  • introspection

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • apitest
  • introspection
  • xammac_tests

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac High Sierra (10.13) ❌

Tests failed on Mac High Sierra (10.13).

Failed tests are:

  • apitest
  • introspection
  • xammac_tests

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[CI] Allow to enable or disable the dotnet builds. (#11358)

Please sign in to comment.