name: Push or PR

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build_n_test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v3
    - name: rustfmt
      run: cargo fmt --all -- --check
    - name: check
      run: cargo check --verbose
    - name: clippy
      run: cargo clippy --all-targets --all-features -- -D warnings
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --verbose --all-features
