Skip to content

Commit

Permalink
Merge pull request #194 from loic425/features/makefile-override
Browse files Browse the repository at this point in the history
Makefile commands overridable
  • Loading branch information
loic425 committed Jun 20, 2019
2 parents 8d1de05 + 7f8229b commit f3fa0df
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 66 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
/behat.yml
/phpspec.yml

Makefile
/Makefile*
/!Makefile*.dist

###> symfony/framework-bundle ###
/.env.*.local
Expand Down
75 changes: 10 additions & 65 deletions Makefile.dist
Original file line number Diff line number Diff line change
@@ -1,74 +1,19 @@
TAGS?=~todo
CHROMEDRIVER_PATH=../chromedriver
include Makefile.install.dist
include Makefile.test.dist
include Makefile.validation.dist

build-docs:
docs-build-default:
cd docs && sphinx-build -b html . build -a

install:
composer install --no-interaction
bin/console app:install -n
bin/console sylius:fixtures:load -n
yarn install && yarn build
install-default: composer-install app-install fixtures-load yarn-install yarn-build

load-fixtures:
bin/console sylius:fixtures:load default --no-interaction

start:
start-default:
symfony server:start --no-tls || bin/console server:start ${ARGS}

stop:
stop-default:
symfony server:stop || bin/console server:stop

test: validate-all test-all

test-all: test-phpspec test-phpstan test-phpstan test-phpunit test-infection test-all-behat

test-behat:
APP_ENV=test vendor/bin/behat --tags=${TAGS} ${ARGS}

test-all-behat: test-behat-without-javascript test-behat-with-javascript test-behat-with-cli

test-behat-without-javascript:
APP_ENV=test vendor/bin/behat --tags=~javascript --tags=${TAGS}

test-behat-with-javascript:
vendor/bin/selenium-server-standalone -Dwebdriver.chrome.driver=${CHROMEDRIVER_PATH} > /dev/null 2>&1 &
sleep 5
APP_ENV=test vendor/bin/behat --tags=javascript --tags=${TAGS}

test-behat-with-cli:
APP_ENV=test vendor/bin/behat --tags=cli --tags=${TAGS}

test-infection:
phpdbg -qrr vendor/bin/infection ${ARGS}

test-phpspec:
phpdbg -qrr vendor/bin/phpspec run -n ${ARGS}

test-phpstan:
APP_ENV=dev bin/console cache:clear
APP_ENV=dev bin/console cache:warmup
vendor/bin/phpstan analyse -c phpstan.neon -l 1 src

test-psalm:
vendor/bin/psalm --show-info=false

test-phpunit:
APP_ENV=test vendor/bin/phpunit ${ARGS}

validate-all: validate-composer validate-security validate-doctrine-schema validate-twig validate-yaml-files

validate-composer:
composer validate --strict

validate-doctrine-schema:
bin/console doctrine:schema:validate

validate-security:
vendor/bin/security-checker security:check

validate-twig:
bin/console lint:twig templates
test-default: validate-all test-all

validate-yaml-files:
bin/console lint:yaml config
%: %-default
@ true
17 changes: 17 additions & 0 deletions Makefile.install.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
composer-install-default:
composer install --no-interaction

app-install-default:
bin/console app:install -n

fixtures-load-default:
bin/console sylius:fixtures:load default --no-interaction

yarn-install-default:
yarn install

yarn-build-default:
yarn build

%: %-default
@ true
42 changes: 42 additions & 0 deletions Makefile.test.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
TAGS?=~todo
CHROMEDRIVER_PATH=../chromedriver
FORMAT?=progress
VERBOSITY?=-vvv

test-all-default: test-phpspec test-phpstan test-psalm test-phpunit test-infection test-all-behat

test-behat-default:
APP_ENV=test vendor/bin/behat --tags=${TAGS} ${ARGS} -f ${FORMAT} ${VERBOSITY}

test-all-behat-default: test-behat-without-javascript test-behat-with-javascript test-behat-with-cli

test-behat-without-javascript-default:
APP_ENV=test vendor/bin/behat --tags=~javascript --tags=${TAGS} -f ${FORMAT} ${VERBOSITY}

test-behat-with-javascript-default:
vendor/bin/selenium-server-standalone -Dwebdriver.chrome.driver=${CHROMEDRIVER_PATH} > /dev/null 2>&1 &
sleep 5
APP_ENV=test vendor/bin/behat --tags=javascript --tags=${TAGS} -f ${FORMAT} ${VERBOSITY}

test-behat-with-cli-default:
APP_ENV=test vendor/bin/behat --tags=cli --tags=${TAGS} -f ${FORMAT} ${VERBOSITY}

test-infection-default:
phpdbg -qrr vendor/bin/infection ${ARGS}

test-phpspec-default:
phpdbg -qrr vendor/bin/phpspec run -n ${ARGS}

test-phpstan-default:
APP_ENV=dev bin/console cache:clear
APP_ENV=dev bin/console cache:warmup
vendor/bin/phpstan analyse -c phpstan.neon -l 1 src

test-phpunit-default:
APP_ENV=test vendor/bin/phpunit ${ARGS}

test-psalm-default:
vendor/bin/psalm --show-info=false

%: %-default
@ true
16 changes: 16 additions & 0 deletions Makefile.validation.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
validate-all: validate-composer validate-security validate-doctrine-schema validate-twig validate-yaml-files

validate-composer:
composer validate --strict

validate-doctrine-schema:
bin/console doctrine:schema:validate

validate-security:
vendor/bin/security-checker security:check

validate-twig:
bin/console lint:twig templates

validate-yaml-files:
bin/console lint:yaml config
17 changes: 17 additions & 0 deletions features/makefile/make_docs_build.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@makefile @cli
Feature: Use make docs build command
In order to build application docs
As a developer
I want to use make docs build command

Scenario: Use make docs build command
Given I use default makefile commands
Then the command make "docs-build" should exist
And it should execute "sphinx-build"

Scenario: Override make docs build command
When I override makefile "docs-build" command with "echo 'test'" and "make docs-build-default"
Then the command make "docs-build" should exist
And it should execute "echo 'test'"
And it should execute "make docs-build-default"
But it should not execute "sphinx-build"
21 changes: 21 additions & 0 deletions features/makefile/make_install.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@makefile @cli
Feature: Use make install command
In order to install application
As a developer
I want to use make install command

Scenario: Use make install command
Given I use default makefile commands
Then the command make install should exist
And it should execute "composer install"
And it should execute "app:install"
And it should execute "fixtures:load"
And it should execute "yarn install"
And it should execute "yarn build"

Scenario: Override make install command
When I override makefile install command with "echo 'test'" and "make install-default"
Then the command make install should exist
And it should execute "echo 'test'"
And it should execute "make install-default"
But it should not execute "composer install"
17 changes: 17 additions & 0 deletions features/makefile/make_start.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@makefile @cli
Feature: Use make start command
In order to start server
As a developer
I want to use make start command

Scenario: Use make start command
Given I use default makefile commands
Then the command make start should exist
And it should execute "server:start"

Scenario: Override make start command
When I override makefile start command with "echo 'test'" and "make start-default"
Then the command make start should exist
And it should execute "echo 'test'"
And it should execute "make start-default"
But it should not execute "server:start"
17 changes: 17 additions & 0 deletions features/makefile/make_stop.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@makefile @cli
Feature: Use make stop command
In order to stop server
As a developer
I want to use make stop command

Scenario: Use make stop command
Given I use default makefile commands
Then the command make stop should exist
And it should execute "server:stop"

Scenario: Override make stop command
When I override makefile stop command with "echo 'test'" and "make stop-default"
Then the command make stop should exist
And it should execute "echo 'test'"
And it should execute "make stop-default"
But it should not execute "server:stop"
46 changes: 46 additions & 0 deletions features/makefile/make_test.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@makefile @cli
Feature: Use make test command
In order to test application
As a developer
I want to use make test command

Scenario: Use make validate all command
Given I use default makefile commands
Then the command make "validate-all" should exist
And it should execute "composer validate"
And it should execute "doctrine:schema:validate"
And it should execute "security:check"
And it should execute "lint:twig"
And it should execute "lint:yaml"

Scenario: Use make test all command
Given I use default makefile commands
Then the command make "test-all" should exist
And it should execute "phpspec run"
And it should execute "phpstan analyse"
And it should execute "psalm"
And it should execute "phpunit"
And it should execute "infection"
And it should execute "behat"

Scenario: Use make test command
Given I use default makefile commands
Then the command make test should exist
And it should execute "composer validate"
And it should execute "doctrine:schema:validate"
And it should execute "security:check"
And it should execute "lint:twig"
And it should execute "lint:yaml"
And it should execute "phpspec run"
And it should execute "phpstan analyse"
And it should execute "psalm"
And it should execute "phpunit"
And it should execute "infection"
And it should execute "behat"

Scenario: Override make test command
When I override makefile test command with "echo 'test'" and "make test-default"
Then the command make test should exist
And it should execute "echo 'test'"
And it should execute "make test-default"
But it should not execute "composer validate"

0 comments on commit f3fa0df

Please sign in to comment.