Pin CI #614

Merged
lunny merged 7 commits from jolheiser/go-sdk:pin-vet into main 2023-03-01 00:50:05 +00:00
2 changed files with 13 additions and 27 deletions

View File

@ -12,7 +12,7 @@ workspace:
steps:
- name: gitea
image: gitea/gitea:dev
image: gitea/gitea:1.18
pull: always
detach: true
commands:

View File

@ -8,7 +8,12 @@ GITEA_SDK_TEST_PASSWORD ?= test01
PACKAGE := code.gitea.io/sdk/gitea
GITEA_DL := https://dl.gitea.io/gitea/main/gitea-main-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
GITEA_VET_PACKAGE ?= code.gitea.io/gitea-vet@v0.2.1
GITEA_VERSION := 1.18
GITEA_DL := https://dl.gitea.com/gitea/$(GITEA_VERSION)/gitea-$(GITEA_VERSION)-
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
GITEA_DL := $(GITEA_DL)linux-
@ -55,31 +60,26 @@ clean:
.PHONY: fmt
fmt:
find . -name "*.go" -type f | xargs gofmt -s -w; \
$(GO) run mvdan.cc/gofumpt@latest -extra -w ./gitea
$(GO) run $(GOFUMPT_PACKAGE) -extra -w ./gitea
.PHONY: vet
vet:
# Default vet
cd gitea && $(GO) vet $(PACKAGE)
# Custom vet
cd gitea && $(GO) get code.gitea.io/gitea-vet
cd gitea && $(GO) get $(GITEA_VET_PACKAGE)
cd gitea && $(GO) build code.gitea.io/gitea-vet
cd gitea && $(GO) vet -vettool=gitea-vet $(PACKAGE)
.PHONY: ci-lint
ci-lint: tool-golangci tool-gofumpt tool-revive
@cd gitea/; echo -n "revive ..."; \
revive -config ../.revive.toml .; \
if [ $$? -eq 1 ]; then \
echo; echo "Doesn't pass revive"; \
exit 1; \
fi; echo " done"; echo -n "gofumpt ...";\
diff=$$(gofumpt -extra -l .); \
ci-lint:
@cd gitea/; echo -n "gofumpt ...";\
diff=$$($(GO) run $(GOFUMPT_PACKAGE) -extra -l .); \
if [ -n "$$diff" ]; then \
echo; echo "Not gofumpt-ed"; \
exit 1; \
fi; echo " done"; echo -n "golangci-lint ...";\
golangci-lint run --timeout 5m; \
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --timeout 5m; \
if [ $$? -eq 1 ]; then \
echo; echo "Doesn't pass golangci-lint"; \
exit 1; \
@ -122,17 +122,3 @@ bench:
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