name: Integration
on: [push, pull_request]
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
        rust: [stable, nightly]
    steps:
    - uses: hecrj/setup-rust-action@v1.2.0
      with:
        rust-version: ${{ matrix.rust }}
        components: clippy,rustfmt
        targets: wasm32-unknown-unknown
    - uses: actions/checkout@master
    - name: Install libudev
      if: matrix.os == 'ubuntu-latest'
      run: sudo apt update && sudo apt install libudev-dev
    - name: Check formatting
      run: cargo fmt -- --check
    - name: Clippy desktop
      run: cargo clippy -- -D warnings
    - name: Clippy desktop with GL enabled
      run: cargo clippy --features gl -- -D warnings
    - name: Check stdweb
      if: matrix.os == 'macOS-latest'
      run: cargo install cargo-web && cargo web check --features stdweb
    - name: Check stdweb with GL enabled
      if: matrix.os == 'macOS-latest'
      run: cargo web check --features stdweb,gl
    - name: Clippy web-sys
      if: matrix.os == 'macOS-latest'
      run: cargo clippy --target wasm32-unknown-unknown --features web-sys -- -D warnings
    - name: Clippy web-sys with GL enabled
      if: matrix.os == 'macOS-latest'
      run: cargo clippy --target wasm32-unknown-unknown --features web-sys,gl -- -D warnings
    - name: Examples
      run: cargo check --examples
