Uno.SkiaSharp/scripts/azure-templates-bootstrappe...

203 строки
10 KiB
YAML

parameters:
name: '' # in the form type_platform_host
displayName: '' # the human name
vmImage: '' # the VM image
packages: '' # any additional packages
target: '' # the bootstrapper target
dependsOn: [] # the dependiencies
requiredArtifacts: [] # the artifacts that this build needs to download
demands: [] # the demands
preBuildSteps: [] # any steps to run before the build
postBuildSteps: [] # any additional steps to run after the build
initScript: '' # any scripts to run before starting the bootstrapper
additionalArgs: '' # any additional arguments to pass to the bootstrapper
retryCount: 1 # the number of times to retry the bootstrapper
condition: succeeded() # whether or not to run this template
shouldPublish: true # whether or not to publish the artifacts
configuration: $(CONFIGURATION) # the build configuration
buildExternals: '' # the build number to download externals from
verbosity: $(VERBOSITY) # the level of verbosity to use when building
docker: '' # the Docker image to build and use
dockerArgs: '' # any additional arguments to pass to docker build
installAndroidNdk: true # whether or not to install the Android NDK
installTizenSdk: true # whether or not to install the Tizen SDK
installWindowsSdk: true # whether or not to install the Windows SDK
installLlvm: true # whether or not to install the LLVM compiler
installEmsdk: false # whether or not to install the Emscripten SDK
jobs:
# - ${{ if and(ne(parameters.buildExternals, ''), startsWith(parameters.name, 'native_')) }}:
# - template: azure-templates-download.yml
# parameters:
# name: ${{ parameters.name }}
# displayName: ${{ parameters.displayName }}
# vmImage: ${{ parameters.vmImage }}
# condition: ${{ parameters.condition }}
# buildExternals: ${{ parameters.buildExternals }}
# - ${{ if or(eq(parameters.buildExternals, ''), not(startsWith(parameters.name, 'native_'))) }}:
- job: ${{ parameters.name }}
displayName: ${{ parameters.displayName }}
timeoutInMinutes: 120
pool:
vmImage: ${{ parameters.vmImage }}
demands: ${{ parameters.demands }}
dependsOn: ${{ parameters.dependsOn }}
condition: ${{ parameters.condition }}
steps:
# prepare
- checkout: self
submodules: recursive
- template: azure-templates-variables.yml
# install any packages on linux
- ${{ if and(eq(parameters.docker, ''), endsWith(parameters.name, '_linux')) }}:
- bash: |
sudo apt update
sudo apt install -y ${{ parameters.packages }}
displayName: Install additional package dependencies
condition: ne('${{ parameters.packages }}', '')
# make sure mono/msbuild is the correct version
- ${{ if and(eq(parameters.docker, ''), endsWith(parameters.name, '_linux')) }}:
- bash: |
sudo apt remove -y mono-complete msbuild
sudo apt autoremove -y
sudo rm /etc/mono/config
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu $(MONO_VERSION_LINUX) main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install -y mono-complete msbuild
mono --version
displayName: Install Mono and MSBuild
- ${{ if endsWith(parameters.name, '_macos') }}:
- bash: sudo $(Agent.HomeDirectory)/scripts/select-xamarin-sdk.sh $(MONO_VERSION_MACOS)
displayName: Switch to the latest Xamarin SDK
# install extra bits for the native builds
- ${{ if startsWith(parameters.name, 'native_') }}:
# switch to Python 2.7
- task: UsePythonVersion@0
displayName: Switch to Python to 2.7
inputs:
versionSpec: '2.7'
architecture: 'x64'
- ${{ if not(contains(parameters.name, '_checks_')) }}:
# install android ndk
- ${{ if and(eq(parameters.installAndroidNdk, 'true'), contains(parameters.name, '_android_')) }}:
- pwsh: .\scripts\install-android-ndk.ps1
displayName: Install the Android NDK
# install tizen
- ${{ if and(eq(parameters.installTizenSdk, 'true'), contains(parameters.name, '_tizen_')) }}:
- pwsh: .\scripts\install-tizen.ps1
displayName: Install the Tizen SDK
# install llvm
- ${{ if and(eq(parameters.installLlvm, 'true'), contains(parameters.name, '_win32_')) }}:
- pwsh: .\scripts\install-llvm.ps1
displayName: Install LLVM
# install extra bits for the manged builds
- ${{ if not(startsWith(parameters.name, 'native_')) }}:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: $(DOTNET_VERSION)
performMultiLevelLookup: true
displayName: Install the correct version of .NET Core
# install the mac tools
- ${{ if endsWith(parameters.name, '_macos') }}:
- 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
# install the linux tools
- ${{ if and(eq(parameters.installEmsdk, 'true'), endsWith(parameters.name, '_linux')) }}:
- bash: |
git clone --branch $(EMSCRIPTEN_VERSION) https://github.com/emscripten-core/emsdk ~/emsdk
~/emsdk/emsdk install $(EMSCRIPTEN_VERSION)
~/emsdk/emsdk activate $(EMSCRIPTEN_VERSION)
displayName: Install the Emscripten SDK
# install the Windows tools
- ${{ if endsWith(parameters.name, '_windows') }}:
- ${{ if not(contains(parameters.name, '_checks_')) }}:
# install the older Windows SDKs
- ${{ if eq(parameters.installWindowsSdk, 'true') }}:
- pwsh: |
$uri = 'https://go.microsoft.com/fwlink/p/?LinkId=619296'
.\scripts\download-file.ps1 -Uri $uri -OutFile sdksetup.exe
.\sdksetup.exe /norestart /quiet | Out-Null
displayName: Install the Windows 10 SDK 10.0.10240
# install any .NET Core global tools
- ${{ each tool in parameters.tools }}:
- pwsh: dotnet tool install -g ${{ tool }}
displayName: Install ${{ tool }}
# download artifacts
- ${{ each dep in parameters.requiredArtifacts }}:
- task: DownloadBuildArtifacts@0
displayName: Download the ${{ dep }} artifacts
inputs:
artifactName: ${{ dep }}
downloadPath: 'download-temp'
- pwsh: |
New-Item '.\output\' -Type Directory -Force | Out-Null
Get-ChildItem '.\download-temp\${{ dep }}\' | Copy-Item -Destination '.\output\' -Recurse -Force
Remove-Item '.\download-temp\${{ dep }}\' -Recurse -Force
displayName: Move the ${{ dep }} artifacts to the output directory
# pre-build steps
- ${{ parameters.preBuildSteps }}
# build
- ${{ if eq(parameters.docker, '') }}:
- ${{ if endsWith(parameters.name, '_windows') }}:
- pwsh: |
${{ parameters.initScript }}
.\scripts\retry-command.ps1 -RetryCount ${{ parameters.retryCount }} {
.\bootstrapper.ps1 -t ${{ parameters.target }} -v ${{ parameters.verbosity }} -c ${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }}
}
env:
JavaSdkDirectory: $(JAVA_HOME)
LLVM_HOME: $(LLVM_HOME)
# There seems to be a bug in some verions of mspdbcmf.exe. This looks to be fixed in a VS preview.
AppxSymbolPackageEnabled: false
displayName: Run the bootstrapper for ${{ parameters.target }}
- ${{ if not(endsWith(parameters.name, '_windows')) }}:
- bash: |
${{ parameters.initScript }}
./scripts/retry-command.sh ${{ parameters.retryCount }} \
./bootstrapper.sh -t ${{ parameters.target }} -v ${{ parameters.verbosity }} -c ${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }}
env:
JavaSdkDirectory: $(JAVA_HOME)
displayName: Run the bootstrapper for ${{ parameters.target }}
- ${{ if ne(parameters.docker, '') }}:
- bash: docker build --tag skiasharp ${{ parameters.dockerArgs }} .
workingDirectory: ${{ parameters.docker }}
displayName: Build the Docker image for ${{ parameters.docker }}
- bash: |
docker run --rm --name skiasharp --volume $(pwd):/work skiasharp /bin/bash \
scripts/retry-command.sh ${{ parameters.retryCount }} \
./bootstrapper.sh -t ${{ parameters.target }} -v ${{ parameters.verbosity }} -c ${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }}
displayName: Run the bootstrapper for ${{ parameters.target }} using the Docker image
# post-build steps
- ${{ parameters.postBuildSteps }}
# publish artifacts
- task: PublishBuildArtifacts@1
displayName: Publish the ${{ parameters.name }} artifacts
condition: ${{ parameters.shouldPublish }}
inputs:
artifactName: ${{ parameters.name }}
pathToPublish: 'output'
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- task: ComponentGovernanceComponentDetection@0
displayName: Run component detection
condition: always()
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'