Skip to content

chore(makefile): Re-organise the make commands #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
working-directory: 'composer-root-version-checker'

- name: Check COMPOSER_ROOT_VERSION
run: make check_composer_root_version
run: make composer_root_version_lint

composer-json:
runs-on: ubuntu-latest
Expand Down
57 changes: 31 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,23 @@ help:
#---------------------------------------------------------------------------

.PHONY: check
check: ## Runs all checks
check: composer_root_version_lint cs composer_normalize phpstan test
check: ## Runs all checks
check: composer_root_version_lint cs autoreview test composer_root_version_check

.PHONY: clean
clean: ## Cleans all created artifacts
clean:
git clean --exclude=.idea/ -ffdx
.PHONY: build
build: ## Builds the PHAR
build:
rm $(PHP_SCOPER_PHAR_BIN) || true
$(MAKE) $(PHP_SCOPER_PHAR_BIN)

.PHONY: fixtures_composer_outdated
fixtures_composer_outdated: ## Reports outdated dependencies
fixtures_composer_outdated:
@find fixtures -name 'composer.json' -type f -depth 2 -exec dirname '{}' \; | xargs -I % sh -c 'printf "Installing dependencies for %;\n" $$(composer install --working-dir=% --ansi)'
@find fixtures -name 'composer.json' -type f -depth 2 -exec dirname '{}' \; | xargs -I % sh -c 'printf "Checking dependencies for %;\n" $$(composer outdated --direct --working-dir=% --ansi)'

.PHONY: cs
cs: ## Fixes CS
cs: ## Fixes CS
cs: gitignore_sort composer_normalize php_cs_fixer

.PHONY: cs_lint
Expand Down Expand Up @@ -87,28 +94,21 @@ gitignore_sort:
phpstan: $(PHPSTAN_BIN)
$(PHPSTAN)

.PHONY: build
build: ## Builds the PHAR
build:
rm $(PHP_SCOPER_PHAR_BIN) || true
$(MAKE) $(PHP_SCOPER_PHAR_BIN)

.PHONY: fixtures_composer_outdated
fixtures_composer_outdated: ## Reports outdated dependencies
fixtures_composer_outdated:
@find fixtures -name 'composer.json' -type f -depth 2 -exec dirname '{}' \; | xargs -I % sh -c 'printf "Installing dependencies for %;\n" $$(composer install --working-dir=% --ansi)'
@find fixtures -name 'composer.json' -type f -depth 2 -exec dirname '{}' \; | xargs -I % sh -c 'printf "Checking dependencies for %;\n" $$(composer outdated --direct --working-dir=% --ansi)'
.PHONY: autoreview
autoreview: ## Runs the AutoReview checks
autoreview: cs_lint phpstan covers_validator

.PHONY: test
test: ## Runs all the tests
test: validate_package covers_validator phpunit e2e
test: ## Runs all the tests
test: validate_package phpunit e2e

.PHONY: validate_package
validate_package:
composer validate --strict

.PHONY: composer_root_version_check
composer_root_version_check: ## Runs all checks for the ComposerRootVersion app
composer_root_version_check:
cd composer-root-version-checker; $(MAKE) --file Makefile check

.PHONY: composer_root_version_lint
Expand All @@ -135,7 +135,7 @@ phpunit_coverage_infection: $(PHPUNIT_BIN) vendor
$(PHPUNIT_COVERAGE_INFECTION)

.PHONY: phpunit_coverage_html
phpunit_coverage_html: ## Runs PHPUnit with code coverage with HTML report
phpunit_coverage_html: ## Runs PHPUnit with code coverage with HTML report
phpunit_coverage_html: $(PHPUNIT_BIN) vendor
$(PHPUNIT_COVERAGE_HTML)

Expand All @@ -144,17 +144,22 @@ infection: $(COVERAGE_XML) vendor
#infection: $(INFECTION_BIN) $(COVERAGE_XML) vendor
if [ -d $(COVERAGE_XML) ]; then $(INFECTION); fi

include .makefile/e2e.file
.PHONY: e2e
e2e: ## Runs end-to-end tests
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_024 e2e_025 e2e_027 e2e_028 e2e_029 e2e_030 e2e_031 e2e_032 e2e_033 e2e_034 e2e_035

.PHONY: blackfire
blackfire: ## Runs Blackfire profiling
blackfire: ## Runs Blackfire profiling
blackfire: vendor
@echo "By https://blackfire.io"
@echo "This might take a while (~2min)"
$(BLACKFIRE) run php bin/php-scoper add-prefix --output-dir=build/php-scoper --force --quiet

include .makefile/e2e.file
.PHONY: e2e
e2e: ## Runs end-to-end tests
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_024 e2e_025 e2e_027 e2e_028 e2e_029 e2e_030 e2e_031 e2e_032 e2e_033 e2e_034 e2e_035
.PHONY: clean
clean: ## Cleans all created artifacts
clean:
git clean --exclude=.idea/ -ffdx


#
Expand Down
25 changes: 13 additions & 12 deletions tests/AutoReview/MakefileE2ETest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,20 @@ protected function getExpectedHelpOutput(): string
# Commands
#---------------------------------------------------------------------------

check: Runs all checks
clean: Cleans all created artifacts
update_root_version: Checks the latest GitHub release and update COMPOSER_ROOT_VERSION accordingly
cs: Fixes CS
check: Runs all checks
build: Builds the PHAR
fixtures_composer_outdated: Reports outdated dependencies
cs: Fixes CS
cs_lint: Checks CS
phpstan: Runs PHPStan
build: Builds the PHAR
outdated_fixtures: Reports outdated dependencies
test: Runs all the tests
check_composer_root_version: Checks that the COMPOSER_ROOT_VERSION is up to date
phpunit_coverage_html: Runs PHPUnit with code coverage with HTML report
blackfire: Runs Blackfire profiling
e2e: Runs end-to-end tests
autoreview: Runs the AutoReview checks
test: Runs all the tests
composer_root_version_check: Runs all checks for the ComposerRootVersion app
composer_root_version_lint: Checks that the COMPOSER_ROOT_VERSION is up to date
composer_root_version_update: Updates the COMPOSER_ROOT_VERSION
phpunit_coverage_html: Runs PHPUnit with code coverage with HTML report
e2e: Runs end-to-end tests
blackfire: Runs Blackfire profiling
clean: Cleans all created artifacts

EOF;
}
Expand Down