Skip to content

Commit 5ad54af

Browse files
authored
Merge pull request #69 from kabalin/coverage
Re-add coverage param to phpunit test
2 parents ea8e826 + 78d39ee commit 5ad54af

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Build PHAR
2323
run: |
24-
make build/moodle-plugin-ci.phar
24+
make build
2525
php build/moodle-plugin-ci.phar list
2626
2727
- name: Create Release

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
citest:
3131
name: CI test
3232
needs: selftest
33-
runs-on: ubuntu-18.04
33+
runs-on: ubuntu-16.04
3434

3535
services:
3636
postgres:
@@ -101,7 +101,6 @@ jobs:
101101
env:
102102
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
103103
run: |
104-
make test-phpunit
105104
moodle-plugin-ci phplint
106105
moodle-plugin-ci phpcpd
107106
moodle-plugin-ci phpmd
@@ -114,6 +113,6 @@ jobs:
114113
"$MOODLE_BRANCH" != 'MOODLE_310_STABLE' -a \
115114
"$MOODLE_BRANCH" != 'MOODLE_39_STABLE' ]
116115
moodle-plugin-ci phpdoc
117-
moodle-plugin-ci phpunit
116+
moodle-plugin-ci phpunit --verbose --coverage-text
118117
moodle-plugin-ci behat --profile default
119118
moodle-plugin-ci behat --profile chrome

Makefile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,47 @@ PSALM := php build/psalm.phar
55
CMDS = $(wildcard src/Command/*.php)
66

77
.PHONY:test
8-
test: test-fixer psalm test-phpunit check-docs
8+
test: check-init test-fixer psalm test-phpunit check-docs
99

1010
.PHONY:test-fixer
11-
test-fixer: build/php-cs-fixer.phar
11+
test-fixer: check-init
1212
$(FIXER) fix -v || true
1313

1414
.PHONY:test-phpunit
15-
test-phpunit: vendor/autoload.php
16-
$(PHPUNIT)
15+
test-phpunit: check-init
16+
$(PHPUNIT) --verbose
1717

1818
.PHONY:validate
19-
validate: build/php-cs-fixer.phar vendor/autoload.php psalm check-docs
19+
validate: check-init psalm check-docs
2020
$(FIXER) fix --dry-run --stop-on-violation
2121
$(COMPOSER) validate
22+
phpdbg --version
2223
phpdbg -d memory_limit=-1 -qrr $(PHPUNIT) --coverage-text
2324

25+
.PHONY:build
26+
build: build/moodle-plugin-ci.phar
27+
2428
.PHONY:psalm
25-
psalm: build/psalm.phar
29+
psalm: check-init
2630
$(PSALM)
2731

2832
.PHONY:psalm-update-baseline
29-
psalm-update-baseline: build/psalm.phar
33+
psalm-update-baseline: check-init
3034
$(PSALM) --update-baseline
3135

3236
.PHONY:check-docs
3337
check-docs: docs/CLI.md
3438
@echo "CHECKING if 'docs/CLI.md' needs to be committed due to changes. If this fails, simply commit the changes."
3539
git diff-files docs/CLI.md
3640

37-
# Downloads everything we need for testing, used by Travis.
41+
# Setup for testing.
3842
.PHONY: init
39-
init: vendor/autoload.php build/php-cs-fixer.phar build/psalm.phar
43+
init: build/php-cs-fixer.phar build/psalm.phar composer.lock composer.json
44+
$(COMPOSER) selfupdate
45+
$(COMPOSER) install --no-suggest --no-progress
4046

4147
.PHONY: update
42-
update: build/php-cs-fixer.phar
48+
update: check-init build/php-cs-fixer.phar build/psalm.phar
4349
$(COMPOSER) selfupdate
4450
$(FIXER) selfupdate
4551
$(COMPOSER) update
@@ -51,6 +57,12 @@ clean:
5157
rm -rf vendor
5258
rm -f .php_cs.cache
5359

60+
# Output error if not initialised.
61+
check-init:
62+
ifeq (, $(wildcard vendor))
63+
$(error Run 'make init' first)
64+
endif
65+
5466
# Update download URL from https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases
5567
build/php-cs-fixer.phar:
5668
curl -LSs https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.2/php-cs-fixer.phar -o build/php-cs-fixer.phar
@@ -64,14 +76,9 @@ build/box.phar:
6476

6577
build/moodle-plugin-ci.phar: build/box.phar
6678
$(COMPOSER) install --no-dev --prefer-dist --classmap-authoritative --quiet
67-
php -d phar.readonly=false build/box.phar build
79+
php -d memory_limit=-1 -d phar.readonly=false build/box.phar build
6880
$(COMPOSER) install --prefer-dist --quiet
6981

70-
vendor/autoload.php: composer.lock composer.json
71-
$(COMPOSER) self-update
72-
$(COMPOSER) install --no-suggest --no-progress
73-
touch $@
74-
7582
docs/CLI.md: $(CMDS)
7683
@rm -f $@
7784
@echo "---" >> $@

0 commit comments

Comments
 (0)