name: CI

on:
  pull_request:
  push:
    branches: [main]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - run: cargo fmt --check
      - run: cargo clippy --workspace --all-features -- -D warnings
      - run: cargo install pedant && find . -path '*/src/*.rs' | xargs pedant -c pedant.toml
      - run: cargo test --workspace --all-features
      - run: cargo install cargo-deny && cargo deny --workspace check

  wasm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown
      - run: cargo build -p panes-wasm --target wasm32-unknown-unknown --features js
