Pin CI (#614)
This PR pins the CI and various versions of tools in our Makefile to ensure a more stable run. Note that they aren't necessarily the most current versions, as the SDK likely needs more work to bring it back up to par with the main repo. Co-authored-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/614 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: John Olheiser <john+gitea@jolheiser.com> Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
This commit is contained in:
parent
2c35c11772
commit
df1269f18d
2 changed files with 13 additions and 27 deletions
|
@ -12,7 +12,7 @@ workspace:
|
|||
|
||||
steps:
|
||||
- name: gitea
|
||||
image: gitea/gitea:dev
|
||||
image: gitea/gitea:1.18
|
||||
pull: always
|
||||
detach: true
|
||||
commands:
|
||||
|
|
38
Makefile
38
Makefile
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue