You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/03/28 05:41:23 UTC

[incubator-opendal] branch main updated: ci(bindings/nodejs): Support aarch64-apple-darwin (#1780)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 24783d23 ci(bindings/nodejs): Support aarch64-apple-darwin (#1780)
24783d23 is described below

commit 24783d2385ff978298535dbf94dc4c302668ce81
Author: Suyan <su...@gmail.com>
AuthorDate: Tue Mar 28 13:41:18 2023 +0800

    ci(bindings/nodejs): Support aarch64-apple-darwin (#1780)
    
    * ci(bindings/nodejs): Support aarch64-apple-darwin
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * macos test only on default arch
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    * reset to build on tag only
    
    Signed-off-by: suyanhanx <su...@gmail.com>
    
    ---------
    
    Signed-off-by: suyanhanx <su...@gmail.com>
---
 .github/workflows/bindings_nodejs.yml         | 27 ++++++++++++++++++++++++---
 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, 52 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/bindings_nodejs.yml b/.github/workflows/bindings_nodejs.yml
index a5d7ac43..4e457f79 100644
--- a/.github/workflows/bindings_nodejs.yml
+++ b/.github/workflows/bindings_nodejs.yml
@@ -144,6 +144,22 @@ jobs:
       matrix:
         node:
           - '18'
+        settings:
+          - target: x86_64-apple-darwin
+            test: yarn test
+            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/')"
 
@@ -152,6 +168,8 @@ jobs:
       run:
         working-directory: "bindings/nodejs"
 
+    name: macos - ${{ matrix.settings.target }}
+
     steps:
       - uses: actions/checkout@v3
       - name: Setup node
@@ -165,13 +183,16 @@ 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
+        if: ${{ matrix.settings.test }}
+        run: ${{ matrix.settings.test }}
+        shell: bash
 
   release:
     name: Release
diff --git a/bindings/nodejs/index.d.ts b/bindings/nodejs/index.d.ts
index 34cdbae3..713f5ddb 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<string, string>
 }
diff --git a/bindings/nodejs/npm/darwin-arm64/README.md b/bindings/nodejs/npm/darwin-arm64/README.md
new file mode 100644
index 00000000..7d907fde
--- /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 00000000..553cb293
--- /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 b416c3d2..6c1f1331 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": [