-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci-staging: install visual studio components
- Loading branch information
1 parent
b3c378f
commit 91d88f7
Showing
3 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
.github/actions/sil-kit-ci/impl-setup/Install-RequiredVisualStudioComponents.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
param( | ||
[ValidateSet("14.1", "14.3")] | ||
[string[]] $InstallToolset = @() | ||
) | ||
|
||
function Write-ScriptLog { | ||
param( | ||
[Parameter(Mandatory)] | ||
[ValidateSet("Visual Studio", "Toolset", "Component", "Execute")] | ||
[string] $Category, | ||
|
||
[Parameter(Mandatory)] | ||
[string[]] $Message, | ||
|
||
[ValidateSet("Error", "Notice")] | ||
[string] $Level = "Notice" | ||
) | ||
|
||
if ($Level -eq "Notice") { | ||
Write-Host "[$Category] $Message" | ||
} else { | ||
Write-Host "[$Category] [$Level] $Message" | ||
} | ||
} | ||
|
||
$Vswhere = Get-Command vswhere | ||
Write-ScriptLog "Visual Studio" "Path (vswhere): $($Vswhere.Path)" | ||
|
||
$InstallationPath = & $Vswhere.Path -products * -latest -property installationPath | ||
Write-ScriptLog "Visual Studio" "Installation Path (Visual Studio): $InstallationPath" | ||
|
||
$VisualStudioVersion = "Unknown" | ||
|
||
if ($InstallationPath -like "*\2019\*") { | ||
$VisualStudioVersion = "2019" | ||
} elseif ($InstallationPath -like "*\2022\*") { | ||
$VisualStudioVersion = "2022" | ||
} else { | ||
Write-ScriptLog "Visual Studio" "Failed to detect Visual Studio version" -Level Error | ||
exit 1 | ||
} | ||
|
||
$InstallToolset = $InstallToolset | Sort-Object | Get-Unique | ||
|
||
Write-ScriptLog "Visual Studio" "Version: $VisualStudioVersion" | ||
Write-ScriptLog "Toolset" "Install: $($InstallToolset -join ", ")" | ||
|
||
$ToolsetToComponents = @{ | ||
"2019 14.1" = @( | ||
"Microsoft.VisualStudio.Component.VC.v141.x86.x64" | ||
); | ||
"2019 14.2" = @( | ||
"Microsoft.VisualStudio.Component.VC.14.29.16.10.x86.x64" | ||
); | ||
"2022 14.1" = @( | ||
"Microsoft.VisualStudio.Component.VC.v141.x86.x64" | ||
); | ||
"2022 14.2" = @( | ||
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64" | ||
); | ||
"2022 14.3" = @( | ||
"Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" | ||
); | ||
} | ||
|
||
$ComponentsToInstall = @() | ||
|
||
foreach ($Toolset in $InstallToolset) { | ||
$Key = "$VisualStudioVersion $Toolset" | ||
Write-ScriptLog "Component" "Selecting components for '$Key'" | ||
|
||
$Components = $ToolsetToComponents[$Key] | ||
|
||
if ($Components -eq $null) { | ||
Write-ScriptLog "Component" "No components available for Visual Studio $VisualStudioVersion and Toolset $Toolset" -Level Error | ||
exit 2 | ||
} | ||
|
||
$ComponentsToInstall += $Components | ||
} | ||
|
||
Write-ScriptLog "Component" "Selected components for installation: $($ComponentsToInstall -join ", ")" | ||
|
||
try { | ||
Push-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | ||
|
||
$AddComponentArguments = $ComponentsToInstall | ForEach-Object { "--add `"" + $_ + "`"" } | ||
$Arguments = @( | ||
"/c", "vs_installer.exe", | ||
"modify", | ||
"--installPath", "`"$InstallationPath`"", | ||
($AddComponentArguments -join " "), | ||
'--quiet', '--norestart', '--nocache' | ||
) | ||
|
||
Write-ScriptLog "Execute" "cmd.exe $Arguments" | ||
|
||
$InstallerProcess = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden | ||
} finally { | ||
Pop-Location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: "CI for Pull Requests" | ||
|
||
on: | ||
|
||
pull_request: | ||
branches: [ 'main' ] | ||
|
||
concurrency: | ||
|
||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
linux-fast: | ||
name: 'Linux (PR)' | ||
uses: ./.github/workflows/call-build.yml | ||
with: | ||
runs-on: ubuntu-22.04 | ||
preset-name: ci | ||
c-compiler: gcc-8 | ||
cxx-compiler: g++-8 | ||
cmake-configure-args: >- | ||
-D CMAKE_C_FLAGS_RELEASE="-g0 -O0" | ||
-D CMAKE_CXX_FLAGS_RELEASE="-g0 -O0" | ||
windows-x64-fast: | ||
name: 'Windows (PR, x64)' | ||
uses: ./.github/workflows/call-build.yml | ||
with: | ||
runs-on: windows-2019 | ||
preset-name: ci | ||
msvc-arch: x64 | ||
msvc-toolset: 14.1 | ||
cmake-configure-args: >- | ||
-D CMAKE_C_FLAGS_RELEASE="/Od" | ||
-D CMAKE_CXX_FLAGS_RELEASE="/Od" |