You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by ma...@apache.org on 2023/12/24 14:16:19 UTC

(incubator-opendal) branch manjusaka/support-wasm-test created (now 3fbb415df)

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

manjusaka pushed a change to branch manjusaka/support-wasm-test
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


      at 3fbb415df ci: Support CI test for s3_read_on_wasm

This branch includes the following new commits:

     new 3fbb415df ci: Support CI test for s3_read_on_wasm

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-opendal) 01/01: ci: Support CI test for s3_read_on_wasm

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

manjusaka pushed a commit to branch manjusaka/support-wasm-test
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 3fbb415df851bf90db992eea4ea011a807232304
Author: Manjusaka <me...@manjusaka.me>
AuthorDate: Sun Dec 24 22:16:05 2023 +0800

    ci: Support CI test for s3_read_on_wasm
    
    Signed-off-by: Manjusaka <me...@manjusaka.me>
---
 .github/workflows/edge_test.yml      | 54 ++++++++++++++++++++++++++++++++++++
 core/edge/s3_read_on_wasm/src/lib.rs |  4 +--
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/edge_test.yml b/.github/workflows/edge_test.yml
index 1d89afccb..d5c8107d8 100644
--- a/.github/workflows/edge_test.yml
+++ b/.github/workflows/edge_test.yml
@@ -58,3 +58,57 @@ jobs:
         env:
           OPENDAL_FS_ROOT: /tmp/test_dir
 
+  test_wasm_action:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+
+      - name: Setup for wasm32
+        run: |
+          rustup target add wasm32-unknown-unknown
+
+      - name: Install Chrome Environment
+        run: |
+          wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
+          echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list
+          sudo apt-get update -qqy
+          sudo apt-get -qqy install google-chrome-stable
+          CHROME_VERSION=$(google-chrome-stable --version)
+          CHROME_FULL_VERSION=${CHROME_VERSION%%.*}
+          CHROME_MAJOR_VERSION=${CHROME_FULL_VERSION//[!0-9]}
+          sudo rm /etc/apt/sources.list.d/google-chrome.list
+          export CHROMEDRIVER_VERSION=`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION%%.*}`
+          curl -L -O "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
+          unzip chromedriver_linux64.zip && chmod +x chromedriver && sudo mv chromedriver /usr/local/bin
+          export CHROMEDRIVER_VERSION=`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION%%.*}`
+          curl -L -O "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
+          unzip chromedriver_linux64.zip && chmod +x chromedriver && sudo mv chromedriver /usr/local/bin
+          chromedriver -version
+          which chromedriver
+          which google-chrome
+      
+      - name: Setup wasm-pack
+        run: |
+          cargo install wasm-pack
+
+      - name: Setup MinIO Server
+        shell: bash
+        working-directory: fixtures/s3
+        run: docker compose -f docker-compose-minio.yml up -d --wait
+
+      - name: Setup test bucket
+        shell: bash
+        env:
+          AWS_ACCESS_KEY_ID: "minioadmin"
+          AWS_SECRET_ACCESS_KEY: "minioadmin"
+          AWS_EC2_METADATA_DISABLED: "true"
+        run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
+      
+      - name: Test wasm
+        working-directory: core/edge/s3_read_on_wasm
+        run: |
+          wasm-pack build --target web --out-name wasm --out-dir ./static
\ No newline at end of file
diff --git a/core/edge/s3_read_on_wasm/src/lib.rs b/core/edge/s3_read_on_wasm/src/lib.rs
index cdb185a94..4e8ea7f36 100644
--- a/core/edge/s3_read_on_wasm/src/lib.rs
+++ b/core/edge/s3_read_on_wasm/src/lib.rs
@@ -22,10 +22,10 @@ use wasm_bindgen::prelude::*;
 #[wasm_bindgen]
 pub async fn hello_world() -> String {
     let mut cfg = S3::default();
-    cfg.endpoint("http://127.0.0.1:9900");
+    cfg.endpoint("http://127.0.0.1:9000");
     cfg.access_key_id("minioadmin");
     cfg.secret_access_key("minioadmin");
-    cfg.bucket("opendal");
+    cfg.bucket("test");
     cfg.region("us-east-1");
 
     let op = Operator::new(cfg).unwrap().finish();