name: Rust

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

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]

    steps:
    - uses: actions/checkout@v2
    - name: Select the minimal lock file
      run: cp Cargo-minimal.lock Cargo.lock
    - name: Set Rust version
      if: matrix.os != 'macOS-latest'
      run: rustup default 1.48.0
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --all-features --verbose
