From 8effefcd75b119bbcb6d503d373fb89a17476df3 Mon Sep 17 00:00:00 2001 From: suyanhanx Date: Mon, 27 Mar 2023 13:26:43 +0800 Subject: [PATCH 1/3] 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": [ From a4b4027eab181f153fada9d40ff30e16fe2728c5 Mon Sep 17 00:00:00 2001 From: suyanhanx Date: Mon, 27 Mar 2023 14:07:35 +0800 Subject: [PATCH 2/3] macos test only on default arch Signed-off-by: suyanhanx --- .github/workflows/bindings_nodejs.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bindings_nodejs.yml b/.github/workflows/bindings_nodejs.yml index f60647d8401..b5190a9092b 100644 --- a/.github/workflows/bindings_nodejs.yml +++ b/.github/workflows/bindings_nodejs.yml @@ -146,6 +146,7 @@ jobs: - '18' settings: - target: x86_64-apple-darwin + test: yarn test build: | yarn build strip -x *.node @@ -189,7 +190,9 @@ jobs: 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 From 6e02f57b125d8ff038441096a4634ada28982555 Mon Sep 17 00:00:00 2001 From: suyanhanx Date: Mon, 27 Mar 2023 14:22:52 +0800 Subject: [PATCH 3/3] reset to build on tag only Signed-off-by: suyanhanx --- .github/workflows/bindings_nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bindings_nodejs.yml b/.github/workflows/bindings_nodejs.yml index b5190a9092b..4e457f794e5 100644 --- a/.github/workflows/bindings_nodejs.yml +++ b/.github/workflows/bindings_nodejs.yml @@ -161,7 +161,7 @@ jobs: 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: