language: rust

matrix:
  include:
   - rust: stable
     env: CLIPPY=1
   - rust: beta
   - rust: nightly
     env: CLIPPY=1
  allow_failures:
    - rust: nightly

before_script:
  - if [ "$CLIPPY" ]; then
      (rustup component add clippy || rustup component add clippy-preview) && CLIPPY_INSTALLED=1 || CLIPPY_INSTALLED=0;
    fi

script:
  - cargo build --all
  - if [ "$CLIPPY_INSTALLED" == 1 ]; then
      cargo clippy;
    fi
  # default features
  - cargo test --all
  # no inventory
  - cargo test --manifest-path encoding/Cargo.toml --no-default-features
  - cargo test --manifest-path transfer-syntax-registry/Cargo.toml --no-default-features

language: rust

matrix:
  include:
   - rust: stable
     env: CLIPPY=1
   - rust: beta
   - rust: nightly
     env: CLIPPY=1
   - rust: stable
     env: WASM=1
  allow_failures:
    - rust: nightly
    - env: WASM=1

before_script:
  - if [ "$CLIPPY" ]; then
      (rustup component add clippy || rustup component add clippy-preview) && CLIPPY_INSTALLED=1 || CLIPPY_INSTALLED=0;
    fi
  - if [ "$WASM" ]; then
      curl https://wasmtime.dev/install.sh -sSf | bash &&
      source ~/.bashrc &&
      cargo install cargo-wasi &&
      rustup target add wasm32-wasi;
    fi

script:
  - if [ "$CLIPPY_INSTALLED" == 1 ]; then
      cargo clippy;
    fi
  - if [ "$WASM" ]; then
      cargo wasi test --workspace
          --exclude dcmdump --exclude dicom-dictionary-builder --exclude dicom-scpproxy
          --exclude dicom-object --exclude dicom-transfer-syntax-registry
          -- --nocapture;
    else
      cargo test --all;
      cargo test --manifest-path encoding/Cargo.toml --no-default-features;
      cargo test --manifest-path transfer-syntax-registry/Cargo.toml --no-default-features;
    fi

Add WebAssembly testing in CI
Add WebAssembly testing in CI

Run tests in low-level and mid-level crates,
  as these do not require system resources
  nor `inventory` support.
Testing  for dicom-object would be important,
but is left as future work for now.
