diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 73666d545..2b4e96091 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -8,25 +8,39 @@ on: jobs: run: runs-on: ubuntu-latest + + strategy: + matrix: + go: [1.19.x, 1.20.x] + steps: - name: checkout source code - uses: actions/checkout@master + uses: actions/checkout@v3 + - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v4 with: - go-version: '1.17.2' - - name: run tests + go-version: ${{ matrix.go }} + + - name: create go.mod run: | - export PATH="$(go env GOPATH)/bin:${PATH}" - set -x - make install.tools - # Fix for "cannot find main module" issue go mod init github.com/opencontainers/runtime-spec go get -d ./schema/... + + - name: run golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.51.2 + args: --verbose + + - name: run tests + run: | + set -x + make install.tools + make .govet - make .golint make .gitvalidation make docs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9045dd4e2..83354d8d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,25 +8,39 @@ on: jobs: run: runs-on: ubuntu-latest + + strategy: + matrix: + go: [1.19.x, 1.20.x] + steps: - name: checkout source code - uses: actions/checkout@master + uses: actions/checkout@v3 + - name: setup go environment - uses: actions/setup-go@v1 + uses: actions/setup-go@v4 with: - go-version: '1.17.2' - - name: run tests - run: | - export PATH="$(go env GOPATH)/bin:${PATH}" - set -x - make install.tools + go-version: ${{ matrix.go }} + - name: create go.mod + run: | # Fix for "cannot find main module" issue go mod init github.com/opencontainers/runtime-spec go get -d ./schema/... + + - name: run golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.51.2 + args: --verbose + + - name: run tests + run: | + set -x + make install.tools + make .govet - make .golint make .gitvalidation make docs diff --git a/.tool/version-doc.go b/.tool/version-doc.go index f36bfe4c3..fdc6e288e 100644 --- a/.tool/version-doc.go +++ b/.tool/version-doc.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore package main diff --git a/Makefile b/Makefile index 7a61610db..78cbc31c2 100644 --- a/Makefile +++ b/Makefile @@ -61,14 +61,6 @@ test: .govet .golint .gitvalidation .govet: go vet -x ./... -# `go get github.com/golang/lint/golint` -.golint: -ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true) - @which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false) - golint ./... -endif - - # When this is running in GitHub, it will only check the GitHub commit range .gitvalidation: @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false) @@ -78,16 +70,10 @@ else git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD endif -install.tools: .install.golint .install.gitvalidation - -# golint does not even build for