make ci work again #593

Merged
6543 merged 2 commits from 6543/go-sdk:make-ci-work-again into master 2022-05-30 22:08:44 +00:00
3 changed files with 29 additions and 14 deletions

View File

@ -67,23 +67,23 @@ vet:
cd gitea && $(GO) vet -vettool=gitea-vet $(PACKAGE) cd gitea && $(GO) vet -vettool=gitea-vet $(PACKAGE)
.PHONY: ci-lint .PHONY: ci-lint
ci-lint: ci-lint: tool-golangci tool-gofumpt tool-revive
cd gitea/; \ @cd gitea/; echo -n "revive ..."; \
$(GO) run github.com/mgechev/revive@latest -config ../.revive.toml .; \ revive -config ../.revive.toml .; \
if [ $$? -eq 1 ]; then \ if [ $$? -eq 1 ]; then \
echo "Doesn't pass revive"; \ echo; echo "Doesn't pass revive"; \
exit 1; \ exit 1; \
fi; \ fi; echo " done"; echo -n "gofumpt ...";\
diff=$$($(GO) run mvdan.cc/gofumpt@latest -extra -l .); \ diff=$$(gofumpt -extra -l .); \
if [ -n "$$diff" ]; then \ if [ -n "$$diff" ]; then \
echo "Not gofumpt-ed"; \ echo; echo "Not gofumpt-ed"; \
exit 1; \ exit 1; \
fi; \ fi; echo " done"; echo -n "golangci-lint ...";\
$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2 run --timeout 5m; \ golangci-lint run --timeout 5m; \
if [ $$? -eq 1 ]; then \ if [ $$? -eq 1 ]; then \
echo "Doesn't pass golangci-lint"; \ echo; echo "Doesn't pass golangci-lint"; \
exit 1; \ exit 1; \
fi; \ fi; echo " done"; \
cd -; \ cd -; \
.PHONY: test .PHONY: test
@ -121,3 +121,18 @@ bench:
.PHONY: build .PHONY: build
build: build:
cd gitea && $(GO) build cd gitea && $(GO) build
tool-golangci:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
fi
tool-gofumpt:
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) install mvdan.cc/gofumpt@latest; \
fi
tool-revive:
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) install github.com/mgechev/revive@latest; \
fi

View File

@ -3,6 +3,6 @@ module code.gitea.io/sdk/gitea
go 1.13 go 1.13
require ( require (
github.com/hashicorp/go-version v1.4.0 github.com/hashicorp/go-version v1.5.0
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
) )

View File

@ -1,7 +1,7 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4= github.com/hashicorp/go-version v1.5.0 h1:O293SZ2Eg+AAYijkVK3jR786Am1bhDEh2GHT0tIVE5E=
github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=