name: Build & Test
on:
  pull_request:
  push:
    branches:
    - master

jobs:
  test:
    name: test
    runs-on: ${{matrix.os}}
    strategy:
      matrix:
        os: [ubuntu-latest, macOS-latest]
        rust: [stable, "1.31.1"]
    steps:
    - name: Checkout repository
      uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - name: Install correct toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        target: ${{ matrix.target }}
        override: true
    - name: Run cargo check
      uses: actions-rs/cargo@v1
      with:
        command: check
    - name: Run tests
      run: cargo test --verbose
    - name: Run tests for compact feature
      run: cargo test --verbose --features compact
