From 8b3eff62eeeac68b7ffa3add6db88df1d5e82371 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 17 Apr 2020 18:26:12 +0200 Subject: tests(phpcs): add cache file + checkstyle report nox that the target are separated, you can use `make check -k` to keep going even if one of the checks fail. --- Makefile | 23 ++++++++++++++++++----- phpcs.xml | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index be02116..5bfd51c 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ js_sources := $(wildcard $(js_src_dir)/*.js) js_bundles := $(js_sources:$(js_src_dir)/%.js=assets/js/%.bundle.js) js_srcmaps := $(js_sources:$(js_src_dir)/%.js=assets/js/%.bundle.js.map) zip_release := dist/w_cms_$(GIT_VERSION).zip +phpcs_dir := $(build_dir)/phpcs +phpunit_dir := $(build_dir)/phpunit +dirs := $(phpcs_dir) $(phpunit_dir) # Default target. This executes everything targets needed to get a fully # working development environment. @@ -155,17 +158,27 @@ buildclean: # Run all checks. .PHONY: check -check: $(PREV_ENV_FILE) vendor - @echo Running checks... - phpcs +check: vendor lint test + +# Lint php code with phpcs. +.PHONY: lint +lint: $(phpcs_dir) + phpcs --report-full --report-checkstyle=$(phpcs_dir)/checkstyle.xml + +# Test php code with phpunit. +.PHONY: test +test: $(phpunit_dir) phpunit +# Create dirs if the do not exist +$(dirs): + mkdir -p $@ + # Touch files affected by the build environment to force the execution # of the corresponding targets. .PHONY: touch touch: - touch $(js_sources) - touch composer.json + touch composer.json webpack.config.js # Special (fake) target to always run a target but have Make consider # this updated if it was actually rewritten (a .PHONY target is always diff --git a/phpcs.xml b/phpcs.xml index 3bed678..e25e4a4 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -14,10 +14,11 @@ + - \ No newline at end of file + -- cgit v1.2.3