chore: update

This commit is contained in:
skdhg committed 2023-08-11 17:33:07 +05:45
1 parent 9077961fe5
commit 7935696892
4 files changed
+154 -143

No files matched your search

+132 -132
View File
@@ -45,22 +45,22 @@ jobs:
set -e && set -e &&
yarn build --target x86_64-unknown-linux-gnu && yarn build --target x86_64-unknown-linux-gnu &&
strip *.node strip *.node
- host: ubuntu-latest # - host: ubuntu-latest
target: x86_64-unknown-linux-musl # target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine # docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: set -e && yarn build && strip *.node # build: set -e && yarn build && strip *.node
- host: macos-latest - host: macos-latest
target: aarch64-apple-darwin target: aarch64-apple-darwin
build: | build: |
yarn build --target aarch64-apple-darwin yarn build --target aarch64-apple-darwin
strip -x *.node strip -x *.node
- host: ubuntu-latest # - host: ubuntu-latest
target: aarch64-unknown-linux-gnu # target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 # docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |- # build: |-
set -e && # set -e &&
yarn build --target aarch64-unknown-linux-gnu && # yarn build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node # aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-latest - host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf target: armv7-unknown-linux-gnueabihf
setup: | setup: |
@@ -74,19 +74,19 @@ jobs:
build: | build: |
yarn build --target aarch64-linux-android yarn build --target aarch64-linux-android
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest # - host: ubuntu-latest
target: armv7-linux-androideabi # target: armv7-linux-androideabi
build: | # build: |
yarn build --target armv7-linux-androideabi # yarn build --target armv7-linux-androideabi
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node # ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
- host: ubuntu-latest # - host: ubuntu-latest
target: aarch64-unknown-linux-musl # target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine # docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |- # build: |-
set -e && # set -e &&
rustup target add aarch64-unknown-linux-musl && # rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl && # yarn build --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node # /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
- host: windows-latest - host: windows-latest
target: aarch64-pc-windows-msvc target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc build: yarn build --target aarch64-pc-windows-msvc
@@ -280,114 +280,114 @@ jobs:
shell: bash shell: bash
- name: Test bindings - name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
test-linux-x64-musl-binding: # test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} # name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs: # needs:
- build # - build
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
node: # node:
- '14' # - '14'
- '16' # - '16'
- '18' # - '18'
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- uses: actions/checkout@v3 # - uses: actions/checkout@v3
- name: Setup node # - name: Setup node
uses: actions/setup-node@v3 # uses: actions/setup-node@v3
with: # with:
node-version: ${{ matrix.node }} # node-version: ${{ matrix.node }}
check-latest: true # check-latest: true
cache: yarn # cache: yarn
- name: Install dependencies # - name: Install dependencies
run: | # run: |
yarn config set supportedArchitectures.libc "musl" # yarn config set supportedArchitectures.libc "musl"
yarn install # yarn install
- name: Download artifacts # - name: Download artifacts
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: bindings-x86_64-unknown-linux-musl # name: bindings-x86_64-unknown-linux-musl
path: . # path: .
- name: List packages # - name: List packages
run: ls -R . # run: ls -R .
shell: bash # shell: bash
- name: Test bindings # - name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test # run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
test-linux-aarch64-gnu-binding: # test-linux-aarch64-gnu-binding:
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} # name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
needs: # needs:
- build # - build
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
node: # node:
- '14' # - '14'
- '16' # - '16'
- '18' # - '18'
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- uses: actions/checkout@v3 # - uses: actions/checkout@v3
- name: Download artifacts # - name: Download artifacts
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: bindings-aarch64-unknown-linux-gnu # name: bindings-aarch64-unknown-linux-gnu
path: . # path: .
- name: List packages # - name: List packages
run: ls -R . # run: ls -R .
shell: bash # shell: bash
- name: Install dependencies # - name: Install dependencies
run: | # run: |
yarn config set supportedArchitectures.cpu "arm64" # yarn config set supportedArchitectures.cpu "arm64"
yarn config set supportedArchitectures.libc "glibc" # yarn config set supportedArchitectures.libc "glibc"
yarn install # yarn install
- name: Set up QEMU # - name: Set up QEMU
uses: docker/setup-qemu-action@v2 # uses: docker/setup-qemu-action@v2
with: # with:
platforms: arm64 # platforms: arm64
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Setup and run tests # - name: Setup and run tests
uses: addnab/docker-run-action@v3 # uses: addnab/docker-run-action@v3
with: # with:
image: node:${{ matrix.node }}-slim # image: node:${{ matrix.node }}-slim
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' # options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
run: | # run: |
set -e # set -e
yarn test # yarn test
ls -la # ls -la
test-linux-aarch64-musl-binding: # test-linux-aarch64-musl-binding:
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }} # name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
needs: # needs:
- build # - build
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- uses: actions/checkout@v3 # - uses: actions/checkout@v3
- name: Download artifacts # - name: Download artifacts
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: bindings-aarch64-unknown-linux-musl # name: bindings-aarch64-unknown-linux-musl
path: . # path: .
- name: List packages # - name: List packages
run: ls -R . # run: ls -R .
shell: bash # shell: bash
- name: Install dependencies # - name: Install dependencies
run: | # run: |
yarn config set supportedArchitectures.cpu "arm64" # yarn config set supportedArchitectures.cpu "arm64"
yarn config set supportedArchitectures.libc "musl" # yarn config set supportedArchitectures.libc "musl"
yarn install # yarn install
- name: Set up QEMU # - name: Set up QEMU
uses: docker/setup-qemu-action@v2 # uses: docker/setup-qemu-action@v2
with: # with:
platforms: arm64 # platforms: arm64
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Setup and run tests # - name: Setup and run tests
uses: addnab/docker-run-action@v3 # uses: addnab/docker-run-action@v3
with: # with:
image: node:lts-alpine # image: node:lts-alpine
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' # options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build'
run: | # run: |
set -e # set -e
yarn test # yarn test
test-linux-arm-gnueabihf-binding: test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
needs: needs:
+5 -5
View File
@@ -76,16 +76,16 @@ Running "OpusEncoder Benchmark" suite...
Progress: 100% Progress: 100%
mediaplex: mediaplex:
3 305 ops/s, ±0.15% | 21.18% slower 3 516 ops/s, ±0.20% | 14.45% slower
@discordjs/opus: @discordjs/opus:
3 174 ops/s, ±0.09% | 24.3% slower 3 155 ops/s, ±0.35% | 23.24% slower
opusscript: opusscript:
4 193 ops/s, ±0.16% | fastest 4 110 ops/s, ±2.18% | fastest
opusscript (no wasm): opusscript (no wasm):
260 ops/s, ±0.55% | slowest, 93.8% slower 256 ops/s, ±0.30% | slowest, 93.77% slower
Finished 4 cases! Finished 4 cases!
Fastest: opusscript Fastest: opusscript
@@ -109,4 +109,4 @@ Progress: 100%
Finished 4 cases! Finished 4 cases!
Fastest: @discordjs/opus Fastest: @discordjs/opus
Slowest: opusscript (no wasm) Slowest: opusscript (no wasm)
``` ```
+17 -2
View File
@@ -2,9 +2,9 @@
extern crate napi_build; extern crate napi_build;
use bindgen;
use std::path::PathBuf; use std::path::PathBuf;
use std::{env, fmt::Display, path::Path}; use std::{env, fmt::Display, path::Path};
use bindgen;
const fn rustc_linking_word(is_static_link: bool) -> &'static str { const fn rustc_linking_word(is_static_link: bool) -> &'static str {
if is_static_link { if is_static_link {
@@ -45,7 +45,22 @@ fn build_opus(is_static: bool) {
); );
println!("cargo:info=Building Opus via CMake."); println!("cargo:info=Building Opus via CMake.");
let opus_build_dir = cmake::build(opus_path);
let mut cmake_config = cmake::Config::new(opus_path);
if let Ok(android_target) = env::var("CARGO_NDK_ANDROID_TARGET") {
cmake_config.define("ANDROID_ABI", android_target);
if let Ok(toolchain_file) = env::var("CARGO_NDK_CMAKE_TOOLCHAIN_PATH") {
cmake_config.define("CMAKE_TOOLCHAIN_FILE", toolchain_file);
}
}
if let Ok(value) = env::var("CMAKE_OSX_SYSROOT") {
cmake_config.configure_arg(format!("-DCMAKE_OSX_SYSROOT={value}"));
}
let opus_build_dir = cmake_config.build();
link_opus(is_static, opus_build_dir.display()) link_opus(is_static, opus_build_dir.display())
} }
-4
View File
@@ -9,14 +9,10 @@
"additional": [ "additional": [
"aarch64-apple-darwin", "aarch64-apple-darwin",
"aarch64-linux-android", "aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc", "aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf", "armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd", "x86_64-unknown-freebsd",
"i686-pc-windows-msvc", "i686-pc-windows-msvc",
"armv7-linux-androideabi",
"universal-apple-darwin" "universal-apple-darwin"
] ]
} }