forked from XeroOl/mirin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (40 loc) · 1.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.PHONY: format lint test coverage clean
# run "make VERSION=x.y.z" to specify version
VERSION=git-$(shell git rev-parse --short HEAD)
FILENAME=mirin-template-$(VERSION)
$(FILENAME).zip: lint test
mkdir -p build
cp -r Song.ogg Song.sm lua template build
sed 's/$$VERSION/'"$(VERSION)"'/' build/template/main.xml -i
(cd build && zip ../"$(FILENAME)".zip . -r)
rm build -rf
format:
stylua template
lint:
stylua -c template || (echo "If this fails, run 'make format' to reformat the code" && false)
luacheck template
test:
busted --suppress-pending
stylua -c template
luacheck template
coverage:
rm -rf luacov.report.out
rm -rf luacov.stats.out
busted --coverage --suppress-pending || true
luacov
awk 't&&(--l<0){print}/Summary/{t=1;l=1}' luacov.report.out
ifdef GITHUB_OUTPUT
awk '/Total/{print "coverage=" int($$NF)}' luacov.report.out >> $(GITHUB_OUTPUT)
endif
lcov:
rm -rf luacov.report.out
rm -rf luacov.stats.out
busted --coverage --suppress-pending || true
luacov -r lcov
clean:
# from the default target
rm -rf build
rm -rf "$(FILENAME).zip"
# from coverage
rm -rf luacov.report.out
rm -rf luacov.stats.out