blockless-sdk 0.2.3

blockless runtime sdk
Documentation
name: CI

on:
  pull_request:
    branches:
      - main

jobs:
  check-clippy-build:
    runs-on: ubuntu-latest
    steps:
      - name: Check out
        uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.85.0
        with:
          toolchain: stable
          targets: wasm32-wasip1
          components: rustfmt,clippy
      - name: Format
        run: cargo fmt --all -- --check
      - name: Clippy
        run: cargo clippy --all-features --all-targets -- -D warnings
      - name: Check
        run: cargo check --release --all --all-features
      - name: Test
        run: cargo test --all --features mock-ffi

  get-features:
    runs-on: ubuntu-latest
    outputs:
      features: ${{ steps.get-features.outputs.features }}
    steps:
      - name: Check out
        uses: actions/checkout@v4
      - name: Install toml-cli
        run: cargo install toml-cli
      - name: Extract features from Cargo.toml
        id: get-features
        run: |
          # Extract all feature names from Cargo.toml
          all_features=$(toml get Cargo.toml features | jq -r 'keys[]')
          
          # Filter out default and mock-ffi
          features=$(echo "$all_features" | grep -v -E '^(default|mock-ffi)$' | jq -R -s -c 'split("\n") | map(select(length > 0))')
          
          # Add "default" and "all" to test with default features and all features
          features=$(echo $features | jq -c '. + ["default", "all"]')
          
          echo "features=$features" >> $GITHUB_OUTPUT
          echo "Detected features: $features"

  feature-matrix:
    needs: get-features
    runs-on: ubuntu-latest
    strategy:
      matrix:
        feature: ${{ fromJson(needs.get-features.outputs.features) }}
    steps:
      - name: Check out
        uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@1.85.0
        with:
          toolchain: stable
          targets: wasm32-wasip1
      - name: Check feature ${{ matrix.feature }}
        run: |
          if [ "${{ matrix.feature }}" = "default" ]; then
            cargo check --release
          elif [ "${{ matrix.feature }}" = "all" ]; then
            cargo check --release --all-features
          else
            cargo check --release --no-default-features --features ${{ matrix.feature }}
          fi