Skip to content

Commit

Permalink
add azure-pipeline for x64, arm64, x86, arm
Browse files Browse the repository at this point in the history
  • Loading branch information
lukka committed Sep 25, 2019
1 parent a8e1358 commit 24f4cc6
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
fetchRecurseSubmodules = false
68 changes: 68 additions & 0 deletions azure-devops/install_msvc_preview.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
$ErrorActionPreference = "Stop"

Function InstallVS
{
# Microsoft hosted agents do not have the required MSVC 14.23 for building MSVC STL.
# This step installs MSVC 14.23, only on Microsoft hosted agents.

Param(
[String]$WorkLoads,
[String]$Sku,
[String]$VSBootstrapperURL)
$exitCode = -1
try
{
Write-Host "Downloading bootstrapper ..."
[string]$bootstrapperExe = Join-Path ${env:Temp} ([System.IO.Path]::GetRandomFileName() + ".exe")
Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile $bootstrapperExe

$Arguments = ('/c', $bootstrapperExe, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' )

Write-Host "Starting Install: $Arguments"
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru
$exitCode = $process.ExitCode

if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
Write-Host -Object 'Installation successful!'
}
else
{
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
}
}
catch
{
Write-Host -Object "Failed to install Visual Studio!"
Write-Host -Object $_.Exception.Message
exit $exitCode
}

exit $exitCode
}

# Invalidate the standard installation of VS on the hosted agent.
Move-Item "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/" "C:/Program Files (x86)/Microsoft Visual Studio/2019/nouse/" -Verbose

$WorkLoads = '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + `
'--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + `
'--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + `
'--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + `
'--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + `
'--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + `
'--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + `
'--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ' + `
'--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ' + `
'--add Microsoft.VisualStudio.Component.VC.Tools.ARM ' + `
'--add Microsoft.VisualStudio.Component.Windows10SDK.18362 '

$ReleaseInPath = 'Preview'
$Sku = 'Enterprise'
$VSBootstrapperURL = 'https://aka.ms/vs/16/pre/vs_buildtools.exe'

$ErrorActionPreference = 'Stop'

# Install VS
$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL

exit $exitCode
51 changes: 51 additions & 0 deletions azure-devops/run_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
targetPlatform: 'x64'

jobs:
- job: vs2019_hosted_${{ parameters.targetPlatform }}
pool:
#name: Hosted Windows 2019 with VS2019
name: STL

variables:
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'
vcpkgResponseFile: $(Build.SourcesDirectory)/vcpkg_windows.txt
steps:
- checkout: self
submodules: recursive
- task: BatchScript@1
inputs:
filename: 'azure-devops/enforce-clang-format.cmd'
failOnStandardError: true
displayName: 'Enforce clang-format'
# Install VS 2019 preview on Microsoft Hosted Agents only.
- task: PowerShell@2
displayName: 'Install MSVC preview'
condition: or(contains(variables['Agent.Name'], 'Azure Pipelines'), contains(variables['Agent.Name'], 'Hosted Agent'))
inputs:
targetType: filePath
filePath: $(Build.SourcesDirectory)/azure-devops/install_msvc_preview.ps1
- task: CacheBeta@0
displayName: Cache vcpkg
inputs:
key: $(vcpkgResponseFile) | $(Build.SourcesDirectory)/.git/modules/vcpkg/HEAD
path: '$(vcpkgLocation)'
- task: run-vcpkg@0
displayName: 'Run vcpkg to install boost-build'
inputs:
vcpkgArguments: 'boost-build:x86-windows'
vcpkgDirectory: '$(vcpkgLocation)'
- task: run-vcpkg@0
displayName: 'Run vcpkg'
inputs:
vcpkgArguments: '@$(vcpkgResponseFile)'
vcpkgDirectory: '$(vcpkgLocation)'
vcpkgTriplet: ${{ parameters.targetPlatform }}-windows
- task: run-cmake@0
displayName: 'Run CMake with Ninja'
enabled: true
inputs:
cmakeListsTxtPath: 'CMakeSettings.json'
useVcpkgToolchainFile: true
configurationRegexFilter: '.*${{ parameters.targetPlatform }}.*'
buildDirectory: $(Build.ArtifactStagingDirectory)/${{ parameters.targetPlatform }}
31 changes: 21 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
pool: 'STL'

steps:
- task: BatchScript@1
inputs:
filename: 'azure-devops/enforce-clang-format.cmd'
failOnStandardError: true
displayName: 'Enforce clang-format'
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Build STL targeting x64, arm64, x86, arm.

jobs:
- template: azure-devops/run_build.yml
parameters:
targetPlatform: x64

- template: azure-devops/run_build.yml
parameters:
targetPlatform: arm64

- template: azure-devops/run_build.yml
parameters:
targetPlatform: x86

- template: azure-devops/run_build.yml
parameters:
targetPlatform: arm
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 8413b9
5 changes: 5 additions & 0 deletions vcpkg_windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
boost-build:x86-windows
boost-math:x64-windows
boost-math:x86-windows
boost-math:arm-windows
boost-math:arm64-windows

0 comments on commit 24f4cc6

Please sign in to comment.