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

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 362fcdfc7b Actually run wasm test in ci (#15595)
362fcdfc7b is described below

commit 362fcdfc7b9e00cb6126a0cbc41c9abb2637c563
Author: Xiangpeng Hao <[email protected]>
AuthorDate: Sun Apr 6 14:06:27 2025 -0400

    Actually run wasm test in ci (#15595)
    
    * actually run test in ci
    
    * tweak ci
    
    * try ci again
    
    * try ci again
    
    * try ci again
    
    * setup debug
    
    * update
    
    * try again
    
    * update ci
    
    * install jq
    
    * update ci
    
    * fix ci
    
    * update
    
    * update
    
    * try again
    
    * Update .github/workflows/rust.yml
    
    Co-authored-by: Andrew Lamb <[email protected]>
    
    ---------
    
    Co-authored-by: Andrew Lamb <[email protected]>
---
 .github/workflows/rust.yml         | 28 ++++++++++++++--------------
 datafusion/wasmtest/README.md      |  2 --
 datafusion/wasmtest/src/lib.rs     | 28 ++++++++++++++--------------
 datafusion/wasmtest/webdriver.json | 15 +++++++++++++++
 4 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 1e6cd97ace..3fa8ce0804 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -384,25 +384,25 @@ jobs:
         run: ci/scripts/rust_docs.sh
 
   linux-wasm-pack:
-    name: build with wasm-pack
-    runs-on: ubuntu-latest
-    container:
-      image: amd64/rust
+    name: build and run with wasm-pack
+    runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v4
-      - name: Setup Rust toolchain
-        uses: ./.github/actions/setup-builder
-        with:
-          rust-version: stable
+      - name: Setup for wasm32
+        run: |
+          rustup target add wasm32-unknown-unknown
       - name: Install dependencies
         run: |
-          apt-get update -qq
-          apt-get install -y -qq clang
-      - name: Install wasm-pack
-        run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf 
| sh
-      - name: Build with wasm-pack
+          sudo apt-get update -qq
+          sudo apt-get install -y -qq clang
+      - name: Setup wasm-pack
+        run: |
+          cargo install wasm-pack
+      - name: Run tests with headless mode
         working-directory: ./datafusion/wasmtest
-        run: wasm-pack build --dev
+        run: |
+          wasm-pack test --headless --firefox
+          wasm-pack test --headless --chrome --chromedriver 
$CHROMEWEBDRIVER/chromedriver
 
   # verify that the benchmark queries return the correct results
   verify-benchmark-results:
diff --git a/datafusion/wasmtest/README.md b/datafusion/wasmtest/README.md
index 8843eed697..70f4daef91 100644
--- a/datafusion/wasmtest/README.md
+++ b/datafusion/wasmtest/README.md
@@ -71,8 +71,6 @@ wasm-pack test --headless --chrome
 wasm-pack test --headless --safari
 ```
 
-**Note:** In GitHub Actions we test the compilation with `wasm-build`, but we 
don't currently invoke `wasm-pack test`. This is because the headless mode is 
not yet working. Document of adding a GitHub Action job: 
https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/continuous-integration.html#github-actions.
-
 To tweak timeout setting, use `WASM_BINDGEN_TEST_TIMEOUT` environment 
variable. E.g., `WASM_BINDGEN_TEST_TIMEOUT=300 wasm-pack test --firefox 
--headless`.
 
 ## Compatibility
diff --git a/datafusion/wasmtest/src/lib.rs b/datafusion/wasmtest/src/lib.rs
index 6c7be9056e..0a7e546b4b 100644
--- a/datafusion/wasmtest/src/lib.rs
+++ b/datafusion/wasmtest/src/lib.rs
@@ -82,7 +82,6 @@ pub fn basic_parse() {
 #[cfg(test)]
 mod test {
     use super::*;
-    use datafusion::execution::options::ParquetReadOptions;
     use datafusion::{
         arrow::{
             array::{ArrayRef, Int32Array, RecordBatch, StringArray},
@@ -98,7 +97,6 @@ mod test {
     };
     use datafusion_physical_plan::collect;
     use datafusion_sql::parser::DFParser;
-    use insta::assert_snapshot;
     use object_store::{memory::InMemory, path::Path, ObjectStore};
     use url::Url;
     use wasm_bindgen_test::wasm_bindgen_test;
@@ -240,22 +238,24 @@ mod test {
 
         let url = Url::parse("memory://").unwrap();
         session_ctx.register_object_store(&url, Arc::new(store));
-
-        let df = session_ctx
-            .read_parquet("memory:///", ParquetReadOptions::new())
+        session_ctx
+            .register_parquet("a", "memory:///a.parquet", Default::default())
             .await
             .unwrap();
 
+        let df = session_ctx.sql("SELECT * FROM a").await.unwrap();
+
         let result = df.collect().await.unwrap();
 
-        assert_snapshot!(batches_to_string(&result), @r"
-        +----+-------+
-        | id | value |
-        +----+-------+
-        | 1  | a     |
-        | 2  | b     |
-        | 3  | c     |
-        +----+-------+
-        ");
+        assert_eq!(
+            batches_to_string(&result),
+            "+----+-------+\n\
+             | id | value |\n\
+             +----+-------+\n\
+             | 1  | a     |\n\
+             | 2  | b     |\n\
+             | 3  | c     |\n\
+             +----+-------+"
+        );
     }
 }
diff --git a/datafusion/wasmtest/webdriver.json 
b/datafusion/wasmtest/webdriver.json
new file mode 100644
index 0000000000..f59a2be995
--- /dev/null
+++ b/datafusion/wasmtest/webdriver.json
@@ -0,0 +1,15 @@
+{
+       "moz:firefoxOptions": {
+               "prefs": {
+                       "media.navigator.streams.fake": true,
+                       "media.navigator.permission.disabled": true
+               },
+               "args": []
+       },
+       "goog:chromeOptions": {
+               "args": [
+                       "--use-fake-device-for-media-stream",
+                       "--use-fake-ui-for-media-stream"
+               ]
+       }
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to