Update Windows metadata (#3342) #1720
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
name: lib | |
on: | |
pull_request: | |
paths-ignore: | |
- '.github/ISSUE_TEMPLATE/**' | |
- 'web/**' | |
push: | |
paths-ignore: | |
- '.github/ISSUE_TEMPLATE/**' | |
- 'web/**' | |
branches: | |
- master | |
jobs: | |
check: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fix environment | |
uses: ./.github/actions/fix-environment | |
- name: Build gnu libs | |
shell: cmd | |
run: | | |
set PATH=C:\msys64\mingw64\bin;%PATH% | |
cargo run -p tool_gnu -- all | |
- name: Find Visual Studio | |
id: visual-studio | |
shell: pwsh | |
run: | | |
$path = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` | |
-latest -property installationPath -format value | |
"install_path=$path" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
- name: Build i686_msvc | |
shell: cmd | |
run: | | |
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 "${{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 "${{steps.visual-studio.outputs.install_path}}\VC\Auxiliary\Build\vcvars32.bat" amd64_arm64 | |
cargo run -p tool_msvc | |
- name: Upload libs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libs | |
path: crates/targets/*/lib/* | |
- name: Check diff | |
shell: bash | |
run: | | |
git add -N . | |
git diff --exit-code crates/targets || (echo '::error::Generated target libs are out-of-date.'; exit 1) | |
- name: Check dumpbin | |
shell: pwsh | |
run: | | |
$VisualStudioRoot = "${{steps.visual-studio.outputs.install_path}}" | |
$DumpbinPath = Resolve-Path "$VisualStudioRoot\VC\Tools\MSVC\*\bin\*\x86\dumpbin.exe" | | |
Select -ExpandProperty Path -First 1 | |
$Tests = @( | |
[Tuple]::Create("aarch64_msvc","AA64"), | |
[Tuple]::Create("x86_64_msvc","8664"), | |
[Tuple]::Create("i686_msvc","14C") | |
) | |
foreach($Test in $Tests) { | |
$Target = $Test.Item1 | |
$Magic = $Test.Item2 | |
$Output = [string](& $DumpbinPath /headers crates/targets/$Target/lib/windows.0.52.0.lib) | |
if($Output -match "Machine\s*: $Magic" -ne $True) { | |
Write-Error "Import lib check failed for $Target ($Magic)." | |
Exit 1 | |
} | |
} |