|
| 1 | +--- |
| 2 | +name: SDK Examples Tests |
| 3 | + |
| 4 | +# This workflow runs SDK examples that are compatible with GitHub-hosted runners. |
| 5 | +# |
| 6 | +# RUNNER LIMITATION: LXD VMs created on GitHub runners have no internal network |
| 7 | +# connectivity. As a result, any example that requires communication with a |
| 8 | +# running VM is excluded. The affected commands are: configure, release, run, test. |
| 9 | +# |
| 10 | +# COMPATIBLE EXAMPLES (can run in CI): |
| 11 | +# - sdk_basic_usage — local-only operations (create, list, show, exists, |
| 12 | +# validate, destroy, purge). No infrastructure required. |
| 13 | +# |
| 14 | +# INCOMPATIBLE EXAMPLES (local only, not run here): |
| 15 | +# - sdk_full_deployment — uses configure, release, run, and test which require |
| 16 | +# VM network connectivity unavailable on GitHub runners. |
| 17 | +# |
| 18 | +# When new examples that only use compatible operations are added, register them |
| 19 | +# in the "Run SDK examples" step below. |
| 20 | + |
| 21 | +on: |
| 22 | + push: |
| 23 | + pull_request: |
| 24 | + workflow_dispatch: # Allow manual triggering |
| 25 | + |
| 26 | +jobs: |
| 27 | + sdk-examples: |
| 28 | + name: SDK Examples |
| 29 | + runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 15 |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout repository |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Setup Rust toolchain |
| 37 | + uses: dtolnay/rust-toolchain@stable |
| 38 | + with: |
| 39 | + toolchain: stable |
| 40 | + |
| 41 | + - name: Cache Rust dependencies |
| 42 | + uses: Swatinem/rust-cache@v2 |
| 43 | + |
| 44 | + - name: Set SSH key permissions |
| 45 | + run: | |
| 46 | + # SSH requires private key files to have restrictive permissions (0600). |
| 47 | + # Git checkout does not preserve file permissions, so we set them manually. |
| 48 | + chmod 600 fixtures/testing_rsa |
| 49 | + ls -la fixtures/testing_rsa |
| 50 | +
|
| 51 | + - name: Build SDK examples |
| 52 | + run: | |
| 53 | + cargo build --examples |
| 54 | +
|
| 55 | + - name: Run SDK examples |
| 56 | + run: | |
| 57 | + echo "🚀 Running SDK basic usage example at $(date)" |
| 58 | + cargo run --example sdk_basic_usage |
| 59 | + echo "✅ SDK basic usage example completed at $(date)" |
| 60 | +
|
| 61 | + - name: Debug information (on failure) |
| 62 | + if: failure() |
| 63 | + run: | |
| 64 | + echo "=== Workspace contents ===" |
| 65 | + ls -la |
| 66 | +
|
| 67 | + echo "=== Build directory ===" |
| 68 | + ls -la build/ 2>/dev/null || echo "No build directory found" |
| 69 | +
|
| 70 | + echo "=== System resources ===" |
| 71 | + df -h |
| 72 | + free -h |
0 commit comments