-
Notifications
You must be signed in to change notification settings - Fork 503
88 lines (77 loc) · 2.63 KB
/
lib.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
}
}