Skip to content

setup-build: Fix the output value #966

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

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ outputs:
description: |
The full version of the Windows build tools installed, eg. "14.42.34433". This is only set
if the `msvc-version` input was provided, and only on Windows.
value: ${{ steps.install-msvc.outputs.windows-build-tools-version }}
value: ${{ steps.setup-msvc.outputs.windows-build-tools-version }}

runs:
using: composite
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/test-setup-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
env:
TEST_WIN_SDK_VERSION: "10.0.22000.0"
TEST_MSVC_VERSION: "14.40"
TEST_BUILD_TOOLS_EXPECTED_VERSION: "14.40.33807"

jobs:
test-setup-build-windows-vs-dev-env:
Expand Down Expand Up @@ -77,11 +78,19 @@ jobs:
Write-Output "✅ No unexpected Windows SDK versions greater than `"${env:TEST_WIN_SDK_VERSION}`" found."
}

$BuildToolsVersion = "${{ steps.setup-build.outputs.windows-build-tools-version }}"
if ($BuildToolsVersion -ne $env:TEST_BUILD_TOOLS_EXPECTED_VERSION) {
Write-Output "::error::Expected build tools version `"${env:TEST_BUILD_TOOLS_EXPECTED_VERSION}`", but got `"${BuildToolsVersion}`"."
$HasError = $true
} else {
Write-Output "✅ Build tools version `${BuildToolsVersion}` matches expected version."
}

# Check if the correct MSVC version is installed.
$InstallerLocation = Join-Path "${env:ProgramFiles(x86)}" "Microsoft Visual Studio" "Installer"
$VSWhere = Join-Path "${InstallerLocation}" "vswhere.exe"
$InstallPath = (& "$VSWhere" -latest -products * -format json | ConvertFrom-Json).installationPath
$MSVCDir = Join-Path $InstallPath "VC" "Tools" "MSVC" "${{ steps.setup-build.outputs.windows-build-tools-version }}"
$MSVCDir = Join-Path $InstallPath "VC" "Tools" "MSVC" $BuildToolsVersion
if (Test-Path -Path $MSVCDir) {
Write-Output "✅ MSVC version `${env:TEST_MSVC_VERSION}`" is installed."
} else {
Expand Down Expand Up @@ -174,11 +183,20 @@ jobs:
Write-Output "✅ No unexpected Windows SDK versions greater than `"${env:TEST_WIN_SDK_VERSION}`" found."
}

# Check the action output.
$BuildToolsVersion = "${{ steps.setup-build.outputs.windows-build-tools-version }}"
if ($BuildToolsVersion -ne $env:TEST_BUILD_TOOLS_EXPECTED_VERSION) {
Write-Output "::error::Expected build tools version `"${env:TEST_BUILD_TOOLS_EXPECTED_VERSION}`", but got `"${BuildToolsVersion}`"."
$HasError = $true
} else {
Write-Output "✅ Build tools version `${BuildToolsVersion}` matches expected version."
}

# Check if the correct MSVC version is installed.
$InstallerLocation = Join-Path "${env:ProgramFiles(x86)}" "Microsoft Visual Studio" "Installer"
$VSWhere = Join-Path "${InstallerLocation}" "vswhere.exe"
$InstallPath = (& "$VSWhere" -latest -products * -format json | ConvertFrom-Json).installationPath
$MSVCDir = Join-Path $InstallPath "VC" "Tools" "MSVC" "${{ steps.setup-build.outputs.windows-build-tools-version }}"
$MSVCDir = Join-Path $InstallPath "VC" "Tools" "MSVC" $BuildToolsVersion
if (Test-Path -Path $MSVCDir) {
Write-Output "✅ MSVC version `${env:TEST_MSVC_VERSION}`" is installed."
} else {
Expand Down