name: tests validation

on:
  pull_request:
    branches:
      - 'develop'
      - 'main'
  push:
    branches:
      - 'develop'
      - 'main'

concurrency:
  group: mizu-tests-validation-${{ github.ref }}
  cancel-in-progress: true

jobs:
  run-tests-cli:
    name: Run CLI tests
    runs-on: ubuntu-latest
    steps:
      - name: Set up Go 1.16
        uses: actions/setup-go@v2
        with:
          go-version: '^1.16'

      - name: Check out code into the Go module directory
        uses: actions/checkout@v2

      - name: Test
        run: make test-cli

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2

  run-tests-agent:
    name: Run Agent tests
    runs-on: ubuntu-latest
    steps:
      - name: Set up Go 1.16
        uses: actions/setup-go@v2
        with:
          go-version: '^1.16'

      - name: Check out code into the Go module directory
        uses: actions/checkout@v2

      - shell: bash
        run: |
          sudo apt-get install libpcap-dev

      - name: Test
        run: make test-agent

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v2
