Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Mar 27, 2022
1 parent 9d2dfd9 commit 6427ed1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
target: 'i686-pc-windows-msvc'
- host: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
# Node.js in Baidu need to compatible with `GLIBC_2.12`
build: >-
set -e &&
rustup toolchain install $(cat ./rust-toolchain) &&
rustup target add x86_64-unknown-linux-gnu &&
yarn lerna exec "yarn build --target x86_64-unknown-linux-gnu --zig --zig-abi-suffix 2.12" --concurrency 1 --stream --no-prefix &&
llvm-strip -x packages/*/*.node
yarn lerna exec "yarn build --target x86_64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix &&
strip packages/*/*.node
- host: ubuntu-latest
target: 'x86_64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
Expand Down Expand Up @@ -235,6 +235,7 @@ jobs:
yarn install --immutable --mode=skip-build
yarn build:ts
yarn build
strip -x packages/*/*.node
yarn test
rm -rf node_modules
rm -rf target
Expand Down Expand Up @@ -290,7 +291,12 @@ jobs:
run: yarn build:ts

- name: Test bindings
run: yarn test -c 2
run: |
yarn test packages/argon2
yarn test packages/bcrypt
yarn test packages/crc32
yarn test packages/jieba
yarn test packages/xxhash
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
Expand Down Expand Up @@ -474,7 +480,7 @@ jobs:
run: |
set -e
yarn build:ts
yarn test
yarn test -s
ls -la
test-linux-aarch64-musl-binding:
Expand Down
12 changes: 10 additions & 2 deletions ava.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ const USE_TS_NODE = (function () {

module.exports = {
extensions: ['ts'],
workerThreads: process.platform !== 'win32',
require: [USE_TS_NODE ? 'ts-node/register/transpile-only' : '@swc-node/register'],
workerThreads: true,
require: [
USE_TS_NODE ? 'ts-node/register/transpile-only' : '@swc-node/register',
'@node-rs/argon2',
'@node-rs/bcrypt',
'@node-rs/crc32',
'@node-rs/deno-lint',
'@node-rs/jieba',
'@node-rs/xxhash',
],
files: ['packages/**/*.spec.ts'],
timeout: '3m',
environmentVariables: {
Expand Down
2 changes: 1 addition & 1 deletion crates/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(not(all(target_os = "linux", target_arch = "aarch64", target_env = "musl")))'.dependencies]
[target.'cfg(all(not(target_env = "musl")))'.dependencies]
mimalloc-rust = { version = "0.1" }
5 changes: 1 addition & 4 deletions crates/alloc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(all(
all(not(target_env = "musl"), target_arch = "x86_64"),
debug_assertions
))]
#[cfg(all(debug_assertions, not(target_env = "musl"),))]
#[global_allocator]
static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc;
2 changes: 1 addition & 1 deletion packages/argon2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ global_alloc = { path = "../../crates/alloc" }
napi-derive = { version = "2", default-features = false, features = [
"type-def",
] }
rand = { version = "0.8", features = ["nightly", "simd_support"] }
rand = { version = "0.8", features = ["nightly", "simd_support", "getrandom"] }

[build-dependencies]
napi-build = "1"
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2022-02-10
nightly-2022-03-24

0 comments on commit 6427ed1

Please sign in to comment.