-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add_review_requst_fun
- Loading branch information
Showing
195 changed files
with
16,399 additions
and
1,344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
DIST := dist | ||
DIST_DIRS := $(DIST)/binaries $(DIST)/release | ||
IMPORT := code.gitea.io/gitea | ||
export GO111MODULE=off | ||
export GO111MODULE=on | ||
|
||
GO ?= go | ||
SED_INPLACE := sed -i | ||
|
@@ -66,7 +66,7 @@ endif | |
|
||
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" | ||
|
||
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/))) | ||
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list -mod=vendor ./... | grep -v /vendor/))) | ||
|
||
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f) | ||
WEBPACK_CONFIGS := webpack.config.js | ||
|
@@ -80,7 +80,7 @@ TAGS ?= | |
TAGS_SPLIT := $(subst $(COMMA), ,$(TAGS)) | ||
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags | ||
|
||
GO_DIRS := cmd integrations models modules routers scripts services vendor | ||
GO_DIRS := cmd integrations models modules routers build services vendor | ||
GO_SOURCES := $(wildcard *.go) | ||
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go) | ||
|
||
|
@@ -95,7 +95,7 @@ FOMANTIC_DEST := public/fomantic/semantic.min.js public/fomantic/semantic.min.cs | |
FOMANTIC_DEST_DIR := public/fomantic | ||
|
||
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/[email protected] | ||
SWAGGER := GO111MODULE=on $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger | ||
SWAGGER := $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger | ||
SWAGGER_SPEC := templates/swagger/v1_json.tmpl | ||
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g | ||
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g | ||
|
@@ -234,10 +234,7 @@ errcheck: | |
|
||
.PHONY: revive | ||
revive: | ||
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ | ||
$(GO) get -u github.com/mgechev/revive; \ | ||
fi | ||
revive -config .revive.toml -exclude=./vendor/... ./... || exit 1 | ||
GO111MODULE=on $(GO) run -mod=vendor build/lint.go -config .revive.toml -exclude=./vendor/... ./... || exit 1 | ||
|
||
.PHONY: misspell-check | ||
misspell-check: | ||
|
@@ -276,7 +273,7 @@ lint-frontend: node_modules | |
|
||
.PHONY: test | ||
test: | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES) | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES) | ||
|
||
.PHONY: test-check | ||
test-check: | ||
|
@@ -292,22 +289,19 @@ test-check: | |
|
||
.PHONY: test\#% | ||
test\#%: | ||
GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(GO_PACKAGES) | ||
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(GO_PACKAGES) | ||
|
||
.PHONY: coverage | ||
coverage: | ||
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ | ||
$(GO) get -u github.com/wadey/gocovmerge; \ | ||
fi | ||
gocovmerge integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all;\ | ||
GO111MODULE=on $(GO) run -mod=vendor build/gocovmerge.go integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all | ||
|
||
.PHONY: unit-test-coverage | ||
unit-test-coverage: | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 | ||
|
||
.PHONY: vendor | ||
vendor: | ||
GO111MODULE=on $(GO) mod tidy && GO111MODULE=on $(GO) mod vendor | ||
$(GO) mod tidy && $(GO) mod vendor | ||
|
||
.PHONY: test-vendor | ||
test-vendor: vendor | ||
|
@@ -428,22 +422,22 @@ integration-test-coverage: integrations.cover.test generate-ini-mysql | |
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out | ||
|
||
integrations.mysql.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test | ||
|
||
integrations.mysql8.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql8.test | ||
|
||
integrations.pgsql.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.pgsql.test | ||
|
||
integrations.mssql.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test | ||
|
||
integrations.sqlite.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify' | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify' | ||
|
||
integrations.cover.test: git-check $(GO_SOURCES) | ||
GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.test | ||
$(GO) test $(GOTESTFLAGS) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES) | tr ' ' ',') -o integrations.cover.test | ||
|
||
.PHONY: migrations.mysql.test | ||
migrations.mysql.test: $(GO_SOURCES) | ||
|
@@ -483,10 +477,10 @@ backend: go-check generate $(EXECUTABLE) | |
|
||
.PHONY: generate | ||
generate: $(TAGS_PREREQ) | ||
GO111MODULE=on $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES) | ||
$(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES) | ||
|
||
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) | ||
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ | ||
$(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ | ||
|
||
.PHONY: release | ||
release: frontend generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check | ||
|
@@ -623,4 +617,4 @@ golangci-lint: | |
export BINARY="golangci-lint"; \ | ||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \ | ||
fi | ||
env GO111MODULE=on golangci-lint run --timeout 5m | ||
golangci-lint run --timeout 5m |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// Copyright 2020 The Gitea Authors. All rights reserved. | ||
// Copyright (c) 2015, Wade Simmons | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// gocovmerge takes the results from multiple `go test -coverprofile` runs and | ||
// merges them into one profile | ||
|
||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"io" | ||
"log" | ||
"os" | ||
"sort" | ||
|
||
"golang.org/x/tools/cover" | ||
) | ||
|
||
func mergeProfiles(p *cover.Profile, merge *cover.Profile) { | ||
if p.Mode != merge.Mode { | ||
log.Fatalf("cannot merge profiles with different modes") | ||
} | ||
// Since the blocks are sorted, we can keep track of where the last block | ||
// was inserted and only look at the blocks after that as targets for merge | ||
startIndex := 0 | ||
for _, b := range merge.Blocks { | ||
startIndex = mergeProfileBlock(p, b, startIndex) | ||
} | ||
} | ||
|
||
func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int { | ||
sortFunc := func(i int) bool { | ||
pi := p.Blocks[i+startIndex] | ||
return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol) | ||
} | ||
|
||
i := 0 | ||
if sortFunc(i) != true { | ||
i = sort.Search(len(p.Blocks)-startIndex, sortFunc) | ||
} | ||
i += startIndex | ||
if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol { | ||
if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol { | ||
log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb) | ||
} | ||
switch p.Mode { | ||
case "set": | ||
p.Blocks[i].Count |= pb.Count | ||
case "count", "atomic": | ||
p.Blocks[i].Count += pb.Count | ||
default: | ||
log.Fatalf("unsupported covermode: '%s'", p.Mode) | ||
} | ||
} else { | ||
if i > 0 { | ||
pa := p.Blocks[i-1] | ||
if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) { | ||
log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb) | ||
} | ||
} | ||
if i < len(p.Blocks)-1 { | ||
pa := p.Blocks[i+1] | ||
if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) { | ||
log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb) | ||
} | ||
} | ||
p.Blocks = append(p.Blocks, cover.ProfileBlock{}) | ||
copy(p.Blocks[i+1:], p.Blocks[i:]) | ||
p.Blocks[i] = pb | ||
} | ||
return i + 1 | ||
} | ||
|
||
func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile { | ||
i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName }) | ||
if i < len(profiles) && profiles[i].FileName == p.FileName { | ||
mergeProfiles(profiles[i], p) | ||
} else { | ||
profiles = append(profiles, nil) | ||
copy(profiles[i+1:], profiles[i:]) | ||
profiles[i] = p | ||
} | ||
return profiles | ||
} | ||
|
||
func dumpProfiles(profiles []*cover.Profile, out io.Writer) { | ||
if len(profiles) == 0 { | ||
return | ||
} | ||
fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode) | ||
for _, p := range profiles { | ||
for _, b := range p.Blocks { | ||
fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count) | ||
} | ||
} | ||
} | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
var merged []*cover.Profile | ||
|
||
for _, file := range flag.Args() { | ||
profiles, err := cover.ParseProfiles(file) | ||
if err != nil { | ||
log.Fatalf("failed to parse profiles: %v", err) | ||
} | ||
for _, p := range profiles { | ||
merged = addProfile(merged, p) | ||
} | ||
} | ||
|
||
dumpProfiles(merged, os.Stdout) | ||
} |
Oops, something went wrong.