From 5f6ed788997349b9bb824466b344673e86ae4411 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 10 Mar 2023 15:19:20 +0800 Subject: [PATCH 1/4] Fix bindings python Signed-off-by: Xuanwo --- .github/workflows/bindings_python.yml | 47 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/.github/workflows/bindings_python.yml b/.github/workflows/bindings_python.yml index e4101064bb3..46749b030bb 100644 --- a/.github/workflows/bindings_python.yml +++ b/.github/workflows/bindings_python.yml @@ -18,6 +18,8 @@ on: push: branches: - main + tags: + - '*' pull_request: branches: - main @@ -30,6 +32,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true +permissions: + contents: read + jobs: linux: runs-on: ubuntu-latest @@ -57,22 +62,30 @@ jobs: python -m pip install -r test_requirements.txt python -m pytest - # Disable windows until we have test case migrated. - # - # windows: - # runs-on: windows-latest - # steps: - # - uses: actions/checkout@v3 - # - uses: PyO3/maturin-action@v1 - # with: - # working-directory: "bindings/python" - # command: build - # args: --release -o dist --find-interpreter - # - name: Upload wheels - # uses: actions/upload-artifact@v3 - # with: - # name: wheels - # path: bindings/python/dist + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: PyO3/maturin-action@v1 + with: + working-directory: "bindings/python" + command: build + args: --release -o dist --find-interpreter + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: bindings/python/dist + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Run pytest + working-directory: "bindings/python" + run: | + set -e + python -m pip install opendal --find-links dist + python -m pip install -r test_requirements.txt + python -m pytest macos: runs-on: macos-latest @@ -103,7 +116,7 @@ jobs: name: Release runs-on: ubuntu-latest if: "startsWith(github.ref, 'refs/tags/')" - needs: [macos, linux] + needs: [macos, linux, windows] steps: - uses: actions/download-artifact@v3 with: From 2a6c522690cc69326974412617e1d65dcb0550b7 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 10 Mar 2023 15:41:22 +0800 Subject: [PATCH 2/4] Remove not support platforms Signed-off-by: Xuanwo --- .github/workflows/ci.yml | 6 +-- .github/workflows/publish.yml | 52 +++++++++++++++++++ .../nodejs/npm/android-arm-eabi/README.md | 3 -- .../nodejs/npm/android-arm-eabi/package.json | 18 ------- bindings/nodejs/npm/android-arm64/README.md | 3 -- .../nodejs/npm/android-arm64/package.json | 18 ------- bindings/nodejs/npm/darwin-arm64/README.md | 3 -- bindings/nodejs/npm/darwin-arm64/package.json | 18 ------- .../nodejs/npm/darwin-universal/README.md | 3 -- .../nodejs/npm/darwin-universal/package.json | 15 ------ bindings/nodejs/npm/darwin-x64/README.md | 3 -- bindings/nodejs/npm/darwin-x64/package.json | 2 +- bindings/nodejs/npm/freebsd-x64/README.md | 3 -- bindings/nodejs/npm/freebsd-x64/package.json | 18 ------- .../nodejs/npm/linux-arm-gnueabihf/README.md | 3 -- .../npm/linux-arm-gnueabihf/package.json | 18 ------- bindings/nodejs/npm/linux-arm64-gnu/README.md | 3 -- .../nodejs/npm/linux-arm64-gnu/package.json | 21 -------- .../nodejs/npm/linux-arm64-musl/README.md | 3 -- .../nodejs/npm/linux-arm64-musl/package.json | 21 -------- bindings/nodejs/npm/linux-x64-gnu/README.md | 3 -- .../nodejs/npm/linux-x64-gnu/package.json | 2 +- bindings/nodejs/npm/linux-x64-musl/README.md | 3 -- .../nodejs/npm/linux-x64-musl/package.json | 21 -------- .../nodejs/npm/win32-arm64-msvc/README.md | 3 -- .../nodejs/npm/win32-arm64-msvc/package.json | 18 ------- bindings/nodejs/npm/win32-ia32-msvc/README.md | 3 -- .../nodejs/npm/win32-ia32-msvc/package.json | 18 ------- bindings/nodejs/npm/win32-x64-msvc/README.md | 3 -- .../nodejs/npm/win32-x64-msvc/package.json | 2 +- bindings/nodejs/package.json | 12 +---- 31 files changed, 57 insertions(+), 265 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 bindings/nodejs/npm/android-arm-eabi/README.md delete mode 100644 bindings/nodejs/npm/android-arm-eabi/package.json delete mode 100644 bindings/nodejs/npm/android-arm64/README.md delete mode 100644 bindings/nodejs/npm/android-arm64/package.json delete mode 100644 bindings/nodejs/npm/darwin-arm64/README.md delete mode 100644 bindings/nodejs/npm/darwin-arm64/package.json delete mode 100644 bindings/nodejs/npm/darwin-universal/README.md delete mode 100644 bindings/nodejs/npm/darwin-universal/package.json delete mode 100644 bindings/nodejs/npm/darwin-x64/README.md delete mode 100644 bindings/nodejs/npm/freebsd-x64/README.md delete mode 100644 bindings/nodejs/npm/freebsd-x64/package.json delete mode 100644 bindings/nodejs/npm/linux-arm-gnueabihf/README.md delete mode 100644 bindings/nodejs/npm/linux-arm-gnueabihf/package.json delete mode 100644 bindings/nodejs/npm/linux-arm64-gnu/README.md delete mode 100644 bindings/nodejs/npm/linux-arm64-gnu/package.json delete mode 100644 bindings/nodejs/npm/linux-arm64-musl/README.md delete mode 100644 bindings/nodejs/npm/linux-arm64-musl/package.json delete mode 100644 bindings/nodejs/npm/linux-x64-gnu/README.md delete mode 100644 bindings/nodejs/npm/linux-x64-musl/README.md delete mode 100644 bindings/nodejs/npm/linux-x64-musl/package.json delete mode 100644 bindings/nodejs/npm/win32-arm64-msvc/README.md delete mode 100644 bindings/nodejs/npm/win32-arm64-msvc/package.json delete mode 100644 bindings/nodejs/npm/win32-ia32-msvc/README.md delete mode 100644 bindings/nodejs/npm/win32-ia32-msvc/package.json delete mode 100644 bindings/nodejs/npm/win32-x64-msvc/README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cd46eb5ad1..897c8a088ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,11 +143,7 @@ jobs: run: cargo build --all-features unit: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Checkout python env diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000000..7b29da76359 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,52 @@ +# Copyright 2022 Datafuse Labs +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Checkout python env + uses: actions/setup-python@v4 + with: + python-version: "3.8" + - name: Checkout java env + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: "11" + - name: Setup-hdfs env + uses: beyondstorage/setup-hdfs@master + with: + hdfs-version: "3.3.2" + + - uses: Swatinem/rust-cache@v2 + + - name: Publish opendal + run: cargo publish --all-features + env: + LD_LIBRARY_PATH: ${{ env.JAVA_HOME }}/lib/server:${{ env.LD_LIBRARY_PATH }} + + - name: Publish object_store_opendal + run: cargo publish + working-directory: "bindings/object_store" + env: + LD_LIBRARY_PATH: ${{ env.JAVA_HOME }}/lib/server:${{ env.LD_LIBRARY_PATH }} diff --git a/bindings/nodejs/npm/android-arm-eabi/README.md b/bindings/nodejs/npm/android-arm-eabi/README.md deleted file mode 100644 index 701a372c7fd..00000000000 --- a/bindings/nodejs/npm/android-arm-eabi/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-android-arm-eabi` - -This is the **armv7-linux-androideabi** binary for `opendal` diff --git a/bindings/nodejs/npm/android-arm-eabi/package.json b/bindings/nodejs/npm/android-arm-eabi/package.json deleted file mode 100644 index 7d16d15df63..00000000000 --- a/bindings/nodejs/npm/android-arm-eabi/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-android-arm-eabi", - "version": "0.0.0", - "os": [ - "android" - ], - "cpu": [ - "arm" - ], - "main": "opendal.android-arm-eabi.node", - "files": [ - "opendal.android-arm-eabi.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/android-arm64/README.md b/bindings/nodejs/npm/android-arm64/README.md deleted file mode 100644 index b95639e1939..00000000000 --- a/bindings/nodejs/npm/android-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-android-arm64` - -This is the **aarch64-linux-android** binary for `opendal` diff --git a/bindings/nodejs/npm/android-arm64/package.json b/bindings/nodejs/npm/android-arm64/package.json deleted file mode 100644 index 7558ff6f3e1..00000000000 --- a/bindings/nodejs/npm/android-arm64/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-android-arm64", - "version": "0.0.0", - "os": [ - "android" - ], - "cpu": [ - "arm64" - ], - "main": "opendal.android-arm64.node", - "files": [ - "opendal.android-arm64.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/darwin-arm64/README.md b/bindings/nodejs/npm/darwin-arm64/README.md deleted file mode 100644 index 0fe527fb0d3..00000000000 --- a/bindings/nodejs/npm/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `opendal` diff --git a/bindings/nodejs/npm/darwin-arm64/package.json b/bindings/nodejs/npm/darwin-arm64/package.json deleted file mode 100644 index 8d7bff940c9..00000000000 --- a/bindings/nodejs/npm/darwin-arm64/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-darwin-arm64", - "version": "0.0.0", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "main": "opendal.darwin-arm64.node", - "files": [ - "opendal.darwin-arm64.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/darwin-universal/README.md b/bindings/nodejs/npm/darwin-universal/README.md deleted file mode 100644 index b34c82c5ef2..00000000000 --- a/bindings/nodejs/npm/darwin-universal/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-darwin-universal` - -This is the **universal-apple-darwin** binary for `opendal` diff --git a/bindings/nodejs/npm/darwin-universal/package.json b/bindings/nodejs/npm/darwin-universal/package.json deleted file mode 100644 index 1d71032d15a..00000000000 --- a/bindings/nodejs/npm/darwin-universal/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "opendal-darwin-universal", - "version": "0.0.0", - "os": [ - "darwin" - ], - "main": "opendal.darwin-universal.node", - "files": [ - "opendal.darwin-universal.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/darwin-x64/README.md b/bindings/nodejs/npm/darwin-x64/README.md deleted file mode 100644 index 5276140b182..00000000000 --- a/bindings/nodejs/npm/darwin-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-darwin-x64` - -This is the **x86_64-apple-darwin** binary for `opendal` diff --git a/bindings/nodejs/npm/darwin-x64/package.json b/bindings/nodejs/npm/darwin-x64/package.json index 58251f88f8a..55e39ad80a2 100644 --- a/bindings/nodejs/npm/darwin-x64/package.json +++ b/bindings/nodejs/npm/darwin-x64/package.json @@ -15,4 +15,4 @@ "engines": { "node": ">= 10" } -} \ No newline at end of file +} diff --git a/bindings/nodejs/npm/freebsd-x64/README.md b/bindings/nodejs/npm/freebsd-x64/README.md deleted file mode 100644 index 4ae9759dae5..00000000000 --- a/bindings/nodejs/npm/freebsd-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-freebsd-x64` - -This is the **x86_64-unknown-freebsd** binary for `opendal` diff --git a/bindings/nodejs/npm/freebsd-x64/package.json b/bindings/nodejs/npm/freebsd-x64/package.json deleted file mode 100644 index 6349ad08343..00000000000 --- a/bindings/nodejs/npm/freebsd-x64/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-freebsd-x64", - "version": "0.0.0", - "os": [ - "freebsd" - ], - "cpu": [ - "x64" - ], - "main": "opendal.freebsd-x64.node", - "files": [ - "opendal.freebsd-x64.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/linux-arm-gnueabihf/README.md b/bindings/nodejs/npm/linux-arm-gnueabihf/README.md deleted file mode 100644 index f63610db3c9..00000000000 --- a/bindings/nodejs/npm/linux-arm-gnueabihf/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-linux-arm-gnueabihf` - -This is the **armv7-unknown-linux-gnueabihf** binary for `opendal` diff --git a/bindings/nodejs/npm/linux-arm-gnueabihf/package.json b/bindings/nodejs/npm/linux-arm-gnueabihf/package.json deleted file mode 100644 index 53533d51324..00000000000 --- a/bindings/nodejs/npm/linux-arm-gnueabihf/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-linux-arm-gnueabihf", - "version": "0.0.0", - "os": [ - "linux" - ], - "cpu": [ - "arm" - ], - "main": "opendal.linux-arm-gnueabihf.node", - "files": [ - "opendal.linux-arm-gnueabihf.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/linux-arm64-gnu/README.md b/bindings/nodejs/npm/linux-arm64-gnu/README.md deleted file mode 100644 index a0cec16f8fe..00000000000 --- a/bindings/nodejs/npm/linux-arm64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-linux-arm64-gnu` - -This is the **aarch64-unknown-linux-gnu** binary for `opendal` diff --git a/bindings/nodejs/npm/linux-arm64-gnu/package.json b/bindings/nodejs/npm/linux-arm64-gnu/package.json deleted file mode 100644 index 21db3d72efc..00000000000 --- a/bindings/nodejs/npm/linux-arm64-gnu/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "opendal-linux-arm64-gnu", - "version": "0.0.0", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "opendal.linux-arm64-gnu.node", - "files": [ - "opendal.linux-arm64-gnu.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "libc": [ - "glibc" - ] -} \ No newline at end of file diff --git a/bindings/nodejs/npm/linux-arm64-musl/README.md b/bindings/nodejs/npm/linux-arm64-musl/README.md deleted file mode 100644 index aa6112e8a12..00000000000 --- a/bindings/nodejs/npm/linux-arm64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-linux-arm64-musl` - -This is the **aarch64-unknown-linux-musl** binary for `opendal` diff --git a/bindings/nodejs/npm/linux-arm64-musl/package.json b/bindings/nodejs/npm/linux-arm64-musl/package.json deleted file mode 100644 index fd14299b727..00000000000 --- a/bindings/nodejs/npm/linux-arm64-musl/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "opendal-linux-arm64-musl", - "version": "0.0.0", - "os": [ - "linux" - ], - "cpu": [ - "arm64" - ], - "main": "opendal.linux-arm64-musl.node", - "files": [ - "opendal.linux-arm64-musl.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "libc": [ - "musl" - ] -} \ No newline at end of file diff --git a/bindings/nodejs/npm/linux-x64-gnu/README.md b/bindings/nodejs/npm/linux-x64-gnu/README.md deleted file mode 100644 index 80e36ad10b7..00000000000 --- a/bindings/nodejs/npm/linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `opendal` diff --git a/bindings/nodejs/npm/linux-x64-gnu/package.json b/bindings/nodejs/npm/linux-x64-gnu/package.json index 26754e56607..76aad853f99 100644 --- a/bindings/nodejs/npm/linux-x64-gnu/package.json +++ b/bindings/nodejs/npm/linux-x64-gnu/package.json @@ -18,4 +18,4 @@ "libc": [ "glibc" ] -} \ No newline at end of file +} diff --git a/bindings/nodejs/npm/linux-x64-musl/README.md b/bindings/nodejs/npm/linux-x64-musl/README.md deleted file mode 100644 index 83fa3b35b89..00000000000 --- a/bindings/nodejs/npm/linux-x64-musl/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-linux-x64-musl` - -This is the **x86_64-unknown-linux-musl** binary for `opendal` diff --git a/bindings/nodejs/npm/linux-x64-musl/package.json b/bindings/nodejs/npm/linux-x64-musl/package.json deleted file mode 100644 index 158bf951b78..00000000000 --- a/bindings/nodejs/npm/linux-x64-musl/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "opendal-linux-x64-musl", - "version": "0.0.0", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "main": "opendal.linux-x64-musl.node", - "files": [ - "opendal.linux-x64-musl.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - }, - "libc": [ - "musl" - ] -} \ No newline at end of file diff --git a/bindings/nodejs/npm/win32-arm64-msvc/README.md b/bindings/nodejs/npm/win32-arm64-msvc/README.md deleted file mode 100644 index 14e1b015a6a..00000000000 --- a/bindings/nodejs/npm/win32-arm64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-win32-arm64-msvc` - -This is the **aarch64-pc-windows-msvc** binary for `opendal` diff --git a/bindings/nodejs/npm/win32-arm64-msvc/package.json b/bindings/nodejs/npm/win32-arm64-msvc/package.json deleted file mode 100644 index ee5f494e891..00000000000 --- a/bindings/nodejs/npm/win32-arm64-msvc/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-win32-arm64-msvc", - "version": "0.0.0", - "os": [ - "win32" - ], - "cpu": [ - "arm64" - ], - "main": "opendal.win32-arm64-msvc.node", - "files": [ - "opendal.win32-arm64-msvc.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/win32-ia32-msvc/README.md b/bindings/nodejs/npm/win32-ia32-msvc/README.md deleted file mode 100644 index f9975ec17f8..00000000000 --- a/bindings/nodejs/npm/win32-ia32-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-win32-ia32-msvc` - -This is the **i686-pc-windows-msvc** binary for `opendal` diff --git a/bindings/nodejs/npm/win32-ia32-msvc/package.json b/bindings/nodejs/npm/win32-ia32-msvc/package.json deleted file mode 100644 index 586ee801375..00000000000 --- a/bindings/nodejs/npm/win32-ia32-msvc/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "opendal-win32-ia32-msvc", - "version": "0.0.0", - "os": [ - "win32" - ], - "cpu": [ - "ia32" - ], - "main": "opendal.win32-ia32-msvc.node", - "files": [ - "opendal.win32-ia32-msvc.node" - ], - "license": "MIT", - "engines": { - "node": ">= 10" - } -} \ No newline at end of file diff --git a/bindings/nodejs/npm/win32-x64-msvc/README.md b/bindings/nodejs/npm/win32-x64-msvc/README.md deleted file mode 100644 index 3e49c4c15e6..00000000000 --- a/bindings/nodejs/npm/win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `opendal-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `opendal` diff --git a/bindings/nodejs/npm/win32-x64-msvc/package.json b/bindings/nodejs/npm/win32-x64-msvc/package.json index 6d5a3add02b..9f4d8e23f25 100644 --- a/bindings/nodejs/npm/win32-x64-msvc/package.json +++ b/bindings/nodejs/npm/win32-x64-msvc/package.json @@ -15,4 +15,4 @@ "engines": { "node": ">= 10" } -} \ No newline at end of file +} diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index 02ab848a30e..976e0bd0b7e 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -7,16 +7,7 @@ "description": "Open Data Access Layer: Access data freely, painlessly, and efficiently", "repository": "git@github.com/datafuselabs/opendal.git", "napi": { - "name": "opendal", - "triples": { - "additional": [ - "aarch64-apple-darwin", - "aarch64-unknown-linux-gnu", - "aarch64-pc-windows-msvc", - "armv7-unknown-linux-gnueabihf", - "universal-apple-darwin" - ] - } + "name": "opendal" }, "files": [ "index.d.ts", @@ -54,7 +45,6 @@ "build:debug": "napi build --platform --js generated.js", "prepublishOnly": "napi prepublish -t npm", "test": "ava", - "universal": "napi universal", "version": "napi version" }, "packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f" From d865a7081a5d76abdcbba26cf8b5d45341233701 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 10 Mar 2023 16:02:21 +0800 Subject: [PATCH 3/4] ci: Polish scripts and prepare for releasing Signed-off-by: Xuanwo --- .github/workflows/bindings_nodejs.yml | 119 +++++++++++++++++- bindings/nodejs/npm/darwin-x64/package.json | 4 +- .../nodejs/npm/linux-x64-gnu/package.json | 4 +- .../nodejs/npm/win32-x64-msvc/package.json | 4 +- bindings/nodejs/package.json | 9 +- 5 files changed, 129 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bindings_nodejs.yml b/.github/workflows/bindings_nodejs.yml index 9fb3904fbde..8fb3aab7e1a 100644 --- a/.github/workflows/bindings_nodejs.yml +++ b/.github/workflows/bindings_nodejs.yml @@ -13,9 +13,9 @@ # limitations under the License. name: Binding NodeJS CI + env: DEBUG: napi:* - APP_NAME: opendal MACOSX_DEPLOYMENT_TARGET: '10.13' on: @@ -31,8 +31,7 @@ on: workflow_dispatch: jobs: - test: - name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} + linux: strategy: fail-fast: false matrix: @@ -59,5 +58,119 @@ jobs: run: yarn install - name: Build run: yarn build + - uses: actions/upload-artifact@v3 + with: + name: bindings-linux + path: bindings/nodejs/*.node + - name: Test bindings + run: yarn test + + windows: + strategy: + fail-fast: false + matrix: + node: + - '18' + runs-on: windows-latest + + # Notes: this defaults only apply on run tasks. + defaults: + run: + working-directory: "bindings/nodejs" + + steps: + - uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: yarn + cache-dependency-path: "bindings/nodejs/yarn.lock" + - name: Corepack + run: corepack enable + - name: Install dependencies + run: yarn install + - name: Build + run: yarn build + - uses: actions/upload-artifact@v3 + with: + name: bindings-windows + path: bindings/nodejs/*.node - name: Test bindings run: yarn test + + macos: + strategy: + fail-fast: false + matrix: + node: + - '18' + runs-on: macos-latest + + # Notes: this defaults only apply on run tasks. + defaults: + run: + working-directory: "bindings/nodejs" + + steps: + - uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: yarn + cache-dependency-path: "bindings/nodejs/yarn.lock" + - name: Corepack + run: corepack enable + - name: Install dependencies + run: yarn install + - name: Build + run: yarn build + - uses: actions/upload-artifact@v3 + with: + name: bindings-macos + path: bindings/nodejs/*.node + - name: Test bindings + run: yarn test + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [macos, linux, windows] + + # Notes: this defaults only apply on run tasks. + defaults: + run: + working-directory: "bindings/nodejs" + + steps: + - uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: yarn + cache-dependency-path: "bindings/nodejs/yarn.lock" + - name: Corepack + run: corepack enable + - name: Install dependencies + run: yarn install + + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: bindings/nodejs/artifacts + - name: Move artifacts + run: yarn artifacts + + - name: List packages + run: ls -R ./npm + shell: bash + - name: Publish + run: | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --access public + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/bindings/nodejs/npm/darwin-x64/package.json b/bindings/nodejs/npm/darwin-x64/package.json index 55e39ad80a2..7c401be1b90 100644 --- a/bindings/nodejs/npm/darwin-x64/package.json +++ b/bindings/nodejs/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "opendal-darwin-x64", - "version": "0.0.0", + "version": "0.0.1", "os": [ "darwin" ], @@ -15,4 +15,4 @@ "engines": { "node": ">= 10" } -} +} \ No newline at end of file diff --git a/bindings/nodejs/npm/linux-x64-gnu/package.json b/bindings/nodejs/npm/linux-x64-gnu/package.json index 76aad853f99..36ed7b50043 100644 --- a/bindings/nodejs/npm/linux-x64-gnu/package.json +++ b/bindings/nodejs/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "opendal-linux-x64-gnu", - "version": "0.0.0", + "version": "0.0.1", "os": [ "linux" ], @@ -18,4 +18,4 @@ "libc": [ "glibc" ] -} +} \ No newline at end of file diff --git a/bindings/nodejs/npm/win32-x64-msvc/package.json b/bindings/nodejs/npm/win32-x64-msvc/package.json index 9f4d8e23f25..388785bfa91 100644 --- a/bindings/nodejs/npm/win32-x64-msvc/package.json +++ b/bindings/nodejs/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "opendal-win32-x64-msvc", - "version": "0.0.0", + "version": "0.0.1", "os": [ "win32" ], @@ -15,4 +15,4 @@ "engines": { "node": ">= 10" } -} +} \ No newline at end of file diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index 976e0bd0b7e..495b11c441c 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -47,5 +47,10 @@ "test": "ava", "version": "napi version" }, - "packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f" -} + "packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f", + "optionalDependencies": { + "opendal-win32-x64-msvc": "0.0.1", + "opendal-darwin-x64": "0.0.1", + "opendal-linux-x64-gnu": "0.0.1" + } +} \ No newline at end of file From a510e59fc0dfe92f3f835ad26b42ad26c864ac85 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 10 Mar 2023 16:09:13 +0800 Subject: [PATCH 4/4] Don't commit optional deps Signed-off-by: Xuanwo --- bindings/nodejs/package.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bindings/nodejs/package.json b/bindings/nodejs/package.json index 495b11c441c..976e0bd0b7e 100644 --- a/bindings/nodejs/package.json +++ b/bindings/nodejs/package.json @@ -47,10 +47,5 @@ "test": "ava", "version": "napi version" }, - "packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f", - "optionalDependencies": { - "opendal-win32-x64-msvc": "0.0.1", - "opendal-darwin-x64": "0.0.1", - "opendal-linux-x64-gnu": "0.0.1" - } -} \ No newline at end of file + "packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f" +}