Skip to content

Commit 2019a24

Browse files
committed
chore: support more platforms
1 parent 7c0bf9b commit 2019a24

File tree

31 files changed

+625
-332
lines changed

31 files changed

+625
-332
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[target.aarch64-unknown-linux-gnu]
22
linker = "aarch64-linux-gnu-gcc"
3+
4+
[target.armv7-unknown-linux-gnueabihf]
5+
linker = "arm-linux-gnueabihf-gcc"

.github/workflows/ci.yaml

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,69 @@ jobs:
191191
name: bindings-linux-aarch64
192192
path: packages/*/*.node
193193

194+
build-linux-arm7:
195+
name: stable - arm7-unknown-linux-gnu - node@14
196+
runs-on: ubuntu-latest
197+
198+
steps:
199+
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
200+
201+
- uses: actions/checkout@v2
202+
203+
- name: Setup node
204+
uses: actions/setup-node@v1
205+
with:
206+
node-version: 14
207+
208+
- name: Install
209+
uses: actions-rs/toolchain@v1
210+
with:
211+
toolchain: stable
212+
profile: minimal
213+
override: true
214+
215+
- name: Generate Cargo.lock
216+
uses: actions-rs/cargo@v1
217+
with:
218+
command: generate-lockfile
219+
220+
- name: Cache cargo registry
221+
uses: actions/cache@v1
222+
with:
223+
path: ~/.cargo/registry
224+
key: stable-linux-arm7-gnu-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
225+
226+
- name: Cache cargo index
227+
uses: actions/cache@v1
228+
with:
229+
path: ~/.cargo/git
230+
key: stable-linux-arm7-gnu-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
231+
232+
- name: Cache NPM dependencies
233+
uses: actions/cache@v1
234+
with:
235+
path: node_modules
236+
key: npm-cache-linux-arm7-gnu-node@14-${{ hashFiles('yarn.lock') }}
237+
238+
- name: Install aarch64 toolchain
239+
run: rustup target add armv7-unknown-linux-gnueabihf
240+
241+
- name: Install cross compile toolchain
242+
run: |
243+
sudo apt-get update
244+
sudo apt-get install gcc-arm-linux-gnueabihf -y
245+
- name: Install dependencies
246+
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
247+
248+
- name: Cross build arm7
249+
run: yarn build -- -- --target armv7-unknown-linux-gnueabihf
250+
251+
- name: Upload artifact
252+
uses: actions/upload-artifact@v2
253+
with:
254+
name: bindings-linux-arm7
255+
path: packages/*/*.node
256+
194257
build-apple-silicon:
195258
name: nightly - aarch64-apple-darwin - node@14
196259
runs-on: macos-latest
@@ -249,6 +312,58 @@ jobs:
249312
name: bindings-apple-aarch64
250313
path: packages/*/*.node
251314

315+
build-android-aarch64:
316+
name: Build - Android - aarch64
317+
runs-on: macos-latest
318+
steps:
319+
- uses: actions/checkout@v2
320+
321+
- name: Setup node
322+
uses: actions/setup-node@v1
323+
with:
324+
node-version: 14
325+
326+
- name: Install aarch64 toolchain
327+
run: rustup target add aarch64-linux-android
328+
329+
- name: Generate Cargo.lock
330+
uses: actions-rs/cargo@v1
331+
with:
332+
command: generate-lockfile
333+
334+
- name: Cache cargo registry
335+
uses: actions/cache@v1
336+
with:
337+
path: ~/.cargo/registry
338+
key: nightly-apple-aarch64-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
339+
340+
- name: Cache cargo index
341+
uses: actions/cache@v1
342+
with:
343+
path: ~/.cargo/git
344+
key: nightly-apple-aarch64-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
345+
346+
- name: Cache NPM dependencies
347+
uses: actions/cache@v1
348+
with:
349+
path: node_modules
350+
key: npm-cache-apple-aarch64-node@14-${{ hashFiles('yarn.lock') }}
351+
352+
- name: Install dependencies
353+
run: yarn install --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
354+
355+
- name: Build
356+
shell: bash
357+
run: |
358+
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang"
359+
yarn build -- -- --target aarch64-linux-android
360+
361+
- name: Upload artifact
362+
uses: actions/upload-artifact@v2
363+
with:
364+
name: bindings-android-aarch64
365+
path: packages/*/*.node
366+
252367
test-binding:
253368
name: Test bindings on ${{ matrix.os }} - node@${{ matrix.node }}
254369
needs:
@@ -391,6 +506,8 @@ jobs:
391506
- test-musl-binding
392507
- test-binding
393508
- test-linux-aarch64
509+
- build-android-aarch64
510+
- build-linux-arm7
394511
- build-apple-silicon
395512
runs-on: ubuntu-latest
396513
steps:
@@ -401,12 +518,13 @@ jobs:
401518

402519
publish:
403520
name: Publish
404-
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
405521
runs-on: ubuntu-latest
406522
needs:
407523
- test-binding
408524
- test-musl-binding
409525
- test-linux-aarch64
526+
- build-android-aarch64
527+
- build-linux-arm7
410528
- build-apple-silicon
411529
steps:
412530
- uses: actions/checkout@v2
@@ -444,7 +562,9 @@ jobs:
444562
- name: List packages
445563
run: ls -R packages
446564
shell: bash
565+
447566
- name: Lerna publish
567+
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
448568
run: |
449569
find ./packages/ -type d -maxdepth 1 -exec cp LICENSE {} \;
450570
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@
2222
"typecheck": "tsc -b tsconfig.project.json -verbose"
2323
},
2424
"devDependencies": {
25-
"@napi-rs/cli": "^1.0.0-alpha.9",
26-
"@typescript-eslint/eslint-plugin": "^4.9.0",
27-
"@typescript-eslint/parser": "^4.9.0",
28-
"ava": "^3.13.0",
25+
"@napi-rs/cli": "^1.0.0-alpha.13",
26+
"@typescript-eslint/eslint-plugin": "^4.11.1",
27+
"@typescript-eslint/parser": "^4.11.1",
28+
"ava": "^3.14.0",
2929
"benchmark": "^2.1.4",
3030
"codecov": "^3.8.1",
3131
"cross-env": "^7.0.3",
32-
"eslint": "^7.14.0",
33-
"eslint-config-prettier": "^7.0.0",
32+
"eslint": "^7.16.0",
33+
"eslint-config-prettier": "^7.1.0",
3434
"eslint-plugin-import": "^2.22.1",
35-
"eslint-plugin-prettier": "^3.1.4",
35+
"eslint-plugin-prettier": "^3.3.0",
3636
"eslint-plugin-sonarjs": "^0.5.0",
37-
"husky": "^4.3.0",
37+
"husky": "^4.3.6",
3838
"lerna": "^3.22.1",
39-
"lint-staged": "^10.5.2",
39+
"lint-staged": "^10.5.3",
4040
"npm-run-all": "^4.1.5",
4141
"nyc": "^15.1.0",
4242
"prettier": "^2.2.1",
43-
"ts-node": "^9.0.0",
44-
"typescript": "^4.1.2"
43+
"ts-node": "^9.1.1",
44+
"typescript": "^4.1.3"
4545
},
4646
"ava": {
4747
"extensions": ["ts"],

packages/bcrypt/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010
[dependencies]
1111
blowfish = {version = "0.7", features = ["bcrypt"]}
1212
byteorder = "1"
13-
napi = "1.0.0-alpha.0"
13+
napi = "1.0.0-alpha.10"
1414
napi-derive = "1.0.0-alpha.0"
1515
phf = {version = "0.8", features = ["macros"]}
1616
radix64 = "0.6"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@node-rs/bcrypt-android-arm64`
2+
3+
This is the **aarch64-linux-android** 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-android-arm64",
3+
"version": "0.5.0",
4+
"os": ["android"],
5+
"cpu": ["arm64"],
6+
"main": "bcrypt.android-arm64.node",
7+
"files": ["bcrypt.android-arm64.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+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@node-rs/bcrypt-linux-arm-gnueabihf`
2+
3+
This is the **armv7-unknown-linux-gnueabihf** 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-linux-arm-gnueabihf",
3+
"version": "0.5.0",
4+
"os": ["linux"],
5+
"cpu": ["arm"],
6+
"main": "bcrypt.linux-arm-gnueabihf.node",
7+
"files": ["bcrypt.linux-arm-gnueabihf.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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313
"name": "bcrypt",
1414
"triples": {
1515
"defaults": true,
16-
"additional": ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-gnu", "aarch64-apple-darwin"]
16+
"additional": [
17+
"armv7-unknown-linux-gnueabihf",
18+
"x86_64-unknown-linux-musl",
19+
"aarch64-unknown-linux-gnu",
20+
"aarch64-apple-darwin",
21+
"aarch64-linux-android"
22+
]
1723
}
1824
},
1925
"engines": {

packages/crc32/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
crc32fast = "1.2"
12-
napi = "1.0.0-alpha.0"
12+
napi = "1.0.0-alpha.10"
1313
napi-derive = "1.0.0-alpha.0"
1414

1515
[target.'cfg(all(unix, not(target_env = "musl"), not(target_arch = "aarch64")))'.dependencies]

0 commit comments

Comments
 (0)