diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b84702e0..2f2c1ec8 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,8 +1,18 @@ name: Go on: push: - branches: [master] + branches: [ master ] + paths: + - '**.go' + - 'go.mod' + - '.golangci.yml' + - '.github/workflows/go.yml' pull_request: + paths: + - '**.go' + - 'go.mod' + - '.golangci.yml' + - '.github/workflows/go.yml' env: GOPROXY: "https://proxy.golang.org" @@ -18,32 +28,34 @@ jobs: with: version: latest args: --timeout=30m + - name: Check Go module tidiness + shell: bash + run: | + go mod tidy + STATUS=$(git status --porcelain go.mod go.sum) + if [ ! -z "$STATUS" ]; then + echo "Running go mod tidy modified go.mod and/or go.sum" + exit 1 + fi test: name: Test strategy: matrix: - go-version: [1.14.x, 1.15.x, 1.16.x] - platform: [ubuntu-latest, macos-latest, windows-latest] + go-version: [ 1.16.x, 1.17.x, 1.18.x ] + platform: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v2 with: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v2 - - name: Run unit tests + - name: Run tests with coverage run: go test -v -race -coverprofile=coverage -covermode=atomic ./... - name: Upload coverage report to Codecov - uses: codecov/codecov-action@v1.0.6 + uses: codecov/codecov-action@v1.5.0 with: file: ./coverage flags: unittests - - name: Cache downloaded modules - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- diff --git a/codecov.yml b/codecov.yml index fc947f23..45768ef4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,4 +6,6 @@ coverage: threshold: 1% comment: - layout: 'diff, files' + layout: 'diff' + +github_checks: false