forked from nextcloud/polls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (100 loc) · 3.01 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
# @author Bernhard Posselt <[email protected]>
# @author Vinzenz Rosenkranz <[email protected]>
# @author René Gieling <[email protected]>
# @copyright Bernhard Posselt 2016
# Dependencies:
# * make
# * which
# * npm
# * curl: used if phpunit and composer are not installed to fetch them from the web
# * tar: for building the archive
app_name=polls
project_dir=.
build_dir=./build
build_tools_dir=$(build_dir)/tools
build_source_dir=$(build_dir)/source
appstore_build_dir=$(build_dir)/artifacts/appstore
appstore_package_name=$(appstore_build_dir)/$(app_name)
nc_cert_dir=$(HOME)/.nextcloud/certificates
composer=$(shell which composer 2> /dev/null)
version=$(shell node -p -e "require('./package.json').version")
# all steps for an appstore release
appstore: setup-build build-js-production package
# install deps for release package
setup-build: setup-build-composer npm-init
# install deps for ci (tests and analysis)
setup-dev: setup-dev-composer npm-init
# install composer deps for ci (tests and analysis)
setup-build-composer: composer
composer install --no-dev -o
# install composer deps for release package
setup-dev-composer: composer
composer install -o
# install node deps
npm-init:
npm ci
# remove build dir
clean:
rm -rf $(build_dir)
# remove deps
clean-dev: clean
rm -rf node_modules
rm -rf ./vendor
# lint js, css and php
lint:
npm run lint
npm run stylelint
composer run cs:check
# lint fix js, css and php
lint-fix:
npm run lint:fix
npm run stylelint:fix
composer run cs:fix
cs:
composer run cs:check
cs-fix:
composer run cs:fix
# build vue app
build-js-production:
npm run build
# install composer, if not installed
.PHONY: composer
composer:
ifeq (,$(composer))
@echo "No composer command available, downloading a copy from the web"
mkdir -p $(build_tools_dir)
curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_dir)
php $(build_tools_dir)/composer.phar install --prefer-dist
php $(build_tools_dir)/composer.phar update --prefer-dist
endif
# Builds the source package for the appstore
# signs, if certificate is present
package: clean
mkdir -p $(build_source_dir)
mkdir -p $(appstore_build_dir)
rsync -zarh \
$(project_dir)/appinfo \
$(project_dir)/img \
$(project_dir)/js \
$(project_dir)/l10n \
$(project_dir)/lib \
$(project_dir)/templates \
$(project_dir)/vendor \
$(project_dir)/COPYING \
$(project_dir)/README.md \
$(project_dir)/CHANGELOG.md \
--exclude="vendor/bin" \
$(build_source_dir)/$(app_name)
tar -czf $(appstore_package_name).tar.gz \
--directory="$(build_source_dir)" $(app_name)
@if [ -f $(nc_cert_dir)/$(app_name).key ]; then \
echo "Signing package..."; \
openssl dgst -sha512 -sign $(nc_cert_dir)/$(app_name).key $(appstore_build_dir)/$(app_name).tar.gz | openssl base64; \
fi
.PHONY: test
test: composer setup-dev-composer
phpunit --coverage-clover clover.xml -c tests/phpunit.xml
phpunit -c phpunit.integration.xml