-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Build in Azure Pipelines with cached vcpkg artifacts #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
24f4cc6
56e7e25
21b7433
e041c7e
6106766
3fa17d3
e4b5b69
3adeea0
63d5a19
eb80435
0464ce7
44d4d31
ab4391f
3a5d74e
87912e8
f777520
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
[submodule "vcpkg"] | ||
path = vcpkg | ||
url = https://github.com/microsoft/vcpkg.git | ||
lukka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fetchRecurseSubmodules = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
$ErrorActionPreference = "Stop" | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Function InstallVS | ||
{ | ||
# Microsoft hosted agents do not have the required MSVC Preview for building MSVC STL. | ||
# This step installs MSVC Preview, 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 "Nonzero 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems highly invasive. Is it desirable? Could we simply fail if we detect an existing installation of VS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script is only run on the "hosted" machines which are blown away after each build, so invasive changes are fine/normal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then you would always fail on the hosted one. |
||
|
||
$WorkLoads = '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` | ||
'--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 ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any way to request the latest Win10 SDK, instead of encoding this version number here that might need to be updated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not as far as I am aware. |
||
|
||
$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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
parameters: | ||
StephanTLavavej marked this conversation as resolved.
Show resolved
Hide resolved
|
||
targetPlatform: 'x64' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is declaration and default value of accepted params. The actual value is indeed in a-p.yml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rephrasing: do we need to have this declaration here, or can we leave it out so this template will fail when it's not used correctly? It would be a shame if someone accidentally introduced a typo in the parameter names (e.g., There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose if it MUST be here we could give it an invalid value like |
||
|
||
jobs: | ||
- job: ${{ parameters.targetPlatform }} | ||
pool: | ||
name: STL | ||
|
||
variables: | ||
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg' | ||
vcpkgResponseFile: $(Build.SourcesDirectory)/vcpkg_windows.txt | ||
steps: | ||
- checkout: self | ||
lukka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
submodules: recursive | ||
- task: BatchScript@1 | ||
BillyONeal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
displayName: 'Enforce clang-format' | ||
condition: eq('${{ parameters.targetPlatform }}', 'x86') | ||
inputs: | ||
filename: 'azure-devops/enforce-clang-format.cmd' | ||
failOnStandardError: true | ||
- task: PowerShell@2 | ||
displayName: 'Install MSVC preview' | ||
# on "Hosted" agents only: | ||
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 | ||
CaseyCarter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 }}.*' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this doing a whole-string or a substring match? If the latter, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not positive which it is but I also think it doesn't matter. (And we should merge this as-is) |
||
buildDirectory: $(Build.ArtifactStagingDirectory)/${{ parameters.targetPlatform }} |
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 x86, x64, arm, arm64 | ||
|
||
jobs: | ||
- template: azure-devops/run_build.yml | ||
parameters: | ||
targetPlatform: x86 | ||
|
||
- template: azure-devops/run_build.yml | ||
parameters: | ||
targetPlatform: x64 | ||
|
||
- template: azure-devops/run_build.yml | ||
parameters: | ||
targetPlatform: arm | ||
|
||
- template: azure-devops/run_build.yml | ||
parameters: | ||
targetPlatform: arm64 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
boost-build:x86-windows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need boost build explicitly listed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in my experience, when running 'vcpkg install boost-math:x86-windows', it failed asking me to install 'boost-build:x86-windows' as well. And doing this failed with same error: 'vcpkg install boost-build:x86-windows boost-math:x86-windows'. I had to run first the installation of boost-build:x86-windows, and then run the installation of boost-math:x86-windows separately to succeed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this might be a issue worth reporting in vcpkg, but I'm not sure. |
||
boost-math:x86-windows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I observe that this mentions x64 before x86. |
||
boost-math:x64-windows | ||
boost-math:arm-windows | ||
boost-math:arm64-windows |
Uh oh!
There was an error while loading. Please reload this page.