diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0ced8ae572..912d3d225d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,37 +4,20 @@ jobs: test: strategy: matrix: - go-version: [1.13.x, 1.14.x, 1.15.x] + go-version: [1.15.x, 1.16.x] os: [ubuntu-latest] runs-on: ${{ matrix.os }} - env: - GO111MODULE: off steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - name: Setup GOPATH - run: | - gopath_org=$(go env GOPATH)/src/github.com/kata-containers/ - mkdir -p ${gopath_org} - ln -s ${PWD} ${gopath_org} - - name: Checkout code - uses: actions/checkout@v2 - - name: Install gometalinter - run: | - go get github.com/alecthomas/gometalinter - $(go env GOPATH)/bin/gometalinter --install - - name: Running gometalinter - run: | - gopath_repo=$(go env GOPATH)/src/github.com/kata-containers/govmm - pushd ${gopath_repo} - $(go env GOPATH)/bin/gometalinter --tests --vendor --disable-all --enable=misspell --enable=vet --enable=ineffassign --enable=gofmt --enable=gocyclo --cyclo-over=15 --enable=golint --enable=errcheck --enable=deadcode --enable=staticcheck -enable=gas ./... - - name: Send coverage - env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gopath_repo=$(go env GOPATH)/src/github.com/kata-containers/govmm - pushd ${gopath_repo} - go get github.com/mattn/goveralls - $(go env GOPATH)/bin/goveralls -v -service=github + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: -c .golangci.yml -v + - name: go test + run: go test ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000000..6b7fcdebe9 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,35 @@ +# Copyright (c) 2021 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +run: + concurrency: 4 + deadline: 600s + skip-dirs: + - vendor +# Ignore auto-generated protobuf code. + skip-files: + - ".*\\.pb\\.go$" + +linters: + disable-all: true + enable: + - deadcode + - gocyclo + - gofmt + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - structcheck + - typecheck + - unconvert + - unused + - varcheck + +linters-settings: + gocyclo: + min_complexity: 15 + unused: + check-exported: true