-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
92 lines (81 loc) · 2.78 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
GIT_VERSION := $(shell git --no-pager describe --tags --always)
GIT_COMMIT := $(shell git rev-parse --verify HEAD)
GIT_DATE := $(firstword $(shell git --no-pager show --date=iso-strict --format="%ad" --name-only))
BUILD_DATE := $(shell date)
RELEASE_FILE_USERLI := userli-${GIT_VERSION}.tar.gz
RELEASE_FILE_ADAPTER := userli-dovecot-adapter-${GIT_VERSION}.tar.gz
SHA_ALGORITHMS := 256 512
TMP_DIR := userli-${GIT_VERSION}
clean:
rm -rf build
prepare: clean
mkdir -p build
git clone $(shell pwd) build/${TMP_DIR}
build: clean prepare
cd build/${TMP_DIR}; \
APP_ENV=prod DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" \
composer install --no-dev --ignore-platform-reqs; \
APP_ENV=prod DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" \
composer dump-autoload; \
yarn --pure-lockfile; \
yarn encore production
release: clean prepare build
# Create a release tarball for Userli
tar --directory=build/${TMP_DIR} \
--exclude='${TMP_DIR}/.env.*' \
--exclude='${TMP_DIR}/.git*' \
--exclude='${TMP_DIR}/.dockerignore' \
--exclude='${TMP_DIR}/.*.yml' \
--exclude='${TMP_DIR}/behat.yml' \
--exclude='${TMP_DIR}/bin/github-release.sh' \
--exclude='${TMP_DIR}/build' \
--exclude='${TMP_DIR}/contrib' \
--exclude='${TMP_DIR}/Dockerfile' \
--exclude='${TMP_DIR}/docker-compose.yml' \
--exclude='${TMP_DIR}/features' \
--exclude='${TMP_DIR}/Makefile' \
--exclude='${TMP_DIR}/mkdocs.yml' \
--exclude='${TMP_DIR}/node_modules' \
--exclude='${TMP_DIR}/phpunit.xml' \
--exclude='${TMP_DIR}/rector.php' \
--exclude='${TMP_DIR}/sonar-project.properties' \
--exclude='${TMP_DIR}/tests' \
--exclude='${TMP_DIR}/var/cache/*' \
--exclude='${TMP_DIR}/var/log/*' \
--exclude='${TMP_DIR}/var/db_test.sqlite' \
--exclude='${TMP_DIR}/webpack.config.js' \
--exclude='${TMP_DIR}/yarn.lock' \
-czf build/${RELEASE_FILE_USERLI} \
../${TMP_DIR}
# Create a release tarball for adapter
tar --directory=build/${TMP_DIR}/contrib/dovecot/ \
-czf build/${RELEASE_FILE_ADAPTER} \
userli-dovecot-adapter.lua
# Generate SHA hash sum files
for sha in ${SHA_ALGORITHMS}; do \
shasum -a "$${sha}" "build/${RELEASE_FILE_USERLI}" >"build/${RELEASE_FILE_USERLI}.sha$${sha}"; \
shasum -a "$${sha}" "build/${RELEASE_FILE_ADAPTER}" >"build/${RELEASE_FILE_ADAPTER}.sha$${sha}"; \
done
cs-fixer:
php-cs-fixer fix src --rules=@Symfony
php-cs-fixer fix tests --rules=@Symfony
lint:
php -l src/
reset:
rm -f php_cs.cache
rm -rf node-modules
rm -rf public/build
rm -rf public/bundles
rm -rf public/components
rm -rf var/log/*
rm -rf var/cache/*
rm -rf vendor
rm -rf userli-*
vendors:
composer install
integration: vendors lint
yarn
yarn encore dev
bin/behat -f progress
security-check: vendors
bin/local-php-security-checker