2010YOUY01 commented on code in PR #23414:
URL: https://github.com/apache/datafusion/pull/23414#discussion_r3555810342


##########
xtask/src/step_runners.rs:
##########
@@ -0,0 +1,701 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+use crate::{Result, Xtask};
+use std::env;
+use std::ffi::OsStr;
+use std::fs;
+use std::path::Path;
+use std::process::Command;
+
+// ---------------------------------------------
+// Leaf step runner implementations and utilities.
+// ---------------------------------------------
+
+impl Xtask {
+    // Step runner entry point for `cargo xtask ci step fmt ...`.
+    // See the corresponding `fmt` StepInfo for supported args.
+    pub(crate) fn run_fmt(&self, args: &[String]) -> Result<()> {
+        self.script("ci/scripts/rust_fmt.sh")
+            .args(args.iter().map(String::as_str))
+            .run()
+    }
+
+    // Step runner entry point for `cargo xtask ci step clippy ...`.
+    // See the corresponding `clippy` StepInfo for supported args.
+    pub(crate) fn run_clippy(&self, args: &[String]) -> Result<()> {
+        self.command("rustup")
+            .args(["component", "add", "clippy"])
+            .run()?;
+        self.script("ci/scripts/rust_clippy.sh")
+            .args(args.iter().map(String::as_str))
+            .run()
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-check ...`.
+    // See the corresponding `rust-check` StepInfo for supported args.
+    pub(crate) fn run_rust_check(&self, args: &[String]) -> Result<()> {
+        let target = args.first().map(String::as_str).unwrap_or("workspace");
+        if args.len() > 1 {
+            return Err("usage: cargo xtask ci step rust-check 
[target]".to_string());
+        }
+
+        match target {
+            "workspace" => self
+                .command("cargo")
+                .args([
+                    "check",
+                    "--profile",
+                    "ci",
+                    "--workspace",
+                    "--all-targets",
+                    "--features",
+                    "integration-tests",
+                    "--locked",
+                ])
+                .run(),
+            "datafusion-common" => {
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--all-targets",
+                        "-p",
+                        "datafusion-common",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-common",
+                    ])
+                    .run()
+            }
+            "datafusion-substrait" => {
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--all-targets",
+                        "-p",
+                        "datafusion-substrait",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-substrait",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-substrait",
+                        "--features=physical",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-substrait",
+                        "--features=protoc",
+                    ])
+                    .run()
+            }
+            "datafusion-proto" => {
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--all-targets",
+                        "-p",
+                        "datafusion-proto",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-proto",
+                    ])
+                    .run()?;
+                for feature in ["json", "parquet", "avro"] {
+                    self.command("cargo")
+                        .args([
+                            "check",
+                            "--profile",
+                            "ci",
+                            "--no-default-features",
+                            "-p",
+                            "datafusion-proto",
+                        ])
+                        .arg(format!("--features={feature}"))
+                        .run()?;
+                }
+                Ok(())
+            }
+            "datafusion" => {
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--all-targets",
+                        "-p",
+                        "datafusion",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion",
+                    ])
+                    .run()?;
+                for feature in [
+                    "nested_expressions",
+                    "array_expressions",
+                    "avro",
+                    "backtrace",
+                    "compression",
+                    "crypto_expressions",
+                    "datetime_expressions",
+                    "encoding_expressions",
+                    "force_hash_collisions",
+                    "math_expressions",
+                    "parquet",
+                    "regex_expressions",
+                    "recursive_protection",
+                    "serde",
+                    "sql",
+                    "string_expressions",
+                    "unicode_expressions",
+                    "parquet_encryption",
+                ] {
+                    self.command("cargo")
+                        .args([
+                            "check",
+                            "--profile",
+                            "ci",
+                            "--no-default-features",
+                            "-p",
+                            "datafusion",
+                        ])
+                        .arg(format!("--features={feature}"))
+                        .run()?;
+                }
+                Ok(())
+            }
+            "datafusion-functions" => {
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--all-targets",
+                        "-p",
+                        "datafusion-functions",
+                    ])
+                    .run()?;
+                self.command("cargo")
+                    .args([
+                        "check",
+                        "--profile",
+                        "ci",
+                        "--no-default-features",
+                        "-p",
+                        "datafusion-functions",
+                    ])
+                    .run()?;
+                for feature in [
+                    "crypto_expressions",
+                    "datetime_expressions",
+                    "encoding_expressions",
+                    "math_expressions",
+                    "regex_expressions",
+                    "string_expressions",
+                    "unicode_expressions",
+                ] {
+                    self.command("cargo")
+                        .args([
+                            "check",
+                            "--profile",
+                            "ci",
+                            "--no-default-features",
+                            "-p",
+                            "datafusion-functions",
+                        ])
+                        .arg(format!("--features={feature}"))
+                        .run()?;
+                }
+                Ok(())
+            }
+            unknown => Err(format!("unknown rust-check target `{unknown}`")),
+        }
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-test ...`.
+    // See the corresponding `rust-test` StepInfo for supported args.
+    pub(crate) fn run_rust_test(&self, args: &[String]) -> Result<()> {
+        let target = args.first().map(String::as_str).unwrap_or("workspace");
+        if args.len() > 1 {
+            return Err(
+                "usage: cargo xtask ci step rust-test 
[workspace|datafusion-cli|datafusion-ffi]"
+                    .to_string(),
+            );
+        }
+
+        match target {
+            "workspace" => self
+                .command("cargo")
+                .args([
+                    "test",
+                    "--profile",
+                    "ci",
+                    "--exclude",
+                    "datafusion-examples",
+                    "--exclude",
+                    "ffi_example_table_provider",
+                    "--exclude",
+                    "datafusion-cli",
+                    "--workspace",
+                    "--lib",
+                    "--tests",
+                    "--bins",
+                    "--features",
+                    
"serde,avro,json,backtrace,integration-tests,parquet_encryption,substrait",
+                ])
+                .env("RUST_BACKTRACE", "1")
+                .run(),
+            "datafusion-cli" => self
+                .command("cargo")
+                .args([
+                    "test",
+                    "--features",
+                    "backtrace",
+                    "--profile",
+                    "ci",
+                    "-p",
+                    "datafusion-cli",
+                    "--lib",
+                    "--tests",
+                    "--bins",
+                ])
+                .env("RUST_BACKTRACE", "1")
+                .env("AWS_ENDPOINT", "http://127.0.0.1:9000";)
+                .env("AWS_ACCESS_KEY_ID", "TEST-DataFusionLogin")
+                .env("AWS_SECRET_ACCESS_KEY", "TEST-DataFusionPassword")
+                .env("TEST_STORAGE_INTEGRATION", "1")
+                .env("AWS_ALLOW_HTTP", "true")
+                .run(),
+            "datafusion-ffi" => self
+                .command("cargo")
+                .args([
+                    "test",
+                    "--profile",
+                    "ci",
+                    "-p",
+                    "datafusion-ffi",
+                    "--lib",
+                    "--tests",
+                    "--features",
+                    "integration-tests",
+                ])
+                .run(),
+            unknown => Err(format!("unknown rust-test target `{unknown}`")),
+        }
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-doctest ...`.
+    // See the corresponding `rust-doctest` StepInfo for supported args.
+    pub(crate) fn run_rust_doctest(&self, _args: &[String]) -> Result<()> {
+        self.command("cargo")
+            .args([
+                "test",
+                "--profile",
+                "ci",
+                "--doc",
+                "--features",
+                "avro,json",
+            ])
+            .run()
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-doc ...`.
+    // See the corresponding `rust-doc` StepInfo for supported args.
+    pub(crate) fn run_rust_doc(&self, _args: &[String]) -> Result<()> {
+        self.script("ci/scripts/rust_docs.sh").run()
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-examples ...`.
+    // See the corresponding `rust-examples` StepInfo for supported args.
+    pub(crate) fn run_rust_examples(&self, _args: &[String]) -> Result<()> {
+        self.command("cargo")
+            .args(["run", "--profile", "ci", "--example", "sql"])
+            .run()?;
+        self.script("ci/scripts/rust_example.sh").run()
+    }
+
+    // Step runner entry point for `cargo xtask ci step rust-wasm ...`.
+    // See the corresponding `rust-wasm` StepInfo for supported args.
+    pub(crate) fn run_rust_wasm(&self, _args: &[String]) -> Result<()> {
+        let wasm_dir = self.root.join("datafusion/wasmtest");
+        let rustflags = r#"--cfg getrandom_backend="wasm_js" -C 
debuginfo=none"#;
+        self.command("wasm-pack")
+            .args(["test", "--headless", "--firefox"])
+            .current_dir(&wasm_dir)
+            .env("RUSTFLAGS", rustflags)
+            .run()?;
+
+        let chrome_driver = format!(

Review Comment:
   Similarly, 
https://github.com/apache/datafusion/pull/23414#discussion_r3555803787
   
   I found this job also a bit tricky to setup locally on my Mac



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to