Skip to content

Commit 362fcdf

Browse files
XiangpengHaoalamb
andauthored
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]>
1 parent dccf377 commit 362fcdf

File tree

4 files changed

+43
-30
lines changed

4 files changed

+43
-30
lines changed

.github/workflows/rust.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -384,25 +384,25 @@ jobs:
384384
run: ci/scripts/rust_docs.sh
385385

386386
linux-wasm-pack:
387-
name: build with wasm-pack
388-
runs-on: ubuntu-latest
389-
container:
390-
image: amd64/rust
387+
name: build and run with wasm-pack
388+
runs-on: ubuntu-24.04
391389
steps:
392390
- uses: actions/checkout@v4
393-
- name: Setup Rust toolchain
394-
uses: ./.github/actions/setup-builder
395-
with:
396-
rust-version: stable
391+
- name: Setup for wasm32
392+
run: |
393+
rustup target add wasm32-unknown-unknown
397394
- name: Install dependencies
398395
run: |
399-
apt-get update -qq
400-
apt-get install -y -qq clang
401-
- name: Install wasm-pack
402-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
403-
- name: Build with wasm-pack
396+
sudo apt-get update -qq
397+
sudo apt-get install -y -qq clang
398+
- name: Setup wasm-pack
399+
run: |
400+
cargo install wasm-pack
401+
- name: Run tests with headless mode
404402
working-directory: ./datafusion/wasmtest
405-
run: wasm-pack build --dev
403+
run: |
404+
wasm-pack test --headless --firefox
405+
wasm-pack test --headless --chrome --chromedriver $CHROMEWEBDRIVER/chromedriver
406406
407407
# verify that the benchmark queries return the correct results
408408
verify-benchmark-results:

datafusion/wasmtest/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ wasm-pack test --headless --chrome
7171
wasm-pack test --headless --safari
7272
```
7373

74-
**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.
75-
7674
To tweak timeout setting, use `WASM_BINDGEN_TEST_TIMEOUT` environment variable. E.g., `WASM_BINDGEN_TEST_TIMEOUT=300 wasm-pack test --firefox --headless`.
7775

7876
## Compatibility

datafusion/wasmtest/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ pub fn basic_parse() {
8282
#[cfg(test)]
8383
mod test {
8484
use super::*;
85-
use datafusion::execution::options::ParquetReadOptions;
8685
use datafusion::{
8786
arrow::{
8887
array::{ArrayRef, Int32Array, RecordBatch, StringArray},
@@ -98,7 +97,6 @@ mod test {
9897
};
9998
use datafusion_physical_plan::collect;
10099
use datafusion_sql::parser::DFParser;
101-
use insta::assert_snapshot;
102100
use object_store::{memory::InMemory, path::Path, ObjectStore};
103101
use url::Url;
104102
use wasm_bindgen_test::wasm_bindgen_test;
@@ -240,22 +238,24 @@ mod test {
240238

241239
let url = Url::parse("memory://").unwrap();
242240
session_ctx.register_object_store(&url, Arc::new(store));
243-
244-
let df = session_ctx
245-
.read_parquet("memory:///", ParquetReadOptions::new())
241+
session_ctx
242+
.register_parquet("a", "memory:///a.parquet", Default::default())
246243
.await
247244
.unwrap();
248245

246+
let df = session_ctx.sql("SELECT * FROM a").await.unwrap();
247+
249248
let result = df.collect().await.unwrap();
250249

251-
assert_snapshot!(batches_to_string(&result), @r"
252-
+----+-------+
253-
| id | value |
254-
+----+-------+
255-
| 1 | a |
256-
| 2 | b |
257-
| 3 | c |
258-
+----+-------+
259-
");
250+
assert_eq!(
251+
batches_to_string(&result),
252+
"+----+-------+\n\
253+
| id | value |\n\
254+
+----+-------+\n\
255+
| 1 | a |\n\
256+
| 2 | b |\n\
257+
| 3 | c |\n\
258+
+----+-------+"
259+
);
260260
}
261261
}

datafusion/wasmtest/webdriver.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"moz:firefoxOptions": {
3+
"prefs": {
4+
"media.navigator.streams.fake": true,
5+
"media.navigator.permission.disabled": true
6+
},
7+
"args": []
8+
},
9+
"goog:chromeOptions": {
10+
"args": [
11+
"--use-fake-device-for-media-stream",
12+
"--use-fake-ui-for-media-stream"
13+
]
14+
}
15+
}

0 commit comments

Comments
 (0)