name: CI
on: [push, pull_request]

jobs:
  build-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Build
        run: cargo build --verbose
      - name: Test
        run: cargo test --verbose

  build-windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v1
      - name: Build
        run: cargo build --verbose
      - name: Test
        run: cargo test --verbose

  build-macosx:
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v1
      - name: Install Rust
        run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
      - name: Build
        run: |
          . ~/.cargo/env
          cargo build --verbose
      - name: Test
        run: |
          . ~/.cargo/env
          cargo test --verbose

  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Install dependencies
        run: |
          cargo install --force cargo-sync-readme
          rustup component add rustfmt
      - name: cargo sync-readme
        run: cargo sync-readme -c
      - name: rustfmt
        run: cargo fmt -- --check
