diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml index e067fdace0..b419985903 100644 --- a/.github/actions/fix-environment/action.yml +++ b/.github/actions/fix-environment/action.yml @@ -18,6 +18,9 @@ runs: - name: Configure environment shell: pwsh run: | + $vs_root = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' ` + -latest -property installationPath -format value + switch -Wildcard ("${{ matrix.target }}") { "*-pc-windows-gnu" @@ -27,19 +30,19 @@ runs: "i686*" { "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86") + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "x86_64*" { "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "aarch64*" { "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "*" diff --git a/.github/workflows/lib.yml b/.github/workflows/lib.yml index 08074e2a69..961bb8669c 100644 --- a/.github/workflows/lib.yml +++ b/.github/workflows/lib.yml @@ -27,22 +27,30 @@ jobs: set PATH=C:\msys64\mingw64\bin;%PATH% cargo run -p tool_gnu -- all + - name: Find Visual Studio + id: visual-studio + shell: pwsh + run: | + $path = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' ` + -latest -property installationPath -format value + Write-Output "install_path=$path" >> $env::GITHUB_OUTPUT + - name: Build i686_msvc shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" x86 + call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" x86 cargo run -p tool_msvc - name: Build x86_64_msvc shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" amd64 + call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" amd64 cargo run -p tool_msvc - name: Build aarch64_msvc shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" amd64_arm64 + call "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" amd64_arm64 cargo run -p tool_msvc - name: Upload libs @@ -60,7 +68,7 @@ jobs: - name: Check dumpbin shell: pwsh run: | - $VisualStudioRoot = & vswhere -latest -property installationPath -format value + $VisualStudioRoot = "${{steps.visual-studio.outputs.install_path}}" $DumpbinPath = Resolve-Path "$VisualStudioRoot\VC\Tools\MSVC\*\bin\*\x86\dumpbin.exe" | Select -ExpandProperty Path -First 1 $Tests = @(