From a632e0cb6bca9e59999d27eca0b25d04897a9e5c Mon Sep 17 00:00:00 2001 From: Vasiliy Vasilyuk Date: Wed, 18 Nov 2020 01:10:52 +0300 Subject: [PATCH] Configure new ci https://github.com/actions/setup-go/issues/12#issuecomment-521972456 --- .github/workflows/ci-without-go-modules.yml | 47 +++++++++++++++++++++ .github/workflows/ci.yml | 42 ++++++++++++++++++ .travis.yml | 25 ----------- Makefile | 18 +------- 4 files changed, 90 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/ci-without-go-modules.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci-without-go-modules.yml b/.github/workflows/ci-without-go-modules.yml new file mode 100644 index 0000000..7358dda --- /dev/null +++ b/.github/workflows/ci-without-go-modules.yml @@ -0,0 +1,47 @@ +name: CI without go modules + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + strategy: + matrix: + go: + - '1.12' + - '1.11' + - '1.10' + - '1.9' + - '1.8' + os: + - 'ubuntu-18.04' + - 'macos-10.15' + runs-on: ${{ matrix.os }} + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Running static checks + run: | + export GOPATH=$HOME/go + export GOBIN=$(go env GOPATH)/bin + export PATH=$PATH:$GOPATH + export PATH=$PATH:$GOBIN + mkdir -p $GOPATH/pkg + mkdir -p $GOBIN + mkdir -p $GOPATH/src/github.com/$GITHUB_REPOSITORY + mv $(pwd)/* $GOPATH/src/github.com/$GITHUB_REPOSITORY + cd $GOPATH/src/github.com/$GITHUB_REPOSITORY + go test ./... -count=10 -race + + - name: Codecov + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b0dab10 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + strategy: + matrix: + go: + - '1.15' + - '1.14' + - '1.13' + os: + - 'ubuntu-18.04' + - 'macos-10.15' + runs-on: ${{ matrix.os }} + steps: + - name: Set up Go ${{ matrix.go }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go }} + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Installing tools + run: make tools + + - name: Running static checks + run: | + export GOPATH=$HOME/go + export GOBIN=$(go env GOPATH)/bin + export PATH=$PATH:$GOPATH + export PATH=$PATH:$GOBIN + make check + + - name: Codecov + uses: codecov/codecov-action@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 94fc20a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go - -sudo: false - -matrix: - include: - - go: 1.8.x - - go: 1.9.x - - go: 1.10.x - - go: 1.11.x - - go: 1.12.x - - go: 1.x - env: GO111MODULE=on - - go: tip - -script: -- > - if [ "${TRAVIS_GO_VERSION}" = "1.x" ]; - then make ci; - else go test ./... -count=1 -race; - fi; -- make build - -after_success: -- bash <(curl -s https://codecov.io/bash) diff --git a/Makefile b/Makefile index d94c424..1be1c2b 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ build: ## Build the project binary @go build ./... .PHONY: ci -ci: check checkstate ## Target for integration with ci pipeline +ci: check ## Target for integration with ci pipeline .PHONY: check check: static test build ## Check project with static checks and unit tests @@ -93,19 +93,3 @@ toolsup: ## Update all needed tools, e.g. for static checks .PHONY: vet vet: ## Check the project with vet @go vet ./... - -.PHONY: checkstate -checkstate: tools ## Checking the relevance of dependencies, and tools. Also, the absence of arbitrary changes when performing checks. - @echo 'checking the relevance of the dependency list' - @go mod tidy - @git diff --exit-code go.mod go.sum - @echo 'checking the relevance of the committed dependencies' - @go mod vendor - @git diff --exit-code vendor - @echo 'checking the relevance of the committed generated files' - @go generate - @exit $$(git status -s | wc -l) - @echo 'checking the relevance of the committed golden files' - @make testup - @exit $$(git status -s | wc -l) - @go mod verify