name: Build

# Triggers the workflow on push or pull request events (for any branch in a repository)
on: [ push, pull_request ]

env:
    CARGO_TERM_COLOR: always

jobs:
    build:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                rust:
                    - stable
                    - nightly
                    - 1.56.1 # MSVR
        steps:
            -   uses: actions/checkout@v2
            -   name: Build
                run: cargo build --all-targets --verbose
            -   name: Run tests
                run: cargo test --verbose

    style_checks:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                rust:
                    - stable
        steps:
            -   uses: actions/checkout@v2
            -   name: Rustfmt
                run: cargo fmt -- --check
            -   name: Clippy
                run: cargo clippy
            -   name: Rustdoc
                run: cargo doc
