Skip to content

Commit b9af7c8

Browse files
committed
build: support windows aarch64 binary
1 parent 35bbb1b commit b9af7c8

File tree

21 files changed

+206
-16
lines changed

21 files changed

+206
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,67 @@ jobs:
156156
name: bindings-win32-i686
157157
path: packages/*/*.node
158158

159+
build-windows-aarch64:
160+
if: "!contains(github.event.head_commit.message, 'skip ci')"
161+
name: stable - windows-aarch64 - node@14
162+
runs-on: windows-latest
163+
steps:
164+
- uses: actions/checkout@v2
165+
166+
- name: Setup node
167+
uses: actions/setup-node@v2-beta
168+
with:
169+
node-version: 14
170+
check-latest: true
171+
172+
- name: Cache NPM dependencies
173+
uses: actions/cache@v1
174+
with:
175+
path: node_modules
176+
key: npm-cache-windows-aarch64-node@lts-${{ hashFiles('yarn.lock') }}
177+
178+
- name: Install dependencies
179+
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
180+
181+
- name: Build TypeScript
182+
run: yarn build:ts
183+
184+
- name: Install
185+
uses: actions-rs/toolchain@v1
186+
with:
187+
toolchain: stable
188+
profile: minimal
189+
override: true
190+
191+
- name: Install aarch64 toolchain
192+
run: rustup target add aarch64-pc-windows-msvc
193+
194+
- name: Generate Cargo.lock
195+
uses: actions-rs/cargo@v1
196+
with:
197+
command: generate-lockfile
198+
199+
- name: Cache cargo registry
200+
uses: actions/cache@v1
201+
with:
202+
path: ~/.cargo/registry
203+
key: stable-windows-aarch64-node@lts-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
204+
205+
- name: Cache cargo index
206+
uses: actions/cache@v1
207+
with:
208+
path: ~/.cargo/git
209+
key: stable-windows-aarch64-node@lts-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
210+
211+
- name: Run build
212+
run: npx lerna exec "yarn build --target aarch64-pc-windows-msvc" --concurrency 1 --stream --no-prefix
213+
214+
- name: Upload artifact
215+
uses: actions/upload-artifact@v2
216+
with:
217+
name: bindings-win32-aarch64
218+
path: packages/*/*.node
219+
159220
build-musl:
160221
if: "!contains(github.event.head_commit.message, 'skip ci')"
161222
name: stable - linux-musl - node@lts
@@ -718,6 +779,7 @@ jobs:
718779
- build-windows-i686
719780
- build-linux-aarch64-musl
720781
- build-freebsd
782+
- build-windows-aarch64
721783
steps:
722784
- uses: actions/checkout@v2
723785

packages/bcrypt/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ rand = "0.8"
1919
[target.'cfg(all(unix, not(target_env = "musl"), not(target_os = "freebsd"), not(target_arch = "arm"), not(target_arch = "aarch64")))'.dependencies]
2020
jemallocator = {version = "0.3", features = ["disable_initial_exec_tls"]}
2121

22-
[target.'cfg(windows)'.dependencies]
22+
[target.'cfg(all(windows, not(target_arch = "aarch64")))'.dependencies]
2323
mimalloc = {version = "0.1"}
2424

2525
[dev-dependencies]
2626
quickcheck = "1.0"
2727

2828
[build-dependencies]
29-
napi-build = "1"
29+
napi-build = "1.1.0-beta.0"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@node-rs/bcrypt-win32-arm64-msvc`
2+
3+
This is the **aarch64-pc-windows-msvc** binary for `@node-rs/bcrypt`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@node-rs/bcrypt-win32-arm64-msvc",
3+
"version": "1.2.1",
4+
"os": ["win32"],
5+
"cpu": ["arm64"],
6+
"main": "bcrypt.win32-arm64-msvc.node",
7+
"files": ["bcrypt.win32-arm64-msvc.node"],
8+
"description": "Rust bcrypt binding",
9+
"keywords": ["bcrypt", "auth", "password", "authentication", "encryption", "crypto", "N-API", "napi-rs", "node-rs"],
10+
"author": "LongYinan <[email protected]>",
11+
"homepage": "https://github.com/napi-rs/node-rs",
12+
"license": "MIT",
13+
"engines": {
14+
"node": ">= 10"
15+
},
16+
"publishConfig": {
17+
"registry": "https://registry.npmjs.org/",
18+
"access": "public"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/napi-rs/node-rs.git"
23+
},
24+
"bugs": {
25+
"url": "https://github.com/napi-rs/node-rs/issues"
26+
}
27+
}

packages/bcrypt/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"aarch64-apple-darwin",
2222
"aarch64-linux-android",
2323
"x86_64-unknown-freebsd",
24-
"aarch64-unknown-linux-musl"
24+
"aarch64-unknown-linux-musl",
25+
"aarch64-pc-windows-msvc"
2526
]
2627
}
2728
},

packages/bcrypt/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ mod verify_task;
2727
not(target_arch = "arm"),
2828
not(target_arch = "aarch64")
2929
))]
30+
#[cfg(all(windows, not(target_arch = "aarch64")))]
3031
#[global_allocator]
31-
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
32+
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
3233

3334
#[cfg(windows)]
3435
#[global_allocator]

packages/crc32/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ napi-derive = "1"
1515
[target.'cfg(all(unix, not(target_env = "musl"), not(target_os = "freebsd"), not(target_arch = "arm"), not(target_arch = "aarch64")))'.dependencies]
1616
jemallocator = {version = "0.3", features = ["disable_initial_exec_tls"]}
1717

18-
[target.'cfg(windows)'.dependencies]
18+
[target.'cfg(all(windows, not(target_arch = "aarch64")))'.dependencies]
1919
mimalloc = {version = "0.1"}
2020

2121
[build-dependencies]
22-
napi-build = "1"
22+
napi-build = "1.1.0-beta.0"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@node-rs/crc32-win32-arm64-msvc`
2+
3+
This is the **aarch64-pc-windows-msvc** binary for `@node-rs/crc32`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@node-rs/crc32-win32-arm64-msvc",
3+
"version": "1.1.0",
4+
"os": ["win32"],
5+
"cpu": ["arm64"],
6+
"main": "crc32.win32-arm64-msvc.node",
7+
"files": ["crc32.win32-arm64-msvc.node"],
8+
"description": "SIMD crc32",
9+
"keywords": ["SIMD", "NAPI", "napi-rs", "node-rs", "crc32", "crc32c"],
10+
"author": "LongYinan <[email protected]>",
11+
"homepage": "https://github.com/napi-rs/node-rs",
12+
"license": "MIT",
13+
"engines": {
14+
"node": ">= 10"
15+
},
16+
"publishConfig": {
17+
"registry": "https://registry.npmjs.org/",
18+
"access": "public"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/napi-rs/node-rs.git"
23+
},
24+
"bugs": {
25+
"url": "https://github.com/napi-rs/node-rs/issues"
26+
}
27+
}

packages/crc32/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"aarch64-apple-darwin",
2222
"aarch64-linux-android",
2323
"x86_64-unknown-freebsd",
24-
"aarch64-unknown-linux-musl"
24+
"aarch64-unknown-linux-musl",
25+
"aarch64-pc-windows-msvc"
2526
]
2627
}
2728
},

0 commit comments

Comments
 (0)