name: Unit Tests

on:
  push:
    branches: [main]

  pull_request:
    branches: [main]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.4.0

    - uses: actions/setup-go@v2
      with:
        go-version: ^1.17

    - name: Install tools
      run: make install-ci

    - name: Run unit tests
      run: make test-ci

    - name: Upload coverage to codecov
      uses: codecov/codecov-action@v2.1.0
      with:
        file: cover.out
        fail_ci_if_error: true
        verbose: true
