Files
datafusion/ci/scripts/rust_example.sh
T
Piotr Findeisen 682fc05452 Fix running examples readme (#11225)
* Fix running examples readme

Some examples are runnable from any place (e.g. `csv_sql`), but some
expect a specific working directory (e.g. `regexp`). Running from
`datafusion-examples/examples` is tested on CI so guaranteed to work,
let's put this path in the README.

As a follow-up, we should look what it would take to make examples
runnable directly from an IDE such as RustRover.

* Remove doubled fmt check from CI

Examples' format is checked in `check-fmt` job, so can be skipped in
`rust_example.sh`.
2024-07-06 07:26:11 -04:00

34 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# 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.
set -ex
cd datafusion-examples/examples/
cargo check --examples
files=$(ls .)
for filename in $files
do
example_name=`basename $filename ".rs"`
# Skip tests that rely on external storage and flight
if [ ! -d $filename ]; then
cargo run --example $example_name
cargo clean -p datafusion-examples
fi
done