name: Go Tests
on: [push, pull_request]
jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    steps:

    - name: Install Go
      uses: actions/setup-go@v2
      id: go

    - name: Check out code
      uses: actions/checkout@v2

    - name: Build
      run: go build -v ./...

    - name: Test
      run: |
        ( cd request; go test -race ./... )
        ( cd core; go test -race  ./... )
        ( cd coremain; go test -race ./... )

  test-plugins:
    name: Test Plugins
    runs-on: ubuntu-latest
    steps:

    - name: Install Go
      uses: actions/setup-go@v2
      id: go

    - name: Check out code
      uses: actions/checkout@v2

    - name: Build
      run: go build -v ./...

    - name: Test
      run: ( cd plugin; go test -race ./... )

  test-e2e:
    name: Test e2e
    runs-on: ubuntu-latest
    steps:

    - name: Install Go
      uses: actions/setup-go@v2
      id: go

    - name: Check out code
      uses: actions/checkout@v2

    - name: Build
      run: go build -v ./...

    - name: Test
      run: |
        go install github.com/fatih/faillint || true
        ( cd test; go test -race ./... )

  test-makefile-release:
    name: Test Makefile.release
    runs-on: ubuntu-latest
    steps:

    - name: Install dependencies
      run: |
        sudo apt-get install make curl

    - name: Check out code
      uses: actions/checkout@v2

    - name: Test Makefile
      run:  make DOCKER=bla GITHUB_ACCESS_TOKEN=bla -n build docker github-push docker-push -f Makefile.release
