-
Couldn't load subscription status.
- Fork 118
chore: Add CI for examples #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: run-examples | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| RUST_BACKTRACE: 1 | ||
|
|
||
| jobs: | ||
| run-examples: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install minimal stable | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - 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 --manifest-path $example_dir/Cargo.toml --release -- $tmp_dir | ||
| rm -rf $tmp_dir | ||
emkornfield marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # 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 --manifest-path $example_dir/Cargo.toml --release -- ../tests/data/table-without-dv-small $operation | ||
emkornfield marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 --manifest-path $example_dir/Cargo.toml --release | ||
emkornfield marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| else | ||
| # All other examples run with the test table path | ||
| cargo run --manifest-path $example_dir/Cargo.toml --release -- ../tests/data/table-without-dv-small | ||
emkornfield marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| echo "" | ||
| fi | ||
| done | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.