From 8effefcd75b119bbcb6d503d373fb89a17476df3 Mon Sep 17 00:00:00 2001 From: suyanhanx Date: Mon, 27 Mar 2023 13:26:43 +0800 Subject: [PATCH] ci(bindings/nodejs): Support aarch64-apple-darwin Signed-off-by: suyanhanx --- .github/workflows/bindings_nodejs.yml | 24 ++++++++++++++++--- bindings/nodejs/index.d.ts | 2 +- bindings/nodejs/npm/darwin-arm64/README.md | 3 +++ bindings/nodejs/npm/darwin-arm64/package.json | 18 ++++++++++++++ bindings/nodejs/package.json | 6 +++++ 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 bindings/nodejs/npm/darwin-arm64/README.md create mode 100644 bindings/nodejs/npm/darwin-arm64/package.json diff --git a/.github/workflows/bindings_nodejs.yml b/.github/workflows/bindings_nodejs.yml index a5d7ac438ec..f60647d8401 100644 --- a/.github/workflows/bindings_nodejs.yml +++ b/.github/workflows/bindings_nodejs.yml @@ -144,14 +144,31 @@ jobs: matrix: node: - '18' + settings: + - target: x86_64-apple-darwin + build: | + yarn build + strip -x *.node + - target: aarch64-apple-darwin + build: | + sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; + export CC=$(xcrun -f clang); + export CXX=$(xcrun -f clang++); + SYSROOT=$(xcrun --sdk macosx --show-sdk-path); + export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; + rustup target add aarch64-apple-darwin; + yarn build --target aarch64-apple-darwin + strip -x *.node runs-on: macos-latest - if: "startsWith(github.ref, 'refs/tags/')" +# if: "startsWith(github.ref, 'refs/tags/')" # Notes: this defaults only apply on run tasks. defaults: run: working-directory: "bindings/nodejs" + name: macos - ${{ matrix.settings.target }} + steps: - uses: actions/checkout@v3 - name: Setup node @@ -165,10 +182,11 @@ jobs: - name: Install dependencies run: yarn install - name: Build - run: yarn build + run: ${{ matrix.settings.build }} + shell: bash - uses: actions/upload-artifact@v3 with: - name: bindings-macos + name: bindings-macos-${{ matrix.settings.target }} path: bindings/nodejs/*.node - name: Test bindings run: yarn test diff --git a/bindings/nodejs/index.d.ts b/bindings/nodejs/index.d.ts index 34cdbae3f8e..713f5ddbc09 100644 --- a/bindings/nodejs/index.d.ts +++ b/bindings/nodejs/index.d.ts @@ -127,7 +127,7 @@ export class PresignedRequest { /** * Returns the headers of this request. * - * The key of the map is the header name, and the value is the header value AS bytes. + * The key of the map is the header name, and the value is the header value. */ headers(): Record } diff --git a/bindings/nodejs/npm/darwin-arm64/README.md b/bindings/nodejs/npm/darwin-arm64/README.md new file mode 100644 index 00000000000..7d907fdedb8 --- /dev/null +++ b/bindings/nodejs/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `@opendal/lib-darwin-arm64` + +This is the **aarch86_64-apple-darwin** binary for `opendal` diff --git a/bindings/nodejs/npm/darwin-arm64/package.json b/bindings/nodejs/npm/darwin-arm64/package.json new file mode 100644 index 00000000000..553cb293e77 --- /dev/null +++ b/bindings/nodejs/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@opendal/lib-darwin-arm64", + "version": "0.30.4", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "opendal.darwin-arm64.node", + "files": [ + "opendal.darwin-arm64.node" + ], + "license": "Apache-2.0", + "engines": { + "node": ">= 10" + } +} diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index b416c3d2152..6c1f13318de 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -11,6 +11,12 @@ "name": "opendal", "package": { "name": "@opendal/lib" + }, + "triples": { + "defaults": true, + "additional": [ + "aarch64-apple-darwin" + ] } }, "keywords": [