@ -1,3 +1,20 @@
i f e q ( $( USE_REPO_TEST_DIR ) , 1 )
# This rule replaces the whole Makefile when we're trying to use /tmp repository temporary files
location = $( CURDIR) /$( word $( words $( MAKEFILE_LIST) ) ,$( MAKEFILE_LIST) )
self := $( location)
% :
@tmpdir= ` mktemp --tmpdir -d` ; \
echo Using temporary directory $$ tmpdir for test repositories ; \
USE_REPO_TEST_DIR = $( MAKE) -f $( self) --no-print-directory REPO_TEST_DIR = $$ tmpdir/ $@ ; \
STATUS = $$ ? ; rm -r " $$ tmpdir " ; exit $$ STATUS
e l s e
# This is the "normal" part of the Makefile
DIST := dist
DIST := dist
DIST_DIRS := $( DIST) /binaries $( DIST) /release
DIST_DIRS := $( DIST) /binaries $( DIST) /release
IMPORT := code.gitea.io/gitea
IMPORT := code.gitea.io/gitea
@ -321,16 +338,20 @@ test-vendor: vendor
exit 1; \
exit 1; \
fi ;
fi ;
generate-ini-sqlite :
sed -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
integrations/sqlite.ini.tmpl > integrations/sqlite.ini
.PHONY : test -sqlite
.PHONY : test -sqlite
test-sqlite : integrations .sqlite .test
test-sqlite : integrations .sqlite .test generate -ini -sqlite
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test
.PHONY : test -sqlite \#%
.PHONY : test -sqlite \#%
test-sqlite\#% : integrations .sqlite .test
test-sqlite\#% : integrations .sqlite .test generate -ini -sqlite
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test -test.run $( subst .,/,$* )
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test -test.run $( subst .,/,$* )
.PHONY : test -sqlite -migration
.PHONY : test -sqlite -migration
test-sqlite-migration : migrations .sqlite .test
test-sqlite-migration : migrations .sqlite .test generate -ini -sqlite
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./migrations.sqlite.test
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./migrations.sqlite.test
generate-ini-mysql :
generate-ini-mysql :
@ -338,6 +359,7 @@ generate-ini-mysql:
-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' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
integrations/mysql.ini.tmpl > integrations/mysql.ini
integrations/mysql.ini.tmpl > integrations/mysql.ini
.PHONY : test -mysql
.PHONY : test -mysql
@ -357,6 +379,7 @@ generate-ini-mysql8:
-e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
-e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
-e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
-e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
-e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
-e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
.PHONY : test -mysql 8
.PHONY : test -mysql 8
@ -377,6 +400,7 @@ generate-ini-pgsql:
-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' \
-e 's|{{TEST_PGSQL_SCHEMA}}|${TEST_PGSQL_SCHEMA}|g' \
-e 's|{{TEST_PGSQL_SCHEMA}}|${TEST_PGSQL_SCHEMA}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
integrations/pgsql.ini.tmpl > integrations/pgsql.ini
.PHONY : test -pgsql
.PHONY : test -pgsql
@ -396,6 +420,7 @@ generate-ini-mssql:
-e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
-e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
-e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
-e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \
-e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
-e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \
-e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
integrations/mssql.ini.tmpl > integrations/mssql.ini
integrations/mssql.ini.tmpl > integrations/mssql.ini
.PHONY : test -mssql
.PHONY : test -mssql
@ -411,7 +436,7 @@ test-mssql-migration: migrations.mssql.test generate-ini-mssql
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/mssql.ini ./migrations.mssql.test
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/mssql.ini ./migrations.mssql.test
.PHONY : bench -sqlite
.PHONY : bench -sqlite
bench-sqlite : integrations .sqlite .test
bench-sqlite : integrations .sqlite .test generate -ini -sqlite
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile= cpu.out -test.run DontRunTests -test.bench .
GITEA_ROOT = ${ CURDIR } GITEA_CONF = integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile= cpu.out -test.run DontRunTests -test.bench .
.PHONY : bench -mysql
.PHONY : bench -mysql
@ -627,3 +652,6 @@ golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $( GOPATH) /bin v1.24.0; \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $( GOPATH) /bin v1.24.0; \
fi
fi
golangci-lint run --timeout 5m
golangci-lint run --timeout 5m
# This endif closes the if at the top of the file
e n d i f