app-innovation-workshop/mobile.azure-pipelines.yaml

233 строки
6.5 KiB
YAML

#######################################################
# General #
#######################################################
trigger: none
variables:
- group: Signing Passwords
- name: BuildConfiguration
value: 'Release'
#######################################################
# Pipeline jobs #
#######################################################
jobs:
- job:
displayName: 'Build iOS'
pool:
name: Hosted macOS
demands:
- xcode
- Xamarin.iOS
- msbuild
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
checkLatest: true
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
restoreSolution: 'Mobile/**/*.csproj'
restoreDirectory: '$(Build.Repository.LocalPath)/packages'
- task: replacetokens@3
displayName: 'Replace tokens'
inputs:
rootDirectory: 'Mobile/ContosoFieldService.Core/Helpers'
targetFiles: 'Constants.cs'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '__'
tokenSuffix: '__'
- task: ios-bundle-version@1
displayName: 'Bump version number'
inputs:
sourcePath: 'Mobile/iOS/Info.plist'
versionCodeOption: 'buildid'
versionCode: '$(Build.BuildId)'
printFile: false
- task: InstallAppleCertificate@2
displayName: 'Install Apple Certificate'
inputs:
certSecureFile: 'Xamarin-Shared-In-House-Cert-PrivateKey.p12'
certPwd: '$(iOS-Certificate-Password)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install Apple Privisioning profile'
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'Contoso_Maintenance_InHouse.mobileprovision'
- task: XamariniOS@2
displayName: 'Build Xamarin.iOS project'
inputs:
solutionFile: 'Mobile/iOS/ContosoFieldService.iOS.csproj'
configuration: '$(BuildConfiguration)'
packageApp: true
runNugetRestore: false
args: '/p:OutputPath="$(Build.ArtifactStagingDirectory)"'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
signingProvisioningProfileID: '$(APPLE_PROV_PROFILE_UUID)'
- task: XamariniOS@2
displayName: 'Build Xamarin.iOS project (UI Test Version)'
inputs:
solutionFile: 'Mobile/iOS/ContosoFieldService.iOS.csproj'
configuration: 'Test Cloud'
packageApp: true
runNugetRestore: false
args: '/p:OutputPath="$(Build.ArtifactStagingDirectory)/UITests"'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
signingProvisioningProfileID: '$(APPLE_PROV_PROFILE_UUID)'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'iOS'
publishLocation: 'Container'
- job:
displayName: 'Build Android'
pool:
name: Hosted macOS
demands:
- xcode
- Xamarin.iOS
- msbuild
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
versionSpec:
- task: NuGetCommand@2
displayName: 'Restore NuGet packges'
inputs:
command: 'restore'
restoreSolution: 'Mobile/**/*.csproj'
restoreDirectory: '$(Build.Repository.LocalPath)/packages'
- task: android-manifest-version@1
displayName: 'Bump version number'
inputs:
sourcePath: 'Mobile/Droid/Properties/AndroidManifest.xml'
versionCodeOption: 'buildid'
versionCode: '$(Build.BuildId)'
printFile: false
- task: replacetokens@3
displayName: 'Replace tokens'
inputs:
rootDirectory: 'Mobile/ContosoFieldService.Core/Helpers'
targetFiles: 'Constants.cs'
encoding: 'auto'
writeBOM: true
actionOnMissing: 'warn'
keepToken: false
tokenPrefix: '__'
tokenSuffix: '__'
- task: XamarinAndroid@1
displayName: 'Build Xamarin.Android project'
inputs:
projectFile: 'Mobile/Droid/ContosoFieldService.Droid.csproj'
outputDirectory: '$(Build.ArtifactStagingDirectory)'
configuration: '$(BuildConfiguration)'
jdkOption: 'JDKVersion'
- task: XamarinAndroid@1
displayName: 'Build Xamarin.Android project (UI Test Version)'
inputs:
projectFile: 'Mobile/Droid/ContosoFieldService.Droid.csproj'
outputDirectory: '$(Build.ArtifactStagingDirectory)/UITests'
configuration: 'Test Cloud'
jdkOption: 'JDKVersion'
- task: AndroidSigning@3
displayName: 'Sign Android apps'
inputs:
apkFiles: '$(Build.ArtifactStagingDirectory)/**/*.apk'
apksignerKeystoreFile: 'EMEAGBB-Keystore.jks'
apksignerKeystorePassword: '$(Android-Keystore-Password)'
apksignerKeystoreAlias: '$(Android-Keystore-Key)'
apksignerKeyPassword: '$(Android-Keystrore-Key-Password)'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Android'
publishLocation: 'Container'
#
#- job:
# displayName: 'Build Windows'
# pool:
# name: Hosted VS2017
# demands:
# - msbuild
# - visualstudio
# steps:
# - task: VSBuild@1
# displayName: 'Build UWP project'
# inputs:
# solution: Mobile/ContosoFieldService.UWP/ContosoFieldService.UWP.csproj
# configuration: '$(BuildConfiguration)'
- job:
displayName: 'Build UI Tests'
pool:
name: Hosted VS2017
demands:
- msbuild
- visualstudio
steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet'
inputs:
versionSpec:
- task: NuGetCommand@2
displayName: 'Restore NuGet packages'
inputs:
command: 'restore'
restoreSolution: 'Mobile/**/*.csproj'
restoreDirectory: '$(Build.Repository.LocalPath)/packages'
- task: MSBuild@1
displayName: 'Build Xamarin.UITest project'
inputs:
solution: 'Mobile/UITests/ContosoFieldService.UITests.csproj'
configuration: '$(BuildConfiguration)'
msbuildArguments: '/p:OutputPath="$(Build.ArtifactStagingDirectory)"'
- task: CopyFiles@2
displayName: 'Copy Test Cloud Runner from NuGet'
inputs:
SourceFolder: '$(Build.Repository.LocalPath)/packages/Xamarin.UITest.3.0.0/'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/packages/Xamarin.UITest.3.0.0/'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'UI Tests'
publishLocation: 'Container'