aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2017-09-13 20:57:55 +0800
committerGitHub <noreply@github.com>2017-09-13 20:57:55 +0800
commit3e89e89670f3c3c4e4a63b178e38f5293e24736e (patch)
treea43e266ffafd292c1c73c17e91f34fc2bc402237 /Makefile
parent9ef83a98e5152b5ef4da8c228a3def6895dba82a (diff)
downloadgitea-3e89e89670f3c3c4e4a63b178e38f5293e24736e.tar.gz
gitea-3e89e89670f3c3c4e4a63b178e38f5293e24736e.zip
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 24 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 1d69a6d49c..58c6646204 100644
--- a/Makefile
+++ b/Makefile
@@ -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;\
+ mv pkg.coverage.out $$GOPATH/src/$$PKG/coverage.out;\
+ rm int.coverage.out;\
done;
.PHONY: unit-test-coverage
@@ -168,22 +169,24 @@ 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
@@ -191,16 +194,16 @@ 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)