Skip to content

Commit

Permalink
Merge pull request #663 from bolt/chore/syncing-makefile-and-docker-b…
Browse files Browse the repository at this point in the history
…etween-project-and-core

Sync Makefile and Dockerfile between `core` and `project`
  • Loading branch information
bobdenotter authored Oct 4, 2019
2 parents 4896968 + 097ef8c commit 6abaec8
Showing 1 changed file with 59 additions and 43 deletions.
102 changes: 59 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
start:
DC_RUN ?= docker-compose run --rm

.PHONY: help install build-assets copy-assets server server-stop cache csclear cscheck csfix csfix-tests stancheck test \
behat e2e full-test db-create db-update db-reset docker-install docker-install-deps docker-start docker-assets-serve \
docker-update docker-cache docker-csclear docker-cscheck docker-csfix docker-stancheck docker-db-create docker-db-reset \
docker-db-update docker-npm-fix-env docker-test docker-server-stop docker-behat docker-behat-rerun docker-full-test \
docker-command docker-console

default: help

help:
@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | sort | awk '{split($$0, a, ":"); printf "\033[36m%-30s\033[0m %-30s %s\n", a[1], a[2], a[3]}'

start: ## to run the install scripts and start the server
make install
make db-create
make server

install:
install: ## to install all project
cp -n .env.dist .env || true
composer install
npm install
Expand All @@ -12,21 +25,21 @@ install:
update:
composer update && composer outdated

server:
server: ## to start server
bin/console server:start 127.0.0.1:8088 -q || true

server-stop:
server-stop: ## to stop server
bin/console server:stop

cache:
cache: ## to clean cache
bin/console cache:clear

csclear:
csclear: ## to clean cache and check coding style
mkdir -p var/cache/ecs
chmod -R a+rw var/cache/ecs
rm -rf var/cache/ecs/*

cscheck:
cscheck: ## to check coding style
make csclear
vendor/bin/ecs check src
vendor/bin/ecs check tests/spec --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml
Expand All @@ -35,33 +48,33 @@ cscheck:
vendor/bin/ecs check tests/php --config vendor/symplify/easy-coding-standard/config/common/strict.yml
make stancheck

csfix:
csfix: ## to fix coding style
make csclear
vendor/bin/ecs check src --fix
vendor/bin/ecs check tests/spec --fix --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml
vendor/bin/ecs check tests/php --fix --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml --config vendor/symplify/easy-coding-standard/config/common/phpunit.yml --config vendor/symplify/easy-coding-standard/config/common/strict.yml
make stancheck

stancheck:
stancheck: ## to run phpstan
vendor/bin/phpstan --memory-limit=1G analyse -c phpstan.neon src

test:
test: ## to run phpunit tests
vendor/bin/phpspec run
vendor/bin/phpunit

behat:
behat: ## to run behat tests
make server
vendor/bin/behat -v

behat-rerun:
behat-rerun: ## to rerun behat tests
make server
vendor/bin/behat -v --rerun

e2e:
e2e: ## to run kakunin tests
make server
cd tests/e2e && npm run kakunin && cd ../..

full-test:
full-test: ## to run full tests
make cscheck
make test
make behat
Expand All @@ -75,100 +88,103 @@ e2e-install:
cd tests/e2e && npm install
node ./tests/e2e/node_modules/protractor/bin/webdriver-manager update --gecko=false

db-create:
db-create: ## to create database and load fixtures
bin/console doctrine:database:create
bin/console doctrine:schema:create
bin/console doctrine:fixtures:load -n

db-update:
db-update: ## to update schema database
bin/console doctrine:schema:update -v --dump-sql --force --complete

db-reset:
db-reset: ## to delete database and load fixtures
bin/console doctrine:schema:drop --force --full-database
bin/console doctrine:schema:create
bin/console doctrine:fixtures:load -n

# Dockerized commands:
docker-install:
docker-install: ## to install project with docker
make docker-start
make docker-install-deps
make docker-db-create

docker-install-deps:
docker-install-deps: ## to install all assets with docker
docker-compose exec -T php sh -c "composer install"
docker-compose run node sh -c "npm install"
docker-compose run node sh -c "npm rebuild node-sass"
docker-compose run node sh -c "npm run build"
$(DC_RUN) node sh -c "npm install"
$(DC_RUN) node sh -c "npm rebuild node-sass"
$(DC_RUN) node sh -c "npm run build"

docker-start:
docker-start: ## to build containers
cp -n .env.dist .env || true
docker-compose up -d

docker-assets-serve:
docker-compose run node sh -c "npm run serve"
docker-assets-serve: ## to run server with npm
$(DC_RUN) node sh -c "npm run serve"

docker-update:
docker-update: ## to update dependencies with docker
docker-compose exec -T php sh -c "composer update && composer outdated"

docker-cache:
docker-cache: ## to clean cache with docke
docker-compose exec -T php sh -c "bin/console cache:clear"

docker-csclear:
docker-csclear: ## to clean cache and check coding style with docker
docker-compose exec -T php sh -c "mkdir -p var/cache/ecs"
docker-compose exec -T php sh -c "chmod -R a+rw var/cache/ecs"
docker-compose exec -T php sh -c "rm -rf var/cache/ecs/*"

docker-cscheck:
docker-cscheck: ## to check coding style with docker
make docker-csclear
docker-compose exec -T php sh -c "vendor/bin/ecs check src"
make docker-stancheck

docker-csfix:
docker-csfix: ## to fix coding style with docker
make docker-csclear
docker-compose exec -T php sh -c "vendor/bin/ecs check src --fix"
make docker-stancheck

docker-stancheck:
docker-stancheck: ## to run phpstane with docker
docker-compose exec -T php sh -c "vendor/bin/phpstan analyse -c phpstan.neon src"

docker-db-create:
docker-db-create: ## to create database and load fixtures with docker
docker-compose exec -T php sh -c "bin/console doctrine:database:create"
docker-compose exec -T php sh -c "bin/console doctrine:schema:create"
docker-compose exec -T php sh -c "bin/console doctrine:fixtures:load -n"

docker-db-reset:
docker-db-reset: ## to delete database with docker
docker-compose exec -T php sh -c "bin/console doctrine:schema:drop --force --full-database"
docker-compose exec -T php sh -c "bin/console doctrine:schema:create"
docker-compose exec -T php sh -c "bin/console doctrine:fixtures:load -n"

docker-db-update:
docker-db-update: ## to update schema database with docker
docker-compose exec -T php sh -c "bin/console doctrine:schema:update -v --dump-sql --force --complete"

docker-npm-fix-env:
docker-compose run node sh -c "npm rebuild node-sass"
docker-npm-fix-env: ## to rebuild asset sass
$(DC_RUN) node sh -c "npm rebuild node-sass"

docker-test:
docker-test: ## to run phpspec and phpunit tests with docker
docker-compose exec -T php sh -c "vendor/bin/phpspec run"
docker-compose exec -T php sh -c "vendor/bin/phpunit"

docker-server:
docker-server: ## to start server with docker
docker-compose exec -T php bin/console server:start 127.0.0.1:8088

docker-server-stop: ## to stop server with docker
docker-compose exec -T -u www-data php bin/console server:stop

docker-behat:
docker-behat: ## to run behat tests with docker
docker-compose exec -T php vendor/bin/behat -v

docker-behat-rerun:
docker-behat-rerun: ## to rerun behat tests with docker
docker-compose exec -T php vendor/bin/behat -v --rerun

docker-full-test:
docker-full-test: ## to run all test with docker
make docker-cache
make docker-cscheck
make docker-test
make docker-behat
make e2e

docker-command:
docker-command: ## to run commmand shell in php container
docker-compose exec -T php sh -c "$(c)"

docker-console:
docker-console: ## to run commmand with console symfony in php container
docker-compose exec -T php sh -c "bin/console $(c)"

0 comments on commit 6abaec8

Please sign in to comment.