name: check

on: push

jobs:
  check:
    runs-on: "ubuntu-latest"
    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        profile: minimal
        components: rustfmt, clippy

    - name: Check format
      uses: actions-rs/cargo@v1
      with:
        command: fmt
        args: -- --check

    - name: Annotate commit with clippy warnings
      uses: actions-rs/clippy-check@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        args: --all-features

    - name: Security audit
      uses: actions-rs/audit-check@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

  cov:
    runs-on: "ubuntu-latest"
    continue-on-error: true
    steps:
    - uses: actions/checkout@v2

    - uses: actions-rs/toolchain@v1
      with:
        toolchain: nightly
        override: true
        profile: minimal
        components: llvm-tools-preview

    - name: Tests
      uses: actions-rs/cargo@v1
      with:
        command: test
        args: --no-fail-fast
      env:
        CARGO_INCREMENTAL: '0'
        RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
        RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'

    - id: coverage
      name: Coverage
      uses: actions-rs/grcov@v0.1

    - name: Upload coverage
      uses: codecov/codecov-action@v1
      with:
        file: ${{ steps.coverage.outputs.report }}

# vim: set ts=2 sts=2 sw=2:
