forked from open-lms-open-source/moodle-plugin-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (68 loc) · 2.37 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
COMPOSER := composer
PHPUNIT := vendor/bin/phpunit
FIXER := php build/php-cs-fixer.phar
PSALM := php build/psalm.phar
CMDS = $(wildcard src/Command/*.php)
.PHONY:test
test: test-fixer psalm test-phpunit check-docs
.PHONY:test-fixer
test-fixer: build/php-cs-fixer.phar
$(FIXER) fix -v || true
.PHONY:test-phpunit
test-phpunit: vendor/autoload.php
$(PHPUNIT)
.PHONY:validate
validate: build/php-cs-fixer.phar vendor/autoload.php psalm check-docs
$(FIXER) fix --dry-run --stop-on-violation
$(COMPOSER) validate
phpdbg -qrr $(PHPUNIT) --coverage-text
.PHONY:psalm
psalm: build/psalm.phar
$(PSALM)
.PHONY:psalm-update-baseline
psalm-update-baseline: build/psalm.phar
$(PSALM) --update-baseline
.PHONY:check-docs
check-docs: docs/CLI.md
@echo "CHECKING if 'docs/CLI.md' needs to be committed due to changes. If this fails, simply commit the changes."
git diff-files docs/CLI.md
# Downloads everything we need for testing, used by Travis.
.PHONY: init
init: vendor/autoload.php build/php-cs-fixer.phar build/psalm.phar
.PHONY: update
update: build/php-cs-fixer.phar
$(COMPOSER) selfupdate
$(FIXER) selfupdate
$(COMPOSER) update
.PHONY: clean
clean:
rm -f build/*.phar
rm -f build/*.clover
rm -rf vendor
rm -f .php_cs.cache
# Update download URL from https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases
build/php-cs-fixer.phar:
curl -LSs https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.2/php-cs-fixer.phar -o build/php-cs-fixer.phar
# Update download URL from https://github.com/vimeo/psalm/releases
build/psalm.phar:
curl -LSs https://github.com/vimeo/psalm/releases/download/3.0.17/psalm.phar -o build/psalm.phar
build/box.phar:
@cd build && curl -LSs https://box-project.github.io/box2/installer.php | php
build/moodle-plugin-ci.phar: build/box.phar
$(COMPOSER) install --no-dev --prefer-dist --classmap-authoritative --quiet
php -d phar.readonly=false build/box.phar build
$(COMPOSER) install --prefer-dist --quiet
vendor/autoload.php: composer.lock composer.json
$(COMPOSER) self-update
$(COMPOSER) install --no-suggest --no-progress
touch $@
docs/CLI.md: $(CMDS)
@rm -f $@
@echo "---" >> $@
@echo "layout: page" >> $@
@echo "title: Moodle Plugin CI Commands" >> $@
@echo "---" >> $@
@echo "" >> $@
@echo "<!-- AUTOMATICALLY GENERATED VIA: make $@ -->" >> $@
@php bin/moodle-plugin-ci list --format md | sed 1,2d >> $@
@echo "REGENERATED $@"