add codecov.io service. (#2493)
* add codecov.io service. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * update Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * only PR or master branch (for coverage badge) Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * update Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * update init Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9ef83a98e5
commit
3e89e89670
4 changed files with 74 additions and 29 deletions
55
.drone.yml
55
.drone.yml
|
@ -34,10 +34,23 @@ pipeline:
|
||||||
environment:
|
environment:
|
||||||
TAGS: bindata sqlite
|
TAGS: bindata sqlite
|
||||||
GOPATH: /srv/app
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make unit-test-coverage
|
||||||
|
when:
|
||||||
|
event: [ push, pull_request ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: webhippie/golang:edge
|
||||||
|
pull: true
|
||||||
|
group: test
|
||||||
|
environment:
|
||||||
|
TAGS: bindata
|
||||||
|
GOPATH: /srv/app
|
||||||
commands:
|
commands:
|
||||||
- make test
|
- make test
|
||||||
when:
|
when:
|
||||||
event: [ push, tag, pull_request ]
|
event: [ tag ]
|
||||||
|
|
||||||
# Commented until db locking have been resolved!
|
# Commented until db locking have been resolved!
|
||||||
# test-sqlite:
|
# test-sqlite:
|
||||||
|
@ -52,6 +65,19 @@ pipeline:
|
||||||
# when:
|
# when:
|
||||||
# event: [ push, tag, pull_request ]
|
# event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
|
test-mysql:
|
||||||
|
image: webhippie/golang:edge
|
||||||
|
pull: true
|
||||||
|
group: test
|
||||||
|
environment:
|
||||||
|
TAGS: bindata
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make integration-test-coverage
|
||||||
|
when:
|
||||||
|
event: [ push, pull_request ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
test-mysql:
|
test-mysql:
|
||||||
image: webhippie/golang:edge
|
image: webhippie/golang:edge
|
||||||
pull: true
|
pull: true
|
||||||
|
@ -62,7 +88,7 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- make test-mysql
|
- make test-mysql
|
||||||
when:
|
when:
|
||||||
event: [ push, tag, pull_request ]
|
event: [ tag ]
|
||||||
|
|
||||||
test-pgsql:
|
test-pgsql:
|
||||||
image: webhippie/golang:edge
|
image: webhippie/golang:edge
|
||||||
|
@ -76,11 +102,26 @@ pipeline:
|
||||||
when:
|
when:
|
||||||
event: [ push, tag, pull_request ]
|
event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
# coverage:
|
generate-coverage:
|
||||||
# image: plugins/coverage:latest
|
image: webhippie/golang:edge
|
||||||
# pull: true
|
pull: true
|
||||||
# secrets: [ github_token ]
|
environment:
|
||||||
# server: https://coverage.gitea.io
|
TAGS: bindata
|
||||||
|
GOPATH: /srv/app
|
||||||
|
commands:
|
||||||
|
- make coverage
|
||||||
|
when:
|
||||||
|
event: [ push, pull_request ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
image: robertstettner/drone-codecov
|
||||||
|
secrets: [ codecov_token ]
|
||||||
|
files:
|
||||||
|
- coverage.all
|
||||||
|
when:
|
||||||
|
event: [ push, pull_request ]
|
||||||
|
branch: [ master ]
|
||||||
|
|
||||||
static:
|
static:
|
||||||
image: karalabe/xgo-latest:latest
|
image: karalabe/xgo-latest:latest
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -30,6 +30,7 @@ _testmain.go
|
||||||
*.prof
|
*.prof
|
||||||
|
|
||||||
*coverage.out
|
*coverage.out
|
||||||
|
coverage.all
|
||||||
|
|
||||||
/modules/options/bindata.go
|
/modules/options/bindata.go
|
||||||
/modules/public/bindata.go
|
/modules/public/bindata.go
|
||||||
|
|
25
Makefile
25
Makefile
|
@ -135,14 +135,15 @@ test: fmt-check
|
||||||
$(GO) test $(PACKAGES)
|
$(GO) test $(PACKAGES)
|
||||||
|
|
||||||
.PHONY: coverage
|
.PHONY: coverage
|
||||||
coverage: unit-test-coverage integration-test-coverage
|
coverage:
|
||||||
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
$(GO) get -u github.com/wadey/gocovmerge; \
|
$(GO) get -u github.com/wadey/gocovmerge; \
|
||||||
fi
|
fi
|
||||||
|
echo "mode: set" > coverage.all
|
||||||
for PKG in $(PACKAGES); do\
|
for PKG in $(PACKAGES); do\
|
||||||
touch $$GOPATH/src/$$PKG/coverage.out;\
|
|
||||||
egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
|
egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
|
||||||
gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
|
gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
|
||||||
|
grep -h -v "^mode:" pkg.coverage.out >> coverage.all;\
|
||||||
mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
|
mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
|
||||||
rm int.coverage.out;\
|
rm int.coverage.out;\
|
||||||
done;
|
done;
|
||||||
|
@ -168,22 +169,24 @@ test-vendor:
|
||||||
test-sqlite: integrations.sqlite.test
|
test-sqlite: integrations.sqlite.test
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
|
||||||
|
|
||||||
.PHONY: test-mysql
|
generate-ini:
|
||||||
test-mysql: integrations.mysql.test
|
|
||||||
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
|
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
|
||||||
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
|
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
|
||||||
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
|
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
|
||||||
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
|
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
|
||||||
integrations/mysql.ini.tmpl > integrations/mysql.ini
|
integrations/mysql.ini.tmpl > integrations/mysql.ini
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test
|
|
||||||
|
|
||||||
.PHONY: test-pgsql
|
|
||||||
test-pgsql: integrations.pgsql.test
|
|
||||||
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
|
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
|
||||||
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
|
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
|
||||||
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
|
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
|
||||||
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
|
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
|
||||||
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
|
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
|
||||||
|
|
||||||
|
.PHONY: test-mysql
|
||||||
|
test-mysql: integrations.mysql.test generate-ini
|
||||||
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test
|
||||||
|
|
||||||
|
.PHONY: test-pgsql
|
||||||
|
test-pgsql: integrations.pgsql.test generate-ini
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test
|
||||||
|
|
||||||
.PHONY: bench-sqlite
|
.PHONY: bench-sqlite
|
||||||
|
@ -191,16 +194,16 @@ bench-sqlite: integrations.sqlite.test
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.bench .
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.bench .
|
||||||
|
|
||||||
.PHONY: bench-mysql
|
.PHONY: bench-mysql
|
||||||
bench-mysql: integrations.mysql.test
|
bench-mysql: integrations.mysql.test generate-ini
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.bench .
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.bench .
|
||||||
|
|
||||||
.PHONY: bench-pgsql
|
.PHONY: bench-pgsql
|
||||||
bench-pgsql: integrations.pgsql.test
|
bench-pgsql: integrations.pgsql.test generate-ini
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.bench .
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.bench .
|
||||||
|
|
||||||
|
|
||||||
.PHONY: integration-test-coverage
|
.PHONY: integration-test-coverage
|
||||||
integration-test-coverage: integrations.cover.test
|
integration-test-coverage: integrations.cover.test generate-ini
|
||||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
|
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
|
||||||
|
|
||||||
integrations.mysql.test: $(SOURCES)
|
integrations.mysql.test: $(SOURCES)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
[![Join the Discord chat at https://discord.gg/NsatcWJ](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/NsatcWJ)
|
[![Join the Discord chat at https://discord.gg/NsatcWJ](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/NsatcWJ)
|
||||||
[![Join the Matrix chat at https://matrix.to/#/#gitea:matrix.org](https://img.shields.io/badge/matrix-%23gitea%3Amatrix.org-7bc9a4.svg)](https://matrix.to/#/#gitea:matrix.org)
|
[![Join the Matrix chat at https://matrix.to/#/#gitea:matrix.org](https://img.shields.io/badge/matrix-%23gitea%3Amatrix.org-7bc9a4.svg)](https://matrix.to/#/#gitea:matrix.org)
|
||||||
[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
[![](https://images.microbadger.com/badges/image/gitea/gitea.svg)](https://microbadger.com/images/gitea/gitea "Get your own image badge on microbadger.com")
|
||||||
[![Coverage Status](https://coverage.gitea.io/badges/go-gitea/gitea/coverage.svg)](https://coverage.gitea.io/go-gitea/gitea)
|
[![codecov](https://codecov.io/gh/go-gitea/gitea/branch/master/graph/badge.svg)](https://codecov.io/gh/go-gitea/gitea)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
|
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
|
||||||
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
|
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
|
||||||
[![Release](https://github-release-version.herokuapp.com/github/go-gitea/gitea/release.svg?style=flat)](https://github.com/go-gitea/gitea/releases/latest)
|
[![Release](https://github-release-version.herokuapp.com/github/go-gitea/gitea/release.svg?style=flat)](https://github.com/go-gitea/gitea/releases/latest)
|
||||||
|
|
Loading…
Reference in a new issue