Skip to content

Commit

Permalink
feat: upgrade dependencies and lockfile (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Dec 28, 2023
1 parent cac0c8b commit 70d7fa7
Show file tree
Hide file tree
Showing 30 changed files with 1,588 additions and 795 deletions.
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
rustflags = ["-C", "target-feature=+sse4.2"]
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+sse4.2"]
[target.x86_64-apple-darwin]
rustflags = ["-C", "target-feature=+sse4.2"]
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
117 changes: 38 additions & 79 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ on:

jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"

strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: 'x86_64-apple-darwin'
build: |
yarn build
strip -x packages/*/*.node
build: yarn build --target x86_64-apple-darwin
- host: windows-latest
build: yarn build
target: 'x86_64-pc-windows-msvc'
Expand All @@ -40,16 +36,10 @@ 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-debian
build: >-
set -e &&
rustup target add x86_64-unknown-linux-gnu &&
yarn build --target x86_64-unknown-linux-gnu &&
strip packages/*/*.node
build: CC=clang yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: 'x86_64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: yarn build
build: yarn build --target x86_64-unknown-linux-musl -x
- host: macos-latest
target: 'aarch64-apple-darwin'
build: |
Expand All @@ -59,63 +49,44 @@ jobs:
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
strip -x packages/*/*.node
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: >-
rustup target add aarch64-unknown-linux-gnu &&
yarn build --target aarch64-unknown-linux-gnu &&
llvm-strip packages/*/*.node
build: CC=clang yarn build --target aarch64-unknown-linux-gnu --use-napi-cross
- host: ubuntu-latest
target: 'armv7-unknown-linux-gnueabihf'
setup: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: yarn build --target armv7-unknown-linux-gnueabihf
build: CC=clang yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
- host: ubuntu-latest
target: aarch64-linux-android
build: |
yarn build --target aarch64-linux-android
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip packages/*/*.node
build: yarn build --target aarch64-linux-android
- host: ubuntu-latest
architecture: x64
target: armv7-linux-androideabi
build: |
yarn build --target armv7-linux-androideabi
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip packages/*/*.node
build: yarn build --target armv7-linux-androideabi
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
downloadTarget: 'aarch64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl
build: yarn build --target aarch64-unknown-linux-musl -x
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g @napi-rs/cli
yarn build --target aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc

name: stable - ${{ matrix.settings.target }} - node@18
name: stable - ${{ matrix.settings.target }} - node@20
runs-on: ${{ matrix.settings.host }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: 18
node-version: 20
cache: yarn

- name: Install
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: nightly-2023-10-25
toolchain: nightly-2023-12-23
targets: ${{ matrix.settings.target }}

- name: Cache cargo registry
Expand All @@ -124,8 +95,8 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
~/.napi-rs
target
.cargo-cache
key: ${{ matrix.settings.target }}-cargo-registry

- name: Setup toolchain
Expand All @@ -134,7 +105,7 @@ jobs:
shell: bash

- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.11.0

Expand All @@ -149,25 +120,15 @@ jobs:
- name: 'Build TypeScript'
run: yarn build:ts

- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/.cargo/git:/usr/local/cargo/git -v ${{ github.workspace }}/.cargo-cache/.cargo/registry:/usr/local/cargo/registry -v ${{ github.workspace }}:/build -w /build
run: ${{ matrix.settings.build }}

- name: Setup node x86
uses: actions/setup-node@v4
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 18
cache: yarn
node-version: 20
architecture: x86

- name: 'Build'
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash

- name: Upload artifact
Expand All @@ -181,7 +142,7 @@ jobs:
runs-on: macos-12
name: Build FreeBSD
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
id: build
uses: cross-platform-actions/action@v0.22.0
Expand All @@ -202,7 +163,7 @@ jobs:
sudo pkg install -y -f curl node libnghttp2 npm
sudo npm install -g yarn --ignore-scripts
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --default-toolchain nightly-2023-10-25
sh rustup.sh -y --default-toolchain nightly-2023-12-23
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
Expand All @@ -221,7 +182,7 @@ jobs:
strip -x packages/*/*.node
rm -rf node_modules
rm -rf target
rm -rf .yarn/cache
rm -rf .yarn
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -246,7 +207,7 @@ jobs:
runs-on: ${{ matrix.settings.host }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -273,13 +234,7 @@ jobs:
run: yarn build:ts

- name: Test bindings
run: |
yarn test packages/argon2
yarn test packages/bcrypt
yarn test packages/crc32
yarn test packages/jieba
yarn test packages/jsonwebtoken
yarn test packages/xxhash
run: yarn workspaces foreach -A -j 1 run test

test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
Expand All @@ -292,7 +247,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -325,8 +280,7 @@ jobs:
with:
image: node:${{ matrix.node }}-slim
options: -v ${{ github.workspace }}:/build -w /build
run: |
yarn test
run: yarn test -s

test-linux-x64-centos-7:
name: Test bindings on Linux-x64-glibc-2.17
Expand Down Expand Up @@ -379,7 +333,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -415,7 +369,7 @@ jobs:
image: node:${{ matrix.node }}-alpine
options: -v ${{ github.workspace }}:/build -w /build
run: |
yarn test
yarn test -s
test-linux-aarch64-gnu-binding:
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
Expand All @@ -428,7 +382,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -472,10 +426,14 @@ jobs:
needs:
- build

strategy:
fail-fast: false
matrix:
node: ['18', '20']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand All @@ -487,7 +445,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bindings-aarch64-unknown-linux-musl
path: packages
path: artifacts

- name: Move artifacts
run: yarn artifacts
Expand All @@ -511,7 +469,7 @@ jobs:
run: |
set -e
yarn build:ts
yarn test
yarn test -s
test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
Expand All @@ -524,7 +482,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand Down Expand Up @@ -559,7 +517,7 @@ jobs:
run: |
set -e
yarn build:ts
yarn test
yarn test -s
ls -la
publish:
Expand All @@ -571,15 +529,16 @@ jobs:
- test-linux-x64-centos-7
- test-linux-x64-musl-binding
- test-linux-aarch64-gnu-binding
- test-linux-aarch64-musl-binding
- test-linux-arm-gnueabihf-binding
- test-macOS-windows-binding
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: yarn

- name: 'Install dependencies'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-10-25
toolchain: nightly-2023-12-23
components: rustfmt, clippy

- name: 'Install dependencies'
Expand Down
3 changes: 2 additions & 1 deletion ava.config.js → ava.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
export default {
extensions: ['ts'],
workerThreads: false,
cache: false,
require: ['@swc-node/register'],
files: ['packages/**/*.spec.ts'],
timeout: '3m',
Expand Down
6 changes: 3 additions & 3 deletions crates/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.1.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[target.'cfg(not(target_os = "linux"))'.dependencies]
mimalloc-rust = { version = "0.2" }
mimalloc = { version = "0.1" }

[target.'cfg(all(target_os = "linux", not(all(target_env = "musl", target_arch = "aarch64"))))'.dependencies]
mimalloc-rust = { version = "0.2", features = ["local-dynamic-tls"] }
[target.'cfg(target_os = "linux")'.dependencies]
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }
6 changes: 1 addition & 5 deletions crates/alloc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#[cfg(all(
not(all(target_os = "linux", target_env = "musl", target_arch = "aarch64")),
not(debug_assertions)
))]
#[global_allocator]
static ALLOC: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc;
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;

0 comments on commit 70d7fa7

Please sign in to comment.