forked from delta-io/delta-kernel-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.92 KB
/
run-examples.yml
File metadata and controls
67 lines (58 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: run-examples
on: [push, pull_request, merge_group]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
run-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install minimal stable
uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache: false
# See build.yml top-level comment for why save-if is restricted to main.
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Run all examples
run: |
set -e # Exit immediately if any command fails
cd kernel/examples
# Find all example directories that have a src/main.rs file
for example_dir in */; do
example_dir=${example_dir%/} # Remove trailing slash
# Skip the common directory (it's a library, not an example)
if [ "$example_dir" = "common" ]; then
continue
fi
# Check if this directory has a src/main.rs file
if [ -f "$example_dir/src/main.rs" ]; then
echo "========================================"
echo "Running example: $example_dir"
echo "========================================"
# Special case for write-table: it needs a temp directory
if [ "$example_dir" = "write-table" ]; then
tmp_dir=$(mktemp -d)
cargo run --locked --manifest-path "$example_dir/Cargo.toml" --release -- "$tmp_dir"
rm -r "$tmp_dir"
# Special case for inspect-table: it needs an operation/subcommand, run each one
elif [ "$example_dir" = "inspect-table" ]; then
for operation in table-version metadata schema scan-metadata actions; do
echo " Running inspect-table with operation: $operation"
cargo run --locked --manifest-path "$example_dir/Cargo.toml" --release -- ../tests/data/table-without-dv-small $operation
done
# Special case for read-table-changes: skip running it in CI as it needs a specific CDF-enabled table
# but still verify it compiles
# TODO: Add a suitable test table for CDF
elif [ "$example_dir" = "read-table-changes" ]; then
echo "Building read-table-changes (skipping run - requires CDF-enabled table)"
cargo build --locked --manifest-path "$example_dir/Cargo.toml" --release
else
# All other examples run with the test table path
cargo run --locked --manifest-path "$example_dir/Cargo.toml" --release -- ../tests/data/table-without-dv-small
fi
echo ""
fi
done