1
-
2
1
ifeq ($(USE_REPO_TEST_DIR ) ,1)
3
2
4
3
# This rule replaces the whole Makefile when we're trying to use /tmp repository temporary files
@@ -110,7 +109,10 @@ TAGS ?=
110
109
TAGS_SPLIT := $(subst $(COMMA ) , ,$(TAGS ) )
111
110
TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR ) /tags
112
111
112
+ TEST_TAGS ?= sqlite sqlite_unlock_notify
113
+
113
114
GO_DIRS := cmd integrations models modules routers build services vendor tools
115
+
114
116
GO_SOURCES := $(wildcard * .go)
115
117
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)
116
118
@@ -339,8 +341,8 @@ watch-backend: go-check
339
341
340
342
.PHONY : test
341
343
test :
342
- @echo " Running go test..."
343
- @$(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' sqlite sqlite_unlock_notify ' $(GO_PACKAGES )
344
+ @echo " Running go test with -tags ' $( TEST_TAGS ) ' ..."
345
+ @$(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' $(TEST_TAGS) ' $(GO_PACKAGES )
344
346
345
347
.PHONY : test-check
346
348
test-check :
@@ -356,17 +358,17 @@ test-check:
356
358
357
359
.PHONY : test\# %
358
360
test\#% :
359
- @echo " Running go test..."
360
- @$(GO ) test -mod=vendor -tags=' sqlite sqlite_unlock_notify ' -run $(subst .,/,$* ) $(GO_PACKAGES )
361
+ @echo " Running go test with -tags ' $( TEST_TAGS ) ' ..."
362
+ @$(GO ) test -mod=vendor -tags=' $(TEST_TAGS) ' -run $(subst .,/,$* ) $(GO_PACKAGES )
361
363
362
364
.PHONY : coverage
363
365
coverage :
364
366
GO111MODULE=on $(GO ) run -mod=vendor build/gocovmerge.go integration.coverage.out $(shell find . -type f -name "coverage.out") > coverage.all
365
367
366
368
.PHONY : unit-test-coverage
367
369
unit-test-coverage :
368
- @echo " Running unit-test-coverage..."
369
- @$(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
370
+ @echo " Running unit-test-coverage -tags ' $( TEST_TAGS ) ' ..."
371
+ @$(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' $(TEST_TAGS) ' -cover -coverprofile coverage.out $(GO_PACKAGES ) && echo " \n==>\033[32m Ok\033[m\n" || exit 1
370
372
371
373
.PHONY : vendor
372
374
vendor :
@@ -387,15 +389,15 @@ generate-ini-sqlite:
387
389
388
390
.PHONY : test-sqlite
389
391
test-sqlite : integrations.sqlite.test generate-ini-sqlite
390
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
392
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
391
393
392
394
.PHONY : test-sqlite\# %
393
395
test-sqlite\#% : integrations.sqlite.test generate-ini-sqlite
394
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $(subst .,/,$* )
396
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $(subst .,/,$* )
395
397
396
398
.PHONY : test-sqlite-migration
397
399
test-sqlite-migration : migrations.sqlite.test generate-ini-sqlite
398
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
400
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
399
401
400
402
generate-ini-mysql :
401
403
sed -e ' s|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
@@ -407,15 +409,15 @@ generate-ini-mysql:
407
409
408
410
.PHONY : test-mysql
409
411
test-mysql : integrations.mysql.test generate-ini-mysql
410
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test
412
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test
411
413
412
414
.PHONY : test-mysql\# %
413
415
test-mysql\#% : integrations.mysql.test generate-ini-mysql
414
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.run $(subst .,/,$* )
416
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.run $(subst .,/,$* )
415
417
416
418
.PHONY : test-mysql-migration
417
419
test-mysql-migration : migrations.mysql.test generate-ini-mysql
418
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.mysql.test
420
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql.ini ./migrations.mysql.test
419
421
420
422
generate-ini-mysql8 :
421
423
sed -e ' s|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
@@ -427,15 +429,15 @@ generate-ini-mysql8:
427
429
428
430
.PHONY : test-mysql8
429
431
test-mysql8 : integrations.mysql8.test generate-ini-mysql8
430
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test
432
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test
431
433
432
434
.PHONY : test-mysql8\# %
433
435
test-mysql8\#% : integrations.mysql8.test generate-ini-mysql8
434
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test -test.run $(subst .,/,$* )
436
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql8.ini ./integrations.mysql8.test -test.run $(subst .,/,$* )
435
437
436
438
.PHONY : test-mysql8-migration
437
439
test-mysql8-migration : migrations.mysql8.test generate-ini-mysql8
438
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.mysql8.test
440
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql8.ini ./migrations.mysql8.test
439
441
440
442
generate-ini-pgsql :
441
443
sed -e ' s|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
@@ -448,15 +450,15 @@ generate-ini-pgsql:
448
450
449
451
.PHONY : test-pgsql
450
452
test-pgsql : integrations.pgsql.test generate-ini-pgsql
451
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test
453
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test
452
454
453
455
.PHONY : test-pgsql\# %
454
456
test-pgsql\#% : integrations.pgsql.test generate-ini-pgsql
455
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.run $(subst .,/,$* )
457
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.run $(subst .,/,$* )
456
458
457
459
.PHONY : test-pgsql-migration
458
460
test-pgsql-migration : migrations.pgsql.test generate-ini-pgsql
459
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.pgsql.test
461
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/pgsql.ini ./migrations.pgsql.test
460
462
461
463
generate-ini-mssql :
462
464
sed -e ' s|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \
@@ -468,35 +470,35 @@ generate-ini-mssql:
468
470
469
471
.PHONY : test-mssql
470
472
test-mssql : integrations.mssql.test generate-ini-mssql
471
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test
473
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test
472
474
473
475
.PHONY : test-mssql\# %
474
476
test-mssql\#% : integrations.mssql.test generate-ini-mssql
475
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.run $(subst .,/,$* )
477
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.run $(subst .,/,$* )
476
478
477
479
.PHONY : test-mssql-migration
478
480
test-mssql-migration : migrations.mssql.test generate-ini-mssql
479
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.mssql.test -test.failfast
481
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mssql.ini ./migrations.mssql.test -test.failfast
480
482
481
483
.PHONY : bench-sqlite
482
484
bench-sqlite : integrations.sqlite.test generate-ini-sqlite
483
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
485
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
484
486
485
487
.PHONY : bench-mysql
486
488
bench-mysql : integrations.mysql.test generate-ini-mysql
487
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
489
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
488
490
489
491
.PHONY : bench-mssql
490
492
bench-mssql : integrations.mssql.test generate-ini-mssql
491
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
493
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mssql.ini ./integrations.mssql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
492
494
493
495
.PHONY : bench-pgsql
494
496
bench-pgsql : integrations.pgsql.test generate-ini-pgsql
495
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
497
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/pgsql.ini ./integrations.pgsql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
496
498
497
499
.PHONY : integration-test-coverage
498
500
integration-test-coverage : integrations.cover.test generate-ini-mysql
499
- GITEA_ROOT=${ CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
501
+ GITEA_ROOT=" $( CURDIR) " GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
500
502
501
503
integrations.mysql.test : git-check $(GO_SOURCES )
502
504
$(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mysql.test
@@ -511,7 +513,7 @@ integrations.mssql.test: git-check $(GO_SOURCES)
511
513
$(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.mssql.test
512
514
513
515
integrations.sqlite.test : git-check $(GO_SOURCES )
514
- $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags ' sqlite sqlite_unlock_notify '
516
+ $(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags ' $(TEST_TAGS) '
515
517
516
518
integrations.cover.test : git-check $(GO_SOURCES )
517
519
$(GO ) test $(GOTESTFLAGS ) -mod=vendor -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(GO_PACKAGES ) | tr ' ' ',') -o integrations.cover.test
@@ -534,7 +536,7 @@ migrations.mssql.test: $(GO_SOURCES)
534
536
535
537
.PHONY : migrations.sqlite.test
536
538
migrations.sqlite.test : $(GO_SOURCES )
537
- $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags ' sqlite sqlite_unlock_notify '
539
+ $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags ' $(TEST_TAGS) '
538
540
539
541
.PHONY : check
540
542
check : test
@@ -694,11 +696,10 @@ generate-license:
694
696
generate-gitignore :
695
697
GO111MODULE=on $(GO ) run build/generate-gitignores.go
696
698
697
-
698
699
.PHONY : generate-images
699
700
generate-images :
700
- npm install --no-save --no-package-lock xmldom fabric imagemin-zopfli
701
- node build/generate-images.js
701
+ npm install --no-save --no-package-lock fabric imagemin-zopfli
702
+ node build/generate-images.js $( TAGS )
702
703
703
704
.PHONY : pr\# %
704
705
pr\#% : clean-all
@@ -710,7 +711,7 @@ golangci-lint:
710
711
export BINARY=" golangci-lint" ; \
711
712
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH ) /bin v1.31.0; \
712
713
fi
713
- golangci-lint run --timeout 5m
714
+ golangci-lint run --timeout 10m
714
715
715
716
.PHONY : docker
716
717
docker :
@@ -719,7 +720,7 @@ docker:
719
720
720
721
.PHONY : docker-build
721
722
docker-build :
722
- docker run -ti --rm -v $(CURDIR ) :/srv/app/src/code.gitea.io/gitea -w /srv/app/src/code.gitea.io/gitea -e TAGS=" bindata $( TAGS) " LDFLAGS=" $( LDFLAGS) " CGO_EXTRA_CFLAGS=" $( CGO_EXTRA_CFLAGS) " webhippie/golang:edge make clean build
723
+ docker run -ti --rm -v " $( CURDIR) :/srv/app/src/code.gitea.io/gitea" -w /srv/app/src/code.gitea.io/gitea -e TAGS=" bindata $( TAGS) " LDFLAGS=" $( LDFLAGS) " CGO_EXTRA_CFLAGS=" $( CGO_EXTRA_CFLAGS) " webhippie/golang:edge make clean build
723
724
724
725
# This endif closes the if at the top of the file
725
726
endif
0 commit comments