mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
revert: tea 1.0 rewrite (#1122–#1126) (#1146)
Reverts #1126, #1125, #1124, #1123 and #1122. `go.mod` keeps the Go 1.26 line with toolchain `go1.26.9` (instead of the original `go1.26.6`) so the security fix from #1131 isn't lost. reopens #69 reopens #141 reopens #162 reopens #172 reopens #197 reopens #232 reopens #240 reopens #246 reopens #323 reopens #325 reopens #326 reopens #328 reopens #344 reopens #351 reopens #373 reopens #403 reopens #406 reopens #417 reopens #430 reopens #457 reopens #480 reopens #482 reopens #489 reopens #490 reopens #498 reopens #500 reopens #504 reopens #510 reopens #516 reopens #523 reopens #556 reopens #560 reopens #569 reopens #571 reopens #602 reopens #632 reopens #633 reopens #643 reopens #666 reopens #670 reopens #672 reopens #677 reopens #683 reopens #697 reopens #726 reopens #737 reopens #770 reopens #779 reopens #804 reopens #817 reopens #831 reopens #833 reopens #834 reopens #908 reopens #966 reopens #1023 reopens #1029 reopens #1032 reopens #1050 reopens #1052 reopens #1069 reopens #1073 reopens #1087 reopens #1091 reopens #1094 reopens #1110 reopens #1115 reopens #1116 reopens #1118 Reviewed-on: https://gitea.com/gitea/tea/pulls/1146 Reviewed-by: TheFox0x7 <95654+thefox0x7@noreply.gitea.com>
This commit is contained in:
1 parent
33bb12729e
commit
c5f674111a
604 files changed
+33711
-35545
No files matched your search
@@ -7,8 +7,8 @@ export PATH := $($(GO) env GOPATH)/bin:$(PATH)
|
||||
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
|
||||
|
||||
# Tool packages with pinned versions
|
||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.12.0
|
||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0
|
||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.2
|
||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4
|
||||
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
@@ -24,13 +24,17 @@ endif
|
||||
TEA_VERSION_TAG ?= $(shell sed 's/+/_/' <<< $(TEA_VERSION))
|
||||
|
||||
TAGS ?=
|
||||
LDFLAGS := -X "gitea.dev/tea/internal/version.Version=$(TEA_VERSION)" -X "gitea.dev/tea/internal/version.Tags=$(TAGS)" -s -w
|
||||
SDK ?= $(shell $(GO) list -f '{{.Version}}' -m gitea.dev/sdk)
|
||||
LDFLAGS := -X "gitea.dev/tea/modules/version.Version=$(TEA_VERSION)" -X "gitea.dev/tea/modules/version.Tags=$(TAGS)" -X "gitea.dev/tea/modules/version.SDK=$(SDK)" -s -w
|
||||
|
||||
# override to allow passing additional goflags via make CLI
|
||||
override GOFLAGS := $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
||||
|
||||
PACKAGES ?= $(shell $(GO) list ./...)
|
||||
PACKAGES ?= $(shell $(GO) list ./... | grep -v '^gitea.dev/tea/tests')
|
||||
UNIT_PACKAGES ?= $(PACKAGES)
|
||||
INTEGRATION_PACKAGES ?= $(shell $(GO) list ./tests/... 2>/dev/null)
|
||||
INTEGRATION_TEST_TAGS ?= testtools
|
||||
INTEGRATION_TEST_GOFLAGS ?= -v
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
|
||||
# OS specific vars.
|
||||
@@ -64,11 +68,11 @@ vet:
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run
|
||||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --build-tags testtools
|
||||
|
||||
.PHONY: lint-fix
|
||||
lint-fix:
|
||||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix
|
||||
$(GO) run $(GOLANGCI_LINT_PACKAGE) run --build-tags testtools --fix
|
||||
|
||||
.PHONY: fmt-check
|
||||
fmt-check:
|
||||
@@ -80,39 +84,18 @@ fmt-check:
|
||||
exit 1; \
|
||||
fi;
|
||||
|
||||
# Man pages are dated by the last commit unless SOURCE_DATE_EPOCH is already set.
|
||||
.PHONY: docs
|
||||
docs:
|
||||
SOURCE_DATE_EPOCH=$${SOURCE_DATE_EPOCH:-$$(git log -1 --format=%ct 2>/dev/null)} TZ=UTC $(GO) run ./tools/cli-docs --out docs/generated
|
||||
$(GO) run docs/docs.go --out docs/CLI.md
|
||||
|
||||
# Versioned docs archive for release uploads (references, man pages, completions).
|
||||
# Keep the artifact outside dist/: goreleaser requires dist/ empty after before hooks.
|
||||
# The .tar.xz suffix matches existing release/publisher/checksum ./**.xz globs.
|
||||
DOCS_ARCHIVE ?= tea-$(TEA_VERSION_TAG)-docs.tar.xz
|
||||
|
||||
.PHONY: docs-archive
|
||||
docs-archive: docs
|
||||
@rm -f "$(DOCS_ARCHIVE)" "$(DOCS_ARCHIVE).sha256"
|
||||
tar -C docs/generated -c README.md reference man completion | xz -9 > "$(DOCS_ARCHIVE)"
|
||||
@bash .goreleaser.checksum.sh "$(DOCS_ARCHIVE)"
|
||||
|
||||
# Install generated man pages and shell completions for packagers / local installs.
|
||||
# Binary install remains `make install` (GOPATH/bin). Override PREFIX/DESTDIR as needed.
|
||||
PREFIX ?= /usr/local
|
||||
DESTDIR ?=
|
||||
|
||||
.PHONY: install-docs
|
||||
install-docs: docs
|
||||
install -d "$(DESTDIR)$(PREFIX)/share/man/man1"
|
||||
install -m 644 docs/generated/man/*.1 "$(DESTDIR)$(PREFIX)/share/man/man1/"
|
||||
install -d "$(DESTDIR)$(PREFIX)/share/bash-completion/completions"
|
||||
install -m 644 docs/generated/completion/tea.bash "$(DESTDIR)$(PREFIX)/share/bash-completion/completions/tea"
|
||||
install -d "$(DESTDIR)$(PREFIX)/share/zsh/site-functions"
|
||||
install -m 644 docs/generated/completion/_tea "$(DESTDIR)$(PREFIX)/share/zsh/site-functions/_tea"
|
||||
install -d "$(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d"
|
||||
install -m 644 docs/generated/completion/tea.fish "$(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/tea.fish"
|
||||
install -d "$(DESTDIR)$(PREFIX)/share/powershell/Modules/tea"
|
||||
install -m 644 docs/generated/completion/tea.ps1 "$(DESTDIR)$(PREFIX)/share/powershell/Modules/tea/tea.ps1"
|
||||
.PHONY: docs-check
|
||||
docs-check:
|
||||
@DIFF=$$($(GO) run docs/docs.go | diff docs/CLI.md -); \
|
||||
if [ -n "$$DIFF" ]; then \
|
||||
echo "Please run 'make docs' and commit the result:"; \
|
||||
echo "$$DIFF"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
|
||||
.PHONY: unit-test
|
||||
unit-test:
|
||||
@@ -120,17 +103,18 @@ unit-test:
|
||||
|
||||
.PHONY: integration-test
|
||||
integration-test:
|
||||
@test -n "$$GITEA_TEA_TEST_URL" || { echo 'Set GITEA_TEA_TEST_URL to a disposable Gitea instance' >&2; exit 1; }
|
||||
@test -r "$$GITEA_TEA_TEST_TOKEN_FILE" || { echo 'Set GITEA_TEA_TEST_TOKEN_FILE to a readable administrator token file' >&2; exit 1; }
|
||||
@test -r "$$GITEA_TEA_TEST_REVIEWER_TOKEN_FILE" || { echo 'Set GITEA_TEA_TEST_REVIEWER_TOKEN_FILE to a readable reviewer token file' >&2; exit 1; }
|
||||
$(GO) test -count=1 -race -run '^TestGitea' $(PACKAGES)
|
||||
@if [ -n "$(INTEGRATION_PACKAGES)" ]; then \
|
||||
$(GO) test $(INTEGRATION_TEST_GOFLAGS) -tags='$(INTEGRATION_TEST_TAGS)' $(INTEGRATION_PACKAGES); \
|
||||
else \
|
||||
echo "No integration test packages found"; \
|
||||
fi
|
||||
|
||||
.PHONY: test
|
||||
test: unit-test
|
||||
test: unit-test integration-test
|
||||
|
||||
.PHONY: unit-test-coverage
|
||||
unit-test-coverage:
|
||||
$(GO) test -race -cover -coverprofile coverage.out $(UNIT_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
||||
$(GO) test -cover -coverprofile coverage.out $(UNIT_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
|
||||
Reference in new issue
Block a user