Repository navigation
102 lines (98 loc) · 3.47 KB
/
Copy pathnative.yml
File metadata and controls
102 lines (98 loc) · 3.47 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Windows native prebuilds
on:
workflow_call:
permissions:
contents: read
jobs:
native:
name: Node ${{ matrix.node }} / Windows x64
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- node: '8.17.0'
abi: '57'
- node: '16.20.2'
abi: '93'
- node: '24.16.0'
abi: '137'
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
- name: Set up the modern build host
uses: actions/setup-node@v4
with:
node-version: '24.16.0'
architecture: x64
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: npm install --ignore-scripts --package-lock=false
- run: npm run test:build
- name: Build the target ABI with the modern toolchain
run: npm run build:native -- ${{ matrix.node }}
- name: Switch to the runtime being tested
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: x64
- name: Verify and load the target prebuild
run: |
$actual = node -p "process.versions.modules"
if ($actual -ne '${{ matrix.abi }}') { throw "Unexpected runtime ABI: $actual" }
npm run test:prebuild
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
npm test
exit $LASTEXITCODE
env:
PREBUILDS_ONLY: '1'
- uses: actions/upload-artifact@v4
with:
name: winapi-node-${{ matrix.node }}-win32-x64
path: prebuilds/win32-x64/winapi.abi${{ matrix.abi }}.node
if-no-files-found: error
retention-days: 14
package:
name: Package all three prebuilds
needs: native
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24.16.0'
architecture: x64
- uses: actions/download-artifact@v4
with:
pattern: winapi-node-*-win32-x64
path: prebuilds/win32-x64
merge-multiple: true
- name: Build the unsigned C# helper
run: |
$csc = "$env:WINDIR\Microsoft.NET\Framework\v4.0.30319\csc.exe"
& $csc /nologo /target:exe /platform:x86 /out:WinAPI.exe /reference:System.Web.Extensions.dll /reference:System.Windows.Forms.dll /reference:System.Drawing.dll src\cs\Program.cs src\cs\Properties\AssemblyInfo.cs src\cs\User32.cs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Create and verify the npm package
run: |
New-Item -ItemType Directory -Force build/package | Out-Null
$pack = npm pack --json --ignore-scripts --pack-destination build/package | ConvertFrom-Json
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$files = $pack[0].files.path
foreach ($required in @('binding.gyp', 'src/main.cc', 'WinAPI.exe', 'prebuilds/win32-x64/winapi.abi57.node', 'prebuilds/win32-x64/winapi.abi93.node', 'prebuilds/win32-x64/winapi.abi137.node')) {
if ($files -notcontains $required) { throw "Missing npm package file: $required" }
}
- uses: actions/upload-artifact@v4
with:
name: winapi-windows-x64-package
path: |
build/package/*.tgz
WinAPI.exe
prebuilds/win32-x64/*.node
if-no-files-found: error
retention-days: 14