From 81b0f222770ee84d0e112c13279a842f663b4133 Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 15 Oct 2021 01:40:34 +0200 Subject: [PATCH] Improve legacy Makefile --- .github/workflows/test.yml | 7 +++---- legacy/Makefile | 32 ++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1f8546ca..27637d72b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,16 +44,15 @@ jobs: - run: make all working-directory: tools - php-cs-fixer: + lint-legacy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: shivammathur/setup-php@v2 with: php-version: 7.4 - - name: Run php-cs-fixer - run: | - make php-cs-fixer + - name: Lint + run: make lint working-directory: legacy test-legacy: diff --git a/legacy/Makefile b/legacy/Makefile index 3bb5ac27f..21d532566 100644 --- a/legacy/Makefile +++ b/legacy/Makefile @@ -1,19 +1,27 @@ -.PHONY: build php-cs-fixer - SHELL = bash -vendor: - composer install --no-progress --no-interaction +all: vendor +PHP-CS-FIXER = tools/vendor/bin/php-cs-fixer +$(PHP-CS-FIXER): + mkdir -p tools + composer require --working-dir=tools friendsofphp/php-cs-fixer + +vendor: + composer install --no-progress --no-interaction $(COMPOSER_ARGS) + +.PHONY: test test: vendor cd tests && ../vendor/bin/phpunit +.PHONY: format +format: $(PHP-CS-FIXER) + $(PHP-CS-FIXER) fix + +.PHONY: lint +lint: $(PHP-CS-FIXER) + $(PHP-CS-FIXER) fix --dry-run --diff + +.PHONY: build build: - composer install --no-progress --no-interaction --no-dev - -tools/php-cs-fixer: - mkdir -p tools/php-cs-fixer - composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer - -php-cs-fixer: tools/php-cs-fixer - tools/php-cs-fixer/vendor/bin/php-cs-fixer fix + COMPOSER_ARGS=--no-dev $(MAKE)