add example files and README generator #12
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
| # CI for arborium - uses Depot runners (sponsored) | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| merge_group: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test-linux: | |
| runs-on: depot-ubuntu-24.04-16 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| - name: Build with all features | |
| run: cargo build --all-features --verbose | |
| test-macos: | |
| runs-on: depot-macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| check-windows: | |
| runs-on: depot-windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --verbose | |
| - name: Run tests | |
| run: cargo test --verbose | |
| wasm: | |
| runs-on: depot-ubuntu-24.04-8 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install wabt | |
| run: sudo apt-get update && sudo apt-get install -y wabt | |
| - name: Build for WASM | |
| run: cargo build --target wasm32-unknown-unknown --features wasm-fix | |
| - name: Check for env imports in WASM | |
| run: | | |
| # Find all .wasm files and check for env imports | |
| found_env_imports=false | |
| for wasm_file in $(find target/wasm32-unknown-unknown -name "*.wasm" -type f); do | |
| if wasm-objdump -j Import -x "$wasm_file" 2>/dev/null | grep -q '<- env\.'; then | |
| echo "ERROR: Found env imports in $wasm_file:" | |
| wasm-objdump -j Import -x "$wasm_file" | grep '<- env\.' | |
| found_env_imports=true | |
| fi | |
| done | |
| if [ "$found_env_imports" = true ]; then | |
| echo "WASM modules should not have env imports - these won't work in the browser" | |
| exit 1 | |
| fi | |
| echo "No env imports found - WASM modules are browser-compatible" | |
| clippy: | |
| runs-on: depot-ubuntu-24.04-8 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run Clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| fmt: | |
| runs-on: depot-ubuntu-24.04-4 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| docs: | |
| runs-on: depot-ubuntu-24.04-8 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build docs | |
| run: cargo doc --no-deps --all-features | |
| env: | |
| RUSTDOCFLAGS: -D warnings |