Merge branch 'main' into fix-524

This commit is contained in:
6543 2023-02-16 06:01:05 +08:00
commit 90e98063c8
4 changed files with 37 additions and 49 deletions

View File

@ -7,17 +7,10 @@ platform:
arch: amd64 arch: amd64
steps: steps:
- name: vendor
pull: always
image: golang:1.18
environment:
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
commands:
- make vendor # use vendor folder as cache
- name: build - name: build
pull: always pull: always
image: golang:1.18 image: golang:1.20
environment: environment:
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
commands: commands:
@ -34,7 +27,7 @@ steps:
- pull_request - pull_request
- name: unit-test - name: unit-test
image: golang:1.18 image: golang:1.20
commands: commands:
- make unit-test-coverage - make unit-test-coverage
settings: settings:
@ -49,7 +42,7 @@ steps:
- pull_request - pull_request
- name: release-test - name: release-test
image: golang:1.18 image: golang:1.20
commands: commands:
- make test - make test
settings: settings:
@ -65,7 +58,7 @@ steps:
- name: tag-test - name: tag-test
pull: always pull: always
image: golang:1.18 image: golang:1.20
commands: commands:
- make test - make test
settings: settings:
@ -77,7 +70,7 @@ steps:
- tag - tag
- name: static - name: static
image: golang:1.18 image: golang:1.20
environment: environment:
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
commands: commands:
@ -110,11 +103,16 @@ steps:
pull: always pull: always
image: woodpeckerci/plugin-s3:latest image: woodpeckerci/plugin-s3:latest
settings: settings:
acl: public-read acl:
bucket: gitea-artifacts from_secret: aws_s3_acl
region:
from_secret: aws_s3_region
bucket:
from_secret: aws_s3_bucket
endpoint: endpoint:
from_secret: aws_endpoint from_secret: aws_s3_endpoint
path_style: true path_style:
from_secret: aws_s3_path_style
source: "dist/release/*" source: "dist/release/*"
strip_prefix: dist/release/ strip_prefix: dist/release/
target: "/tea/${DRONE_TAG##v}" target: "/tea/${DRONE_TAG##v}"
@ -153,10 +151,16 @@ steps:
pull: always pull: always
image: woodpeckerci/plugin-s3:latest image: woodpeckerci/plugin-s3:latest
settings: settings:
acl: public-read acl:
bucket: gitea-artifacts from_secret: aws_s3_acl
region:
from_secret: aws_s3_region
bucket:
from_secret: aws_s3_bucket
endpoint: endpoint:
from_secret: aws_endpoint from_secret: aws_s3_endpoint
path_style:
from_secret: aws_s3_path_style
source: "dist/release/*" source: "dist/release/*"
strip_prefix: dist/release/ strip_prefix: dist/release/
target: /tea/main target: /tea/main

View File

@ -7,7 +7,6 @@
- [Bug reports](#bug-reports) - [Bug reports](#bug-reports)
- [Discuss your design](#discuss-your-design) - [Discuss your design](#discuss-your-design)
- [Testing redux](#testing-redux) - [Testing redux](#testing-redux)
- [Vendoring](#vendoring)
- [Code review](#code-review) - [Code review](#code-review)
- [Styleguide](#styleguide) - [Styleguide](#styleguide)
- [Sign-off your work](#sign-off-your-work) - [Sign-off your work](#sign-off-your-work)
@ -60,20 +59,6 @@ high-level discussions.
Before sending code out for review, run all the test by executing: `make test` Before sending code out for review, run all the test by executing: `make test`
Since TEA is an cli tool it should be obvious to test your feature locally first. Since TEA is an cli tool it should be obvious to test your feature locally first.
## Vendoring
We keep a cached copy of dependencies within the `vendor/` directory,
managing updates via [dep](https://github.com/golang/dep).
Pull requests should only include `vendor/` updates if they are part of
the same change, be it a bugfix or a feature addition.
The `vendor/` update needs to be justified as part of the PR description,
and must be verified by the reviewers and/or merger to always reference
an existing upstream commit.
You can find more information on how to get started with it on the [dep project website](https://golang.github.io/dep/docs/introduction.html).
## Code review ## Code review
Changes to TEA must be reviewed before they are accepted—no matter who Changes to TEA must be reviewed before they are accepted—no matter who
@ -175,7 +160,7 @@ maintainers](MAINTAINERS). Every PR **MUST** be reviewed by at least
two maintainers (or owners) before it can get merged. A maintainer two maintainers (or owners) before it can get merged. A maintainer
should be a contributor of Gitea (or Gogs) and contributed at least should be a contributor of Gitea (or Gogs) and contributed at least
4 accepted PRs. A contributor should apply as a maintainer in the 4 accepted PRs. A contributor should apply as a maintainer in the
[Discord](https://discord.gg/NsatcWJ) #develop channel. The owners [Discord](https://discord.gg/Gitea) #develop channel. The owners
or the team maintainers may invite the contributor. A maintainer or the team maintainers may invite the contributor. A maintainer
should spend some time on code reviews. If a maintainer has no should spend some time on code reviews. If a maintainer has no
time to do that, they should apply to leave the maintainers team time to do that, they should apply to leave the maintainers team
@ -208,7 +193,7 @@ https://help.github.com/articles/securing-your-account-with-two-factor-authentic
After the election, the new owners should proactively agree After the election, the new owners should proactively agree
with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the
[Discord](https://discord.gg/NsatcWJ) #general channel. Below are the [Discord](https://discord.gg/Gitea) #general channel. Below are the
words to speak: words to speak:
``` ```

View File

@ -7,7 +7,7 @@ SHASUM ?= shasum -a 256
export PATH := $($(GO) env GOPATH)/bin:$(PATH) export PATH := $($(GO) env GOPATH)/bin:$(PATH)
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go") GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
GOFMT ?= gofmt -s GOFMT ?= gofmt -s
ifneq ($(DRONE_TAG),) ifneq ($(DRONE_TAG),)
@ -28,9 +28,9 @@ SDK ?= $(shell $(GO) list -f '{{.Version}}' -m code.gitea.io/sdk/gitea)
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.SDK=$(SDK)" -s -w LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.SDK=$(SDK)" -s -w
# override to allow passing additional goflags via make CLI # override to allow passing additional goflags via make CLI
override GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)' override GOFLAGS := $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/) PACKAGES ?= $(shell $(GO) list ./...)
SOURCES ?= $(shell find . -name "*.go" -type f) SOURCES ?= $(shell find . -name "*.go" -type f)
# OS specific vars. # OS specific vars.
@ -48,7 +48,7 @@ all: build
.PHONY: clean .PHONY: clean
clean: clean:
$(GO) clean -mod=vendor -i ./... $(GO) clean -i ./...
rm -rf $(EXECUTABLE) $(DIST) rm -rf $(EXECUTABLE) $(DIST)
.PHONY: fmt .PHONY: fmt
@ -58,14 +58,14 @@ fmt:
.PHONY: vet .PHONY: vet
vet: vet:
# Default vet # Default vet
$(GO) vet -mod=vendor $(PACKAGES) $(GO) vet $(PACKAGES)
# Custom vet # Custom vet
$(GO) build -mod=vendor code.gitea.io/gitea-vet $(GO) build code.gitea.io/gitea-vet
$(GO) vet -vettool=gitea-vet $(PACKAGES) $(GO) vet -vettool=gitea-vet $(PACKAGES)
.PHONY: lint .PHONY: lint
lint: install-lint-tools lint: install-lint-tools
revive -config .revive.toml -exclude=./vendor/... ./... || exit 1 revive -config .revive.toml ./... || exit 1
.PHONY: misspell-check .PHONY: misspell-check
misspell-check: install-lint-tools misspell-check: install-lint-tools
@ -87,15 +87,15 @@ fmt-check:
.PHONY: test .PHONY: test
test: test:
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES) $(GO) test -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
.PHONY: unit-test-coverage .PHONY: unit-test-coverage
unit-test-coverage: unit-test-coverage:
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 $(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
.PHONY: vendor .PHONY: tidy
vendor: tidy:
$(GO) mod tidy && $(GO) mod vendor $(GO) mod tidy
.PHONY: check .PHONY: check
check: test check: test

View File

@ -117,7 +117,6 @@ Fork -> Patch -> Push -> Pull Request
- `make test` run testsuite - `make test` run testsuite
- `make vet` run checks (check the order of imports; preventing failure on CI pipeline beforehand) - `make vet` run checks (check the order of imports; preventing failure on CI pipeline beforehand)
- `make vendor` when adding new dependencies
- ... (for other development tasks, check the `Makefile`) - ... (for other development tasks, check the `Makefile`)
**Please** read the [CONTRIBUTING](CONTRIBUTING.md) documentation, it will tell you about internal structures and concepts. **Please** read the [CONTRIBUTING](CONTRIBUTING.md) documentation, it will tell you about internal structures and concepts.