name: Go

on:
  push:
    branches:
      - master
      - develop
  pull_request:
    branches:
      - master
      - develop

jobs:
  lint:
    name: Linter
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@v3

    - name: Setup Go
      uses: actions/setup-go@v4
      with:
        go-version: '^1.19'

    - name: Get dependencies
      run: go mod download

    - name: Run golangci-lint
      uses: golangci/golangci-lint-action@v3
      with:
        version: v1.52.2
        only-new-issues: true
        args: -c ./.golangci.yml --timeout 15m

    - name: Run go vet
      run: go vet ./...

  test:
    name: Test
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
      uses: actions/checkout@v3

    - name: Setup Go
      uses: actions/setup-go@v4
      with:
        go-version: '^1.19'

    - name: Get dependencies
      run: go mod download

    - name: Run tests
      run: ./test --test-only
