@@ -26,7 +26,7 @@ COMMA := ,
26
26
27
27
XGO_VERSION := go-1.16.x
28
28
MIN_GO_VERSION := 001014000
29
- MIN_NODE_VERSION := 010013000
29
+ MIN_NODE_VERSION := 012017000
30
30
31
31
DOCKER_IMAGE ?= gitea/gitea
32
32
DOCKER_TAG ?= latest
@@ -91,9 +91,7 @@ LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
91
91
92
92
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/models/migrations code.gitea.io/gitea/integrations/migration-test code.gitea.io/gitea/integrations,$(shell $(GO ) list -mod=vendor ./... | grep -v /vendor/) )
93
93
94
- FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
95
- FOMANTIC_DEST := web_src/fomantic/build/semantic.js web_src/fomantic/build/semantic.css
96
- FOMANTIC_DEST_DIR := web_src/fomantic/build
94
+ FOMANTIC_WORK_DIR := web_src/fomantic
97
95
98
96
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
99
97
WEBPACK_CONFIGS := webpack.config.js
@@ -113,6 +111,8 @@ TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags
113
111
114
112
TEST_TAGS ?= sqlite sqlite_unlock_notify
115
113
114
+ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE ) $(FOMANTIC_WORK_DIR ) /node_modules $(DIST ) $(MAKE_EVIDENCE_DIR ) $(AIR_TMP_DIR )
115
+
116
116
GO_DIRS := cmd integrations models modules routers build services vendor tools
117
117
118
118
GO_SOURCES := $(wildcard * .go)
@@ -171,6 +171,9 @@ help:
171
171
@echo " - checks run various consistency checks"
172
172
@echo " - checks-frontend check frontend files"
173
173
@echo " - checks-backend check backend files"
174
+ @echo " - test test everything"
175
+ @echo " - test-frontend test frontend files"
176
+ @echo " - test-backend test backend files"
174
177
@echo " - webpack build webpack files"
175
178
@echo " - svg build svg files"
176
179
@echo " - fomantic build fomantic files"
@@ -320,7 +323,7 @@ lint: lint-frontend lint-backend
320
323
321
324
.PHONY : lint-frontend
322
325
lint-frontend : node_modules
323
- npx eslint --color --max-warnings=0 web_src/js build templates webpack .config.js
326
+ npx eslint --color --max-warnings=0 web_src/js build templates * .config.js
324
327
npx stylelint --color --max-warnings=0 web_src/less
325
328
326
329
.PHONY : lint-backend
@@ -343,16 +346,23 @@ watch-backend: go-check
343
346
air -c .air.conf
344
347
345
348
.PHONY : test
346
- test :
349
+ test : test-frontend test-backend
350
+
351
+ .PHONY : test-backend
352
+ test-backend :
347
353
@echo " Running go test with -tags '$( TEST_TAGS) '..."
348
354
@$(GO ) test $(GOTESTFLAGS ) -mod=vendor -tags=' $(TEST_TAGS)' $(GO_PACKAGES )
349
355
356
+ .PHONY : test-frontend
357
+ test-frontend :
358
+ @NODE_OPTIONS=" --experimental-vm-modules --no-warnings" npx jest --color
359
+
350
360
.PHONY : test-check
351
361
test-check :
352
362
@echo " Running test-check..." ;
353
363
@diff=$$(git status -s ) ; \
354
364
if [ -n " $$ diff" ]; then \
355
- echo " make test has changed files in the source tree:" ; \
365
+ echo " make test-backend has changed files in the source tree:" ; \
356
366
echo " $$ {diff}" ; \
357
367
echo " You should change the tests to create these files in a temporary directory." ; \
358
368
echo " Do not simply add these files to .gitignore" ; \
@@ -577,7 +587,7 @@ install: $(wildcard *.go)
577
587
build : frontend backend
578
588
579
589
.PHONY : frontend
580
- frontend : node-check $(WEBPACK_DEST )
590
+ frontend : $(WEBPACK_DEST )
581
591
582
592
.PHONY : backend
583
593
backend : go-check generate $(EXECUTABLE )
@@ -642,9 +652,11 @@ release-compress: | $(DIST_DIRS)
642
652
cd $(DIST ) /release/; for file in ` find . -type f -name " *" ` ; do echo " compressing $$ {file}" && gxz -k -9 $$ {file}; done ;
643
653
644
654
.PHONY : release-sources
645
- release-sources : | $(DIST_DIRS ) node_modules
655
+ release-sources : | $(DIST_DIRS )
646
656
echo $(VERSION ) > $(STORED_VERSION_FILE )
647
- tar --exclude=./$(DIST ) --exclude=./.git --exclude=./$(MAKE_EVIDENCE_DIR ) --exclude=./node_modules/.cache --exclude=./$(AIR_TMP_DIR ) -czf $(DIST ) /release/gitea-src-$(VERSION ) .tar.gz .
657
+ # bsdtar needs a ^ to prevent matching subdirectories
658
+ $(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
659
+ tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
648
660
rm -f $(STORED_VERSION_FILE)
649
661
650
662
.PHONY : release-docs
@@ -670,22 +682,18 @@ npm-update: node-check | node_modules
670
682
@touch node_modules
671
683
672
684
.PHONY : fomantic
673
- fomantic : $(FOMANTIC_DEST )
674
-
675
- $(FOMANTIC_DEST ) : $(FOMANTIC_CONFIGS ) | node_modules
676
- @if [ ! -d node_modules/fomantic-ui ]; then \
677
- npm install --no-save --no-package-lock
[email protected] ; \
678
- fi
679
- rm -rf $(FOMANTIC_DEST_DIR )
680
- cp -f web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config
681
- cp -rf web_src/fomantic/_site/* node_modules/fomantic-ui/src/_site/
682
- npx gulp -f node_modules/fomantic-ui/gulpfile.js build
683
- @touch $(FOMANTIC_DEST )
685
+ fomantic :
686
+ rm -rf $(FOMANTIC_WORK_DIR ) /build
687
+ cd $(FOMANTIC_WORK_DIR ) && npm install --no-save
688
+ cp -f $(FOMANTIC_WORK_DIR ) /theme.config.less $(FOMANTIC_WORK_DIR ) /node_modules/fomantic-ui/src/theme.config
689
+ cp -rf $(FOMANTIC_WORK_DIR ) /_site $(FOMANTIC_WORK_DIR ) /node_modules/fomantic-ui/src/
690
+ cd $(FOMANTIC_WORK_DIR ) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build
684
691
685
692
.PHONY : webpack
686
693
webpack : $(WEBPACK_DEST )
687
694
688
- $(WEBPACK_DEST ) : $(WEBPACK_SOURCES ) $(WEBPACK_CONFIGS ) package-lock.json | node_modules
695
+ $(WEBPACK_DEST ) : $(WEBPACK_SOURCES ) $(WEBPACK_CONFIGS ) package-lock.json
696
+ @$(MAKE ) -s node-check node_modules
689
697
rm -rf $(WEBPACK_DEST_ENTRIES )
690
698
npx webpack
691
699
@touch $(WEBPACK_DEST )
0 commit comments