2019-02-19 20:04:22 +03:00
|
|
|
|
|
|
|
variables:
|
2019-11-15 04:35:29 +03:00
|
|
|
CurrentSemanticVersionBase: '1.4.0'
|
|
|
|
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
|
|
|
|
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
|
2019-02-19 20:04:22 +03:00
|
|
|
NugetPackageVersion: '$(CurrentSemanticVersion)'
|
2019-10-13 07:54:40 +03:00
|
|
|
MONO_VERSION: 6_4_0
|
|
|
|
XCODE_VERSION: 11.1
|
2020-01-31 05:54:06 +03:00
|
|
|
NETCORE_VERSION: '3.1.x'
|
2019-10-13 07:54:40 +03:00
|
|
|
NETCORE_TEST_VERSION: '2.2.x'
|
2019-11-15 04:35:29 +03:00
|
|
|
IOS_SIM_NAME: 'iPhone 11'
|
2019-12-19 00:10:15 +03:00
|
|
|
IOS_SIM_RUNTIME: 'com.apple.CoreSimulator.SimRuntime.iOS-13-2'
|
2019-03-15 23:36:34 +03:00
|
|
|
ANDROID_EMU_TARGET: 'system-images;android-26;google_apis;x86'
|
|
|
|
ANDROID_EMU_DEVICE: 'Nexus 5X'
|
2019-03-16 00:35:19 +03:00
|
|
|
RunPoliCheck: 'false'
|
2019-02-19 20:04:22 +03:00
|
|
|
|
|
|
|
resources:
|
|
|
|
repositories:
|
|
|
|
- repository: xamarin-templates
|
|
|
|
type: github
|
|
|
|
name: xamarin/yaml-templates
|
|
|
|
endpoint: xamarin
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2019-02-28 03:07:53 +03:00
|
|
|
- job: build_windows
|
|
|
|
displayName: Build Windows Library
|
2019-02-19 20:04:22 +03:00
|
|
|
pool:
|
2019-10-13 07:54:40 +03:00
|
|
|
vmImage: windows-2019
|
2019-02-19 20:04:22 +03:00
|
|
|
steps:
|
|
|
|
# if this is a tagged build, then update the version number
|
|
|
|
- powershell: |
|
|
|
|
$buildSourceBranch = "$(Build.SourceBranch)"
|
|
|
|
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
|
|
|
|
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
|
|
|
|
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
|
|
|
|
displayName: Set NuGet Version to Tag Number
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
|
|
# restore, build and pack the packages
|
|
|
|
- task: MSBuild@1
|
|
|
|
displayName: Build Solution
|
|
|
|
inputs:
|
2019-02-28 03:07:53 +03:00
|
|
|
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
|
2019-02-19 20:04:22 +03:00
|
|
|
configuration: Release
|
|
|
|
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
|
|
|
|
- task: MSBuild@1
|
|
|
|
displayName: Pack NuGets
|
|
|
|
inputs:
|
|
|
|
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
|
|
|
|
configuration: Release
|
|
|
|
msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
|
2019-12-19 22:12:53 +03:00
|
|
|
# - task: DotNetCoreCLI@2
|
|
|
|
# displayName: Publish to GitHub NuGet Packages
|
|
|
|
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/master'))
|
|
|
|
# inputs:
|
|
|
|
# command: 'custom'
|
|
|
|
# custom: 'nuget'
|
|
|
|
# arguments: 'push --source https://nuget.pkg.github.com/xamarin/index.json --api-key $(GitHub.NuGet.Token) "$(Build.ArtifactStagingDirectory)\nuget\*.nupkg"'
|
2019-03-15 23:36:34 +03:00
|
|
|
- task: DotNetCoreCLI@2
|
2019-10-13 07:54:40 +03:00
|
|
|
displayName: Run Tests
|
2019-03-15 23:36:34 +03:00
|
|
|
inputs:
|
|
|
|
command: test
|
|
|
|
projects: 'Tests/Tests.csproj'
|
|
|
|
arguments: '--configuration Release'
|
2019-02-28 03:07:53 +03:00
|
|
|
# publish the packages
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
displayName: 'Publish Unsigned NuGets'
|
|
|
|
inputs:
|
|
|
|
artifactName: nuget
|
|
|
|
pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget'
|
2019-03-15 23:36:34 +03:00
|
|
|
# make sure we are following the rules, but only on the main build
|
2019-03-12 04:03:38 +03:00
|
|
|
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
|
|
|
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
|
|
|
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
|
|
|
|
displayName: Component Detection - Log
|
|
|
|
inputs:
|
|
|
|
scanType: LogOnly
|
|
|
|
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
|
|
displayName: Component Detection - Report
|
|
|
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
|
2019-03-16 00:35:19 +03:00
|
|
|
condition: eq(variables['RunPoliCheck'], 'true')
|
2019-03-12 04:03:38 +03:00
|
|
|
displayName: 'PoliCheck'
|
|
|
|
inputs:
|
|
|
|
targetType: F
|
2019-02-28 03:07:53 +03:00
|
|
|
|
|
|
|
- job: build_macos
|
|
|
|
displayName: Build macOS Library
|
|
|
|
pool:
|
2019-07-30 03:38:24 +03:00
|
|
|
vmImage: macos-10.14
|
2019-02-28 03:07:53 +03:00
|
|
|
steps:
|
|
|
|
# if this is a tagged build, then update the version number
|
|
|
|
- powershell: |
|
|
|
|
$buildSourceBranch = "$(Build.SourceBranch)"
|
|
|
|
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
|
|
|
|
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
|
|
|
|
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
|
|
|
|
displayName: Set NuGet Version to Tag Number
|
|
|
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
|
|
|
# make sure to select the correct Xamarin and mono
|
|
|
|
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
|
|
|
|
displayName: Switch to the latest Xamarin SDK
|
|
|
|
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
|
|
|
|
displayName: Switch to the latest Xcode
|
|
|
|
# restore, build and pack the packages
|
2019-10-13 07:54:40 +03:00
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_VERSION)
|
|
|
|
includePreviewVersions: false
|
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_TEST_VERSION)
|
|
|
|
includePreviewVersions: false
|
2019-02-28 03:07:53 +03:00
|
|
|
- task: MSBuild@1
|
|
|
|
displayName: Build Solution
|
|
|
|
inputs:
|
|
|
|
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
|
|
|
|
configuration: Release
|
|
|
|
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
|
|
|
|
- task: MSBuild@1
|
|
|
|
displayName: Pack NuGets
|
|
|
|
inputs:
|
|
|
|
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
|
|
|
|
configuration: Release
|
|
|
|
msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
|
2019-03-15 23:36:34 +03:00
|
|
|
- task: DotNetCoreCLI@2
|
2019-10-13 07:54:40 +03:00
|
|
|
displayName: Run Tests
|
2019-03-15 23:36:34 +03:00
|
|
|
inputs:
|
|
|
|
command: test
|
|
|
|
projects: 'Tests/Tests.csproj'
|
|
|
|
arguments: '--configuration Release'
|
2019-02-28 03:07:53 +03:00
|
|
|
|
|
|
|
- job: build_samples
|
|
|
|
displayName: Build Samples
|
|
|
|
pool:
|
2019-10-13 07:54:40 +03:00
|
|
|
vmImage: windows-2019
|
2019-02-28 03:07:53 +03:00
|
|
|
steps:
|
|
|
|
# restore, build and pack the packages
|
|
|
|
- task: MSBuild@1
|
|
|
|
displayName: Build Solution
|
|
|
|
inputs:
|
|
|
|
solution: Xamarin.Essentials.sln
|
|
|
|
configuration: Release
|
|
|
|
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
|
2019-02-19 20:04:22 +03:00
|
|
|
|
2019-03-15 23:36:34 +03:00
|
|
|
- job: devicetests_uwp
|
|
|
|
displayName: Run UWP Device Tests
|
|
|
|
dependsOn:
|
|
|
|
- build_windows
|
|
|
|
- build_macos
|
|
|
|
# skip for now
|
|
|
|
condition: and(succeeded(), not(succeeded()))
|
|
|
|
pool:
|
2019-10-13 07:54:40 +03:00
|
|
|
vmImage: windows-2019
|
2019-03-15 23:36:34 +03:00
|
|
|
steps:
|
|
|
|
- script: 'certutil -importpfx $(Build.SourcesDirectory)\DeviceTests\DeviceTests.UWP\DeviceTests.UWP_TemporaryKey.pfx'
|
|
|
|
displayName: 'Run certutil'
|
|
|
|
- powershell: |
|
|
|
|
cd DeviceTests
|
|
|
|
.\build.ps1 --target=test-uwp-emu --settings_skipverification=true --verbosity=diagnostic
|
|
|
|
displayName: 'Run Device Tests - UWP'
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
displayName: 'Publish Test Results'
|
|
|
|
inputs:
|
|
|
|
testResultsFormat: XUnit
|
|
|
|
testResultsFiles: '**/xunit-*.xml'
|
|
|
|
testRunTitle: 'Device Tests - UWP'
|
|
|
|
|
|
|
|
- job: devicetests_ios
|
|
|
|
displayName: Run iOS Device Tests
|
|
|
|
dependsOn:
|
|
|
|
- build_windows
|
|
|
|
- build_macos
|
|
|
|
pool:
|
2019-07-30 03:38:24 +03:00
|
|
|
vmImage: macos-10.14
|
2019-03-15 23:36:34 +03:00
|
|
|
steps:
|
|
|
|
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
|
|
|
|
displayName: Switch to the latest Xamarin SDK
|
|
|
|
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
|
|
|
|
displayName: Switch to the latest Xcode
|
2019-10-13 07:54:40 +03:00
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_VERSION)
|
|
|
|
includePreviewVersions: false
|
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_TEST_VERSION)
|
|
|
|
includePreviewVersions: false
|
2019-03-15 23:36:34 +03:00
|
|
|
- task: InstallAppleCertificate@2
|
|
|
|
displayName: 'Install an Apple certificate'
|
|
|
|
inputs:
|
|
|
|
certSecureFile: 'Components iOS Certificate.p12'
|
|
|
|
- task: InstallAppleProvisioningProfile@1
|
|
|
|
displayName: 'Install an Apple provisioning profile'
|
|
|
|
inputs:
|
|
|
|
provProfileSecureFile: 'Components iOS Provisioning.mobileprovision'
|
|
|
|
- bash: |
|
|
|
|
cd DeviceTests
|
2020-01-31 05:54:06 +03:00
|
|
|
dotnet tool install -g cake.tool --version 0.36.0
|
|
|
|
dotnet cake --target=test-ios-emu --settings_skipverification=true --verbosity=diagnostic
|
2019-03-15 23:36:34 +03:00
|
|
|
displayName: 'Run Device Tests - iOS'
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
displayName: 'Publish Test Results'
|
|
|
|
inputs:
|
|
|
|
testResultsFormat: XUnit
|
|
|
|
testResultsFiles: '**/xunit-*.xml'
|
|
|
|
testRunTitle: 'Device Tests - iOS'
|
|
|
|
|
|
|
|
- job: devicetests_android
|
|
|
|
displayName: Run Android Device Tests
|
|
|
|
dependsOn:
|
|
|
|
- build_windows
|
|
|
|
- build_macos
|
|
|
|
pool:
|
2019-07-30 03:38:24 +03:00
|
|
|
vmImage: macos-10.14
|
2019-03-15 23:36:34 +03:00
|
|
|
steps:
|
|
|
|
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
|
|
|
|
displayName: Switch to the latest Xamarin SDK
|
|
|
|
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
|
|
|
|
displayName: Switch to the latest Xcode
|
2019-10-13 07:54:40 +03:00
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_VERSION)
|
|
|
|
includePreviewVersions: false
|
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: 'Use .Net Core sdk'
|
|
|
|
inputs:
|
|
|
|
version: $(NETCORE_TEST_VERSION)
|
|
|
|
includePreviewVersions: false
|
2019-03-15 23:36:34 +03:00
|
|
|
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"$ANDROID_EMU_TARGET\""
|
|
|
|
displayName: Install the Android emulators
|
|
|
|
- bash: |
|
|
|
|
PATH="$ANDROID_HOME/tools/bin:$PATH"
|
|
|
|
PATH="$ANDROID_HOME/emulator:$PATH"
|
|
|
|
cd DeviceTests
|
2020-01-31 05:54:06 +03:00
|
|
|
dotnet tool install -g cake.tool --version 0.36.0
|
|
|
|
dotnet cake --target=test-android-emu --settings_skipverification=true --verbosity=diagnostic
|
2019-03-15 23:36:34 +03:00
|
|
|
displayName: 'Run Device Tests - Android'
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
displayName: 'Publish Test Results'
|
|
|
|
inputs:
|
|
|
|
testResultsFormat: XUnit
|
|
|
|
testResultsFiles: '**/xunit-*.xml'
|
|
|
|
testRunTitle: 'Device Tests - Android'
|
|
|
|
|
2019-02-19 20:04:22 +03:00
|
|
|
# only sign the packages when running on Windows, and using the private server which has the certificates
|
|
|
|
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
|
|
|
|
- job: signing
|
|
|
|
displayName: Signing NuGets
|
2019-02-28 03:07:53 +03:00
|
|
|
dependsOn: build_windows
|
2019-02-19 20:04:22 +03:00
|
|
|
pool:
|
|
|
|
name: VSEng-XamarinCustom
|
2019-02-19 21:08:33 +03:00
|
|
|
demands:
|
|
|
|
- corpnet
|
2019-03-15 23:36:34 +03:00
|
|
|
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
|
2019-02-19 20:04:22 +03:00
|
|
|
steps:
|
|
|
|
# don't checkout code and sign the packages
|
|
|
|
- checkout: none
|
|
|
|
- template: sign-artifacts.yml@xamarin-templates
|
|
|
|
parameters:
|
|
|
|
targetFolder: '$(Build.ArtifactStagingDirectory)/signed'
|
|
|
|
# publish the signed packages
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
|
|
displayName: 'Publish Signed NuGets'
|
|
|
|
inputs:
|
|
|
|
artifactName: nuget-signed
|
|
|
|
pathToPublish: '$(Build.ArtifactStagingDirectory)/signed'
|