Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Test Miden Examples
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a really good change indeed


on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
# Run daily at 2 AM UTC to catch upstream dependency changes
- cron: '0 2 * * *'

jobs:
test-examples:
name: Test Examples
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: './benchmarking-cli'

- name: Build testing CLI
working-directory: ./benchmarking-cli
run: cargo build --release

- name: Validate examples directory structure
working-directory: ./benchmarking-cli
run: |
cargo run --release -- validate --ci

- name: Test all examples
working-directory: ./benchmarking-cli
run: |
cargo run --release -- test-all --continue-on-error --ci

- name: Test individual examples with verbose output
working-directory: ./benchmarking-cli
run: |
# Test a few key examples with verbose output for debugging
cargo run --release -- test --example fibonacci --verbose
cargo run --release -- test --example comparison --verbose

- name: Run clippy
working-directory: ./benchmarking-cli
run: cargo clippy -- -D warnings

- name: Format check
working-directory: ./benchmarking-cli
run: cargo fmt --all -- --check

test-upstream-compatibility:
name: Test with Upstream Dependencies
runs-on: ubuntu-latest
continue-on-error: true

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: './benchmarking-cli'

- name: Test with latest miden-vm main
working-directory: ./benchmarking-cli
run: |
# Update to latest versions of miden-vm crates
cargo update --package miden-assembly
cargo update --package miden-processor
cargo update --package miden-stdlib
cargo update --package miden-vm

# Build and test with latest versions
cargo build --release
cargo run --release -- test-all --continue-on-error --ci

- name: Report upstream compatibility
if: always()
run: |
echo "## Upstream Compatibility Test" >> $GITHUB_STEP_SUMMARY
echo "- Tested with latest miden-vm main branch" >> $GITHUB_STEP_SUMMARY

benchmark-examples:
name: Benchmark Examples
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: './benchmarking-cli'

- name: Build benchmarking CLI
working-directory: ./benchmarking-cli
run: cargo build --release

- name: Run benchmarks for key examples
working-directory: ./benchmarking-cli
run: |
echo "Running benchmarks for key examples..."
cargo run --release -- benchmark fibonacci --security high --output 1 > benchmark_results.txt 2>&1
cargo run --release -- benchmark comparison --security high --output 1 >> benchmark_results.txt 2>&1
cargo run --release -- benchmark collatz --security high --output 1 >> benchmark_results.txt 2>&1

- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: ./benchmarking-cli/benchmark_results.txt
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,29 @@ There are several examples in our repo and we hope we get more in the future. Th

---

## Running the playground locally
## Testing Examples

You can also run the playground locally on your machine.
### Quick Setup
```bash
./setup-testing.sh
```

### Test Commands
```bash
# Test all examples
cd benchmarking-cli && cargo run -- test-all

# Test specific example
cd benchmarking-cli && cargo run -- test --example fibonacci

# Validate directory structure
cd benchmarking-cli && cargo run -- validate

# Benchmark example
cd benchmarking-cli && cargo run -- benchmark --example fibonacci
```

### Starting site
### Running the playground locally

If you want to run it locally, then make sure you have the [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) installed.

Expand Down
6 changes: 3 additions & 3 deletions benchmarking-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2021"
[dependencies]
clap = { version = "4.0.0", features = ["derive"] }
hex = { version = "0.4.0", default-features = false }
miden-air = { version = "0.7.0", package = "miden-air", default-features = false }
miden-stdlib = { version = "0.6.0", package = "miden-stdlib", default-features = false }
miden_vm = { version = "0.7.0", package = "miden-vm", features = ["concurrent"]}
miden-air = { version = "0.17", package = "miden-air", default-features = false }
miden-stdlib = { version = "0.17", package = "miden-stdlib", default-features = false }
miden_vm = { version = "0.17", package = "miden-vm", features = ["concurrent"]}
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
serde_json = "1.0.48"
Loading
Loading