name: Rust

on: [push]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Setup | Checkout
      uses: actions/checkout@v2
    - name: Build
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: stable
        components: clippy
    - run: cargo build --profile release-debug
      
    - name: Run tests
      run: cargo test --profile release-debug
      
    - name: Run cargo-tarpaulin
      uses: actions-rs/tarpaulin@v0.1
      with:
        version: '0.22.0'
        args: '--timeout 10000'

    - name: Upload to codecov.io
      uses: codecov/codecov-action@v1.0.2
      with:
        token: ${{secrets.CODECOV_TOKEN}}
