name: Go
on: [push,pull_request]
jobs:

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

    - uses: actions/setup-go@v2
      with:
        go-version: 1.14

    - uses: actions/checkout@v2

    # https://github.com/actions/cache/blob/master/examples.md#go---modules
    - name: Cache Go Modules
      id: cache
      uses: actions/cache@v1
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-

    - name: Download Go Modules
      if: steps.cache.outputs.cache-hit != 'true'
      run: go mod download

    - name: Test
      run: go test -v -race -coverpkg=./... -coverprofile=coverage.txt ./...

    - uses: codecov/codecov-action@v1

name: Go
on: [push,pull_request]
jobs:

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

    - uses: actions/setup-go@v2
      with:
        go-version: 1.14

    - uses: actions/checkout@v2
      with:
        fetch-depth: 50 # Need git history for testing.

    # https://github.com/actions/cache/blob/master/examples.md#go---modules
    - name: Cache Go Modules
      id: cache
      uses: actions/cache@v1
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-

    - name: Download Go Modules
      if: steps.cache.outputs.cache-hit != 'true'
      run: go mod download

    - name: Test
      run: go test -v -race -coverpkg=./... -coverprofile=coverage.txt ./...

    - uses: codecov/codecov-action@v1

Set fetch-depth: 50 for the gerrit test
Set fetch-depth: 50 for the gerrit test
