polls/Makefile

104 строки
2.6 KiB
Makefile
Исходник Постоянная ссылка Обычный вид История

2024-05-29 16:10:43 +03:00
# SPDX-FileCopyrightText: 2016 Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
2017-10-09 18:34:25 +03:00
# Dependencies:
# * make
# * which
2019-01-02 22:59:42 +03:00
# * npm
2017-10-09 18:34:25 +03:00
# * curl: used if phpunit and composer are not installed to fetch them from the web
# * tar: for building the archive
2019-01-03 02:29:30 +03:00
app_name=polls
project_dir=.
build_dir=$(project_dir)/build
2019-01-02 22:59:42 +03:00
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
2017-10-09 18:34:25 +03:00
composer=$(shell which composer 2> /dev/null)
version=$(shell node -p -e "require('./package.json').version")
2017-10-09 18:34:25 +03:00
# all steps for an appstore release
appstore: setup-build build-js-production package
2019-01-02 22:59:42 +03:00
# install deps for release package
setup-build: setup-build-composer npm-init
2019-01-02 22:59:42 +03:00
# 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
2019-01-02 22:59:42 +03:00
npm-init:
2020-08-31 23:57:17 +03:00
npm ci
2019-01-02 22:59:42 +03:00
# remove build dir
clean:
rm -rf $(build_dir)
# remove deps
clean-dev: clean
rm -rf node_modules
rm -rf ./vendor
2017-10-09 18:34:25 +03:00
# lint js, css and php
2019-01-02 22:59:42 +03:00
lint:
npm run lint
npm run stylelint
2020-12-12 13:47:56 +03:00
composer run cs:check
2019-01-02 22:59:42 +03:00
# lint fix js, css and php
2019-01-02 22:59:42 +03:00
lint-fix:
npm run lint:fix
npm run stylelint:fix
2020-12-12 13:47:56 +03:00
composer run cs:fix
2019-01-02 22:59:42 +03:00
cs:
composer run cs:check
cs-fix:
composer run cs:fix
# build vue app
2019-01-04 07:46:47 +03:00
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
2019-01-02 22:59:42 +03:00
# Builds the source package for the appstore
# signs, if certificate is present
package: clean
2019-01-03 00:01:38 +03:00
mkdir -p $(build_source_dir)
mkdir -p $(appstore_build_dir)
rsync -zarh $(project_dir)/ --files-from="$(project_dir)/sync_list.txt" --exclude="vendor/bin" $(build_source_dir)/$(app_name)
tar -czf $(appstore_package_name).tar.gz --directory="$(build_source_dir)" $(app_name)
2019-01-02 22:59:42 +03:00
@if [ -f $(nc_cert_dir)/$(app_name).key ]; then \
2017-10-21 17:47:11 +03:00
echo "Signing package..."; \
2019-01-02 22:59:42 +03:00
openssl dgst -sha512 -sign $(nc_cert_dir)/$(app_name).key $(appstore_build_dir)/$(app_name).tar.gz | openssl base64; \
2017-10-21 17:47:11 +03:00
fi
2017-10-09 18:34:25 +03:00
.PHONY: test
test: composer setup-dev-composer
phpunit --coverage-clover clover.xml -c tests/phpunit.xml
phpunit -c phpunit.integration.xml