Skip to content

Commit

Permalink
PHPC-2388: Simplify steps for VC15 installation (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola authored May 28, 2024
1 parent 69d4a72 commit c64e7d0
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions .github/actions/windows/prepare-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,17 @@ outputs:
runs:
using: composite
steps:
# Reinstall VC15 (Visual Studio 2017) for PHP 7.4 using the suggested script
# from https://github.com/actions/runner-images/issues/9701
- name: Remove VC15 component for PHP 7.4
if: ${{ inputs.version == '7.4' }}
shell: pwsh
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToRemove= @(
"Microsoft.VisualStudio.Component.VC.v141.x86.x64"
)
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
# Reinstall VC15 (Visual Studio 2017) for PHP 7.4 using a derivation of the
# script suggested in https://github.com/actions/runner-images/issues/9701
- name: Install VC15 component for PHP 7.4
if: ${{ inputs.version == '7.4' }}
shell: pwsh
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToRemove= @(
"Microsoft.VisualStudio.Component.VC.v141.x86.x64"
)
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$installPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$component = "Microsoft.VisualStudio.Component.VC.v141.x86.x64"
$args = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$installPath`"", '--add', $component, '--quiet', '--norestart', '--nocache')
$process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru -WindowStyle Hidden
- name: Setup PHP SDK
id: setup-php
Expand Down

0 comments on commit c64e7d0

Please sign in to comment.