uno.xamarin.essentials/azure-pipelines.yml

230 строки
9.6 KiB
YAML

variables:
CurrentSemanticVersionBase: '1.0.0'
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(Build.BuildNumber)'
NugetPackageVersion: '$(CurrentSemanticVersion)'
MONO_VERSION: 5_18_1
XCODE_VERSION: 10.2.1
IOS_SIM_NAME: 'iPhone X'
IOS_SIM_RUNTIME: 'com.apple.CoreSimulator.SimRuntime.iOS-12-2'
ANDROID_EMU_TARGET: 'system-images;android-26;google_apis;x86'
ANDROID_EMU_DEVICE: 'Nexus 5X'
RunPoliCheck: 'false'
resources:
repositories:
- repository: xamarin-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
jobs:
- job: build_windows
displayName: Build Windows Library
pool:
vmImage: vs2017-win2016
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:
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"'
- task: DotNetCoreCLI@2
inputs:
command: test
projects: 'Tests/Tests.csproj'
arguments: '--configuration Release'
# publish the packages
- task: PublishBuildArtifacts@1
displayName: 'Publish Unsigned NuGets'
inputs:
artifactName: nuget
pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget'
# make sure we are following the rules, but only on the main build
- ${{ 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
condition: eq(variables['RunPoliCheck'], 'true')
displayName: 'PoliCheck'
inputs:
targetType: F
- job: build_macos
displayName: Build macOS Library
pool:
vmImage: macos-10.14
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
- 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"'
- task: DotNetCoreCLI@2
inputs:
command: test
projects: 'Tests/Tests.csproj'
arguments: '--configuration Release'
- job: build_samples
displayName: Build Samples
pool:
vmImage: vs2017-win2016
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'
- job: devicetests_uwp
displayName: Run UWP Device Tests
dependsOn:
- build_windows
- build_macos
# skip for now
condition: and(succeeded(), not(succeeded()))
pool:
vmImage: vs2017-win2016
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:
vmImage: macos-10.14
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
- 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
sh ./build.sh --target=test-ios-emu --settings_skipverification=true --verbosity=diagnostic
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:
vmImage: macos-10.14
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
- 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
sh ./build.sh --target=test-android-emu --settings_skipverification=true --verbosity=diagnostic
displayName: 'Run Device Tests - Android'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: XUnit
testResultsFiles: '**/xunit-*.xml'
testRunTitle: 'Device Tests - Android'
# 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
dependsOn: build_windows
pool:
name: VSEng-XamarinCustom
demands:
- corpnet
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
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'