Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add codecov.io service. #2493

Merged
merged 5 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 48 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,23 @@ pipeline:
environment:
TAGS: bindata sqlite
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:
- make test
when:
event: [ push, tag, pull_request ]
event: [ tag ]

# Commented until db locking have been resolved!
# test-sqlite:
Expand All @@ -52,6 +65,19 @@ pipeline:
# when:
# 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:
image: webhippie/golang:edge
pull: true
Expand All @@ -62,7 +88,7 @@ pipeline:
commands:
- make test-mysql
when:
event: [ push, tag, pull_request ]
event: [ tag ]

test-pgsql:
image: webhippie/golang:edge
Expand All @@ -76,11 +102,26 @@ pipeline:
when:
event: [ push, tag, pull_request ]

# coverage:
# image: plugins/coverage:latest
# pull: true
# secrets: [ github_token ]
# server: https://coverage.gitea.io
generate-coverage:
image: webhippie/golang:edge
pull: true
environment:
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:
image: karalabe/xgo-latest:latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ _testmain.go
*.prof

*coverage.out
coverage.all

/modules/options/bindata.go
/modules/public/bindata.go
Expand Down
45 changes: 24 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,17 @@ test: fmt-check
$(GO) test $(PACKAGES)

.PHONY: coverage
coverage: unit-test-coverage integration-test-coverage
coverage:
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/wadey/gocovmerge; \
fi
echo "mode: set" > coverage.all
for PKG in $(PACKAGES); do\
touch $$GOPATH/src/$$PKG/coverage.out;\
egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
rm int.coverage.out;\
egrep "$$PKG[^/]*\.go" integration.coverage.out > int.coverage.out;\
gocovmerge $$GOPATH/src/$$PKG/coverage.out int.coverage.out > pkg.coverage.out;\
grep -h -v "^mode:" pkg.coverage.out >> coverage.all;\
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add this line and convert space to tabs.

mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
rm int.coverage.out;\
done;

.PHONY: unit-test-coverage
Expand All @@ -168,39 +169,41 @@ test-vendor:
test-sqlite: integrations.sqlite.test
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test

.PHONY: test-mysql
test-mysql: integrations.mysql.test
generate-ini:
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
integrations/mysql.ini.tmpl > integrations/mysql.ini
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
integrations/mysql.ini.tmpl > integrations/mysql.ini
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
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
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
-e 's|{{TEST_PGSQL_PASSWORD}}|${TEST_PGSQL_PASSWORD}|g' \
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
test-pgsql: integrations.pgsql.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test

.PHONY: bench-sqlite
bench-sqlite: integrations.sqlite.test
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.bench .

.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 .

.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 .


.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

integrations.mysql.test: $(SOURCES)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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")
[![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)
[![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)
Expand Down