-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated JS dependencies and TailwindCSS * Rebuilt assets * Add intl (extension) requirement * Code style * Removed PurgeCSS and purgecss-webpack-plugin + rebuilt assets * New Docker testing setup
- Loading branch information
1 parent
36b281d
commit de1df95
Showing
10 changed files
with
2,225 additions
and
2,342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Default values | ||
php ?= 8.3 | ||
sf ?= 7.1 | ||
args ?= | ||
|
||
# Allowed PHP and Symfony version combinations | ||
# (PHP_VERSION;SYMFONY_VERSION) | ||
valid_combinations = \ | ||
8.3;7.1 \ | ||
8.3;6.4 \ | ||
8.3;5.4 \ | ||
8.2;7.1 \ | ||
8.2;6.4 \ | ||
8.2;5.4 | ||
|
||
current_combination = $(php);$(sf) | ||
|
||
# list of config files to provide to docker compose | ||
compose_files = -f tools/docker/compose.yaml | ||
|
||
# Help target | ||
.PHONY: help | ||
help: | ||
@echo "Usage: make <target> [php=<php_version>] [sf=<symfony_version>] [args=<phpunit_args>]" | ||
@echo "" | ||
@echo "Targets:" | ||
@echo " tests - Run the test suite using PHPUnit." | ||
@echo " cs-fix - Run PHP-CS-Fixer to fix coding standards issues." | ||
@echo " phpstan - Run PHPStan for static code analysis." | ||
@echo "" | ||
@echo "Options:" | ||
@echo " php - PHP version to use (default: $(php)). Supported: 8.2, 8.3" | ||
@echo " sf - Symfony version to use (default: $(sf)). Supported: 5.4, 6.4, 7.1" | ||
@echo " args - Additional arguments:" | ||
$(eval $(call set_args,tests)) | ||
@echo " Defaults for 'tests' target: $(args)" | ||
$(eval $(call set_args,phpstan)) | ||
@echo " Defaults for 'phpstan' target: $(args)" | ||
$(eval $(call set_args,cs-fix)) | ||
@echo " Defaults for 'cs-fix' target: $(args)" | ||
@echo "" | ||
@echo "Examples:" | ||
@echo " make tests php=8.2 sf=6.4" | ||
@echo " make cs-fix" | ||
@echo " make phpstan" | ||
@echo " make tests args='--filter=TestClassName'" | ||
@echo "" | ||
@echo "Note: Ensure that the PHP and Symfony versions are valid combinations:" | ||
@echo " $(valid_combinations) (PHP_VERSION;SYMFONY_VERSION)" | ||
|
||
# Common target setup | ||
define common_setup | ||
@rm -f composer.lock | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer global config --no-plugins allow-plugins.symfony/flex true" | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer global require --no-progress --no-scripts --no-plugins symfony/flex --quiet" | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer install --quiet" | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer reinstall damienharper/auditor --prefer-install=source --quiet" | ||
endef | ||
|
||
# Run PHPUnit target | ||
.PHONY: tests | ||
tests: validate_matrix | ||
$(eval $(call set_args,tests)) | ||
#$(call common_setup) | ||
PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli vendor/bin/phpunit $(args)" | ||
|
||
# Run PHPStan target | ||
.PHONY: phpstan | ||
phpstan: validate_matrix | ||
$(eval $(call set_args,phpstan)) | ||
$(call common_setup) | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer install --working-dir=tools/phpstan --quiet" | ||
PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli tools/phpstan/vendor/bin/phpstan $(args)" | ||
|
||
# Run PHP-CS-Fixer target | ||
.PHONY: cs-fix | ||
cs-fix: validate_matrix | ||
$(eval $(call set_args,cs-fix)) | ||
$(call common_setup) | ||
@PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli composer install --working-dir=tools/php-cs-fixer --quiet" | ||
PHP_VERSION=$(php) SYMFONY_VERSION=$(sf) \ | ||
sh -c "docker compose $(compose_files) run --rm --remove-orphans php-cli tools/php-cs-fixer/vendor/bin/php-cs-fixer $(args)" | ||
|
||
# Validate PHP and Symfony version matrix | ||
validate_matrix: | ||
@if ! echo "$(valid_combinations)" | grep -q "$(current_combination)"; then \ | ||
echo "Error: Invalid combination of PHP and Symfony versions: php=$(php), sf=$(sf)"; \ | ||
echo "Allowed combinations are:"; \ | ||
echo "(PHP_VERSION;SYMFONY_VERSION)"; \ | ||
echo "$(valid_combinations)" | tr ' ' '\n'; \ | ||
exit 1; \ | ||
fi | ||
|
||
# Set default args for each target | ||
define set_args | ||
ifeq ($(1),tests) | ||
args := --colors=always --no-coverage | ||
else ifeq ($(1),phpstan) | ||
args := analyse src --memory-limit=1G --ansi | ||
else ifeq ($(1),cs-fix) | ||
args := fix --using-cache=no --verbose --ansi | ||
endif | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"devDependencies": { | ||
"@symfony/webpack-encore": "^1.6.1", | ||
"autoprefixer": "^10.3.6", | ||
"glob-all": "^3.2.1", | ||
"postcss": "^8.4.37", | ||
"postcss-loader": "^6.1.1", | ||
"purgecss": "^4.0.3", | ||
"purgecss-webpack-plugin": "^4.0.3", | ||
"tailwindcss": "^2.2.16" | ||
"@babel/core": "^7.25.2", | ||
"@babel/preset-env": "^7.25.4", | ||
"@symfony/webpack-encore": "^4.7.0", | ||
"autoprefixer": "^10.4.20", | ||
"babel-loader": "^9.1.3", | ||
"glob-all": "^3.3.1", | ||
"postcss": "^8.4.45", | ||
"postcss-loader": "^8.1.1", | ||
"tailwindcss": "^3.4.10", | ||
"webpack": "^5.94.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ARG PHP_VERSION | ||
FROM php:${PHP_VERSION}-cli AS auditor | ||
|
||
WORKDIR /app | ||
|
||
# install PHP extensions | ||
# - pdo_mysql | ||
# - pdo_pgsql | ||
# - xdebug | ||
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ | ||
RUN install-php-extensions @composer intl pdo_mysql pdo_pgsql xdebug | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
CMD [ "php" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: auditor-bundle-tester | ||
services: | ||
php-cli: | ||
image: auditor:${PHP_VERSION} | ||
build: | ||
context: . | ||
target: auditor | ||
args: | ||
PHP_VERSION: ${PHP_VERSION} | ||
environment: | ||
SYMFONY_REQUIRE: ^${SYMFONY_VERSION} | ||
XDEBUG_MODE: ${XDEBUG_MODE:-coverage} | ||
volumes: | ||
- ../..:/app | ||
- vendor_php${PHP_VERSION}_sf${SYMFONY_VERSION}:/app/vendor | ||
- phpcsfixer_php${PHP_VERSION}:/app/tools/php-cs-fixer/vendor | ||
- phpstan_php${PHP_VERSION}:/app/tools/phpstan/vendor | ||
- rector_php${PHP_VERSION}:/app/tools/rector/vendor | ||
- phpstan_cache:/tmp/phpstan | ||
- composer_root:/root/.composer | ||
|
||
volumes: | ||
composer_root: | ||
vendor_php8.3_sf7.1: | ||
vendor_php8.3_sf6.4: | ||
vendor_php8.3_sf5.4: | ||
vendor_php8.2_sf7.1: | ||
vendor_php8.2_sf6.4: | ||
vendor_php8.2_sf5.4: | ||
phpcsfixer_php8.2: | ||
phpcsfixer_php8.3: | ||
phpstan_php8.3: | ||
phpstan_php8.2: | ||
rector_php8.3: | ||
rector_php8.2: | ||
phpstan_cache: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.