1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Merge pull request #7828 from wallabag/better-makefile

Better Makefile
This commit is contained in:
Yassine Guedidi 2024-11-19 09:13:06 +01:00 committed by GitHub
commit 8fcf9714c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 13 deletions

View file

@ -50,13 +50,8 @@ Please fork wallabag and work with **the master branch**.
All pull requests need to pass the tests and the code needs match the style guide. All pull requests need to pass the tests and the code needs match the style guide.
To run the tests locally run: To run the tests locally run `make test`.
- when testing using Docker: `docker-compose run --rm php bin/phpunit` (or `docker-compose run --rm php make test` if you To run the PHP formatter run `make fix-cs`.
prefer using `make`)
- otherwise: `bin/phpunit` (or `make test`)
To run the PHP formatter: To run the PHPStan static analysis run `make phpstan`.
- when testing using Docker: `docker-compose run --rm php bin/php-cs-fixer fix`
- otherwise: `php bin/php-cs-fixer fix`

View file

@ -11,6 +11,18 @@ else
override ENV = prod override ENV = prod
endif endif
DOCKER_COMPOSE_RUNNING := $(shell docker-compose ps -q | grep -q . && echo 1 || echo 0)
ifeq ($(DOCKER_COMPOSE_RUNNING), 1)
PHP := docker compose run --rm php php
PHP_NO_XDEBUG := docker compose run -e XDEBUG_MODE=off --rm php php
YARN := docker compose run --rm php yarn
else
PHP := php
PHP_NO_XDEBUG := XDEBUG_MODE=off php
YARN := yarn
endif
help: ## Display this help menu help: ## Display this help menu
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@ -25,14 +37,20 @@ dev: build ## Install the latest dev version
@./scripts/dev.sh @./scripts/dev.sh
run: ## Run the wallabag built-in server run: ## Run the wallabag built-in server
@php bin/console server:run --env=dev @$(PHP) bin/console server:run --env=dev
build: ## Run webpack build: ## Run webpack
@yarn install @$(YARN) install
@yarn build:$(ENV) @$(YARN) build:$(ENV)
test: ## Launch wallabag testsuite test: ## Launch wallabag testsuite
XDEBUG_MODE=off php -dmemory_limit=-1 bin/phpunit -v @$(PHP_NO_XDEBUG) -dmemory_limit=-1 bin/phpunit -v
fix-cs: ## Run PHP-CS-Fixer
@$(PHP_NO_XDEBUG) bin/php-cs-fixer fix
phpstan: ## Run PHPStan
@$(PHP_NO_XDEBUG) bin/phpstan analyse
release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`). release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`).
ifndef VERSION ifndef VERSION
@ -43,6 +61,6 @@ endif
deploy: ## Deploy wallabag deploy: ## Deploy wallabag
@bundle exec cap staging deploy @bundle exec cap staging deploy
.PHONY: help install update build test release deploy run dev .PHONY: help install update build test release deploy run dev fix-cs phpstan
.DEFAULT_GOAL := install .DEFAULT_GOAL := install