-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
64 lines (53 loc) · 2.89 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
.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests target
.PHONY: archive
archive: docker-down ## Compresses all files required to install mod_matrix as a ZIP file
rm -rf .build/vendor
mv vendor .build/vendor
rm -rf vendor
composer install --no-dev --no-interaction --no-progress
zip -FSr mod_matrix.zip . -x ".build/*" ".git/*" ".data/*" ".docker/*" ".gitlab/*" ".idea/*" ".notes/*" "test/*" .DS_Store .editorconfig .gitignore .gitlab-ci.yml .php-cs-fixer.php Makefile psalm.xml psalm-baseline.xml README.md
mv .build/vendor vendor
.PHONY: code-coverage
code-coverage: ## Collects code coverage from running unit tests with phpunit/phpunit
mkdir -p .build/phpunit
XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=test/unit/phpunit.xml --coverage-text
.PHONY: coding-standards
coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer
composer normalize
mkdir -p .build/php-cs-fixer
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose
.PHONY: docker-build
docker-build: ## Builds Dockerfiles
docker build --platform=linux/amd64 --tag gitlab-registry.matrix.org/new-vector/moodle-mod_matrix/mariadb-dev:latest .docker/mariadb/
docker build --platform=linux/amd64 --tag gitlab-registry.matrix.org/new-vector/moodle-mod_matrix/php-dev:latest .docker/php/ --build-arg MODE=dev
.PHONY: docker-push
docker-push: docker-build ## Pushes Dockerfiles
docker push gitlab-registry.matrix.org/new-vector/moodle-mod_matrix/mariadb-dev:latest
docker push gitlab-registry.matrix.org/new-vector/moodle-mod_matrix/php-dev:latest
.PHONY: docker-down
docker-down: ## Stops the local development environment with Docker
docker compose --file .docker/docker-compose.yaml down
.PHONY: docker-up
docker-up: vendor ## Starts the local development environment with Docker
mkdir -p .data/mariadb
mkdir -p .data/moodle
composer install --no-interaction --no-progress
docker compose --file .docker/docker-compose.yaml up --build --force-recreate --remove-orphans
.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
mkdir -p .build/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats
.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan and vimeo/psalm
mkdir -p .build/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
mkdir -p .build/phpunit
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml
vendor: composer.json composer.lock
composer validate --strict
composer install --no-interaction --no-progress