-
-
Notifications
You must be signed in to change notification settings - Fork 103
186 lines (155 loc) · 6.47 KB
/
build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Build
on:
workflow_dispatch:
inputs:
build-version:
description: 'Node.js version to build'
required: true
default: '20'
type: choice
options:
- 18
- 20
- 22
- 23
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_NOLOGO: 1
node: 20
jobs:
build:
runs-on: windows-2022
outputs:
node-version: ${{ steps.node-test-version.outputs.node-version }}
strategy:
fail-fast: true
name: build windows-2022-node-${{ inputs.build-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/setup-env
with:
node: ${{ env.node }}
# node: ${{ inputs.build-version }}
os: windows-2022
- name: Get latest Node.js version for v${{ inputs.build-version }}
id: node-test-version
shell: bash
run: |
node tools/getVersionAction.js ${{ inputs.build-version }}
echo "node-version=$(cat node.txt)" >> $GITHUB_OUTPUT
- name: install node-gyp
run: npm i -g node-gyp
- name: Create release folder
run: |
mkdir "release\ia32\${{ inputs.build-version }}"
mkdir "release\x64\${{ inputs.build-version }}"
mkdir "release\arm64\${{ inputs.build-version }}"
- name: Create node.version file
uses: actions/github-script@v7
with:
result-encoding: string
script: |
try {
const fs = require('fs')
fs.writeFileSync('release/ia32/${{ inputs.build-version }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
fs.writeFileSync('release/x64/${{ inputs.build-version }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
if(${{ inputs.build-version }} >=20){
fs.writeFileSync('release/arm64/${{ inputs.build-version }}/node.version', '${{ steps.node-test-version.outputs.node-version }}');
}
} catch(err) {
core.error("Error writing node.version file")
core.setFailed(err)
}
- name: Build ia32
timeout-minutes: 30
if: ${{ inputs.build-version <23 }}
run: |
node-gyp configure build --target=${{ steps.node-test-version.outputs.node-version }} --runtime=node --release --arch=ia32
cmd /c copy /y build\Release\edge_*.node release\ia32\${{ inputs.build-version }}
cmd /c rmdir /S /Q build
- name: Build x64
timeout-minutes: 30
run: |
node-gyp configure build --target=${{ steps.node-test-version.outputs.node-version }} --runtime=node --release --arch=x64
cmd /c copy /y build\Release\edge_*.node release\x64\${{ inputs.build-version }}
cmd /c rmdir /S /Q build
- name: Build arm64
timeout-minutes: 30
if: ${{ inputs.build-version >=20 }}
shell: pwsh
run: |
node-gyp configure --target=${{ steps.node-test-version.outputs.node-version }} --runtime=node --release --arch=arm64
(Get-Content -Raw build/build_managed.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/build_managed.vcxproj
(Get-Content -Raw build/edge_coreclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_coreclr.vcxproj
(Get-Content -Raw build/edge_nativeclr.vcxproj) -replace '<FloatingPointModel>Strict</FloatingPointModel>', '<!-- <FloatingPointModel>Strict</FloatingPointModel> -->' | Out-File -Encoding Utf8 build/edge_nativeclr.vcxproj
node-gyp build
cmd /c copy /y build\Release\edge_*.node release\arm64\${{ inputs.build-version }}
cmd /c rmdir /S /Q build
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: edge-js-${{ inputs.build-version }}
path: |
release
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [windows-2022]
# fail-fast: false
name: test ${{ matrix.os }}-node-${{ needs.build.outputs.node-version }}
steps:
# - uses: agracio/[email protected]
# id: node-version
# with:
# value: ${{ needs.build.outputs.node-version }}
# length_from_start: 2
- name: Checkout code
uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/setup-env
with:
# node: ${{ inputs.build-version }}
node: ${{ env.node }}
os: ${{ matrix.os }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: edge-js-${{ inputs.build-version }}*
- run: ls -R release
- name: Create release folder
run: |
cmd /c if not exist "lib\native\win32\ia32\${{ inputs.build-version }}" mkdir "lib\native\win32\ia32\${{ inputs.build-version }}"
cmd /c if not exist "lib\native\win32\x64\${{ inputs.build-version }}" mkdir "lib\native\win32\x64\${{ inputs.build-version }}"
cmd /c if not exist "lib\native\win32\arm64\${{ inputs.build-version }}" mkdir "lib\native\win32\arm64\${{ inputs.build-version }}"
- name: runner.arch to lowercase
uses: actions/github-script@v7
id: arch-tolower
with:
result-encoding: string
script: |
try {
var arch = '${{ runner.arch }}'
return arch.toLowerCase();
} catch(err) {
core.setFailed(err)
}
- name: Copy artifacts
run: |
cmd /c copy /y release\edge-js-${{ inputs.build-version }}\${{ steps.arch-tolower.outputs.result }}\${{ inputs.build-version }}\edge_*.node lib\native\win32\${{ steps.arch-tolower.outputs.result }}\${{ inputs.build-version }}
- name: Test
timeout-minutes: 10
uses: ./.github/actions/test-windows
with:
node: ${{ needs.build.outputs.node-version }}
- name: Test report
uses: ./.github/actions/create-test-report
with:
node: ${{ needs.build.outputs.node-version }}
os: ${{ matrix.os }}
name: 'build-tests'