diff --git a/.github/workflows/tag_meged_pull_request.yml b/.github/workflows/tag_meged_pull_request.yml index 044bba3..f26a4df 100644 --- a/.github/workflows/tag_meged_pull_request.yml +++ b/.github/workflows/tag_meged_pull_request.yml @@ -18,7 +18,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: xdebug tools: composer:v2 diff --git a/.github/workflows/test_pull_request.yml b/.github/workflows/test_pull_request.yml index 850bb48..5f59ce7 100644 --- a/.github/workflows/test_pull_request.yml +++ b/.github/workflows/test_pull_request.yml @@ -11,7 +11,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 tools: composer:v2 - name: Checkout code @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.2', '8.3'] + php: ['8.2', '8.3', '8.4'] steps: - name: Set up PHP @@ -65,7 +65,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '14.x' + node-version: '20.x' - name: Checkout code uses: actions/checkout@v4 @@ -85,13 +85,13 @@ jobs: - name: PHP Lint run: ./vendor/bin/parallel-lint src tests examples -# - name: Neon Lint -# run: ./vendor/nette/neon/bin/neon-lint conf + #- name: Neon Lint + # run: ./vendor/nette/neon/bin/neon-lint conf - - name: PHP MD - run: | - ./vendor/bin/phpmd --version - ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml + #- name: PHP MD + # run: | + # ./vendor/bin/phpmd --version + # ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml - name: PHP Code Sniffer run: | @@ -115,7 +115,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.2'] + php: ['8.3'] steps: - name: Set up PHP @@ -128,7 +128,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '14.x' + node-version: '20.x' - name: Checkout code uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 2239292..d15a32c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ vendor/ composer.lock .php-version +.tool-versions build/ node_modules/ storage/ diff --git a/PHP_VERSIONS b/PHP_VERSIONS index 9e069ce..e37251a 100644 --- a/PHP_VERSIONS +++ b/PHP_VERSIONS @@ -1,2 +1,3 @@ +8.4 8.3 8.2 diff --git a/README.md b/README.md index 20b831c..5e145c8 100644 --- a/README.md +++ b/README.md @@ -259,4 +259,4 @@ Here's an example code for using `Instance` rule object: [ValidateInstance.php]( *** -*Copyright 2024 macocci7* +Copyright 2024 - 2025 macocci7. diff --git a/bin/TestAndLint.sh b/bin/TestAndLint.sh index f8f3e50..4a3b743 100644 --- a/bin/TestAndLint.sh +++ b/bin/TestAndLint.sh @@ -1,12 +1,11 @@ #!/usr/bin/bash # Script to Test and Lint -# - for the repository: macocci7/purephp-validation # requirement: -# - phpenv/phpenv +# - https://github.com/jdx/mise installed # - PHP versions defined in ../PHP_VERSIONS installed -CMD=phpenv +CMD=mise $CMD -v &> /dev/null if [ $? -ne 0 ]; then echo "command [${CMD}] not found!" @@ -20,46 +19,13 @@ if [ $? -ne 0 ]; then exit 1 fi -test_and_lint() { +switch_version() { echo "===========================================================" - echo "[PHP $1][phpenv local $1]" - phpenv local $1 - if [ $? -ne 0 ]; then - echo "Failed to switch version to $i. skipped." - return 1 - fi - echo "-----------------------------------------------------------" - echo "[PHP $1][php -v]" - php -v - echo "-----------------------------------------------------------" - echo "[PHP $1][parallel-lint]" - ./vendor/bin/parallel-lint src tests examples - echo "-----------------------------------------------------------" - #echo "[PHP $1][neon-lint]" - #./vendor/nette/neon/bin/neon-lint conf - #echo "-----------------------------------------------------------" - echo "[PHP $1][phpcs]" - ./vendor/bin/phpcs --ignore=vendor \ - --standard=phpcs.xml \ - -p \ - -s \ - . - echo "-----------------------------------------------------------" - echo "[PHP $1][phpmd]" - ./vendor/bin/phpmd \ - ./src/ ./examples/ ./tests/ text \ - phpmd.xml - echo "-----------------------------------------------------------" - echo "[PHP $1][phpstan]" - ./vendor/bin/phpstan analyze -c phpstan.neon - echo "-----------------------------------------------------------" - echo "[PHP $1][phpunit]" - ./vendor/bin/phpunit ./tests/ \ - --color=auto - echo "-----------------------------------------------------------" + echo "[PHP $1][Switching PHP version to $1]" + mise x php@$1 -- bash bin/TestAndLintSub.sh $1; } -echo "[[TesAndLint.sh]]" +echo "[[TestAndLint.sh]]" SUPPORTED_PHP_VERSIONS=PHP_VERSIONS if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then @@ -74,6 +40,6 @@ if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then fi STR_CMD='' while read version ; do - STR_CMD="$STR_CMD test_and_lint $version;" + STR_CMD="$STR_CMD switch_version $version;" done < $SUPPORTED_PHP_VERSIONS eval $STR_CMD diff --git a/bin/TestAndLintSub.sh b/bin/TestAndLintSub.sh new file mode 100644 index 0000000..837e9aa --- /dev/null +++ b/bin/TestAndLintSub.sh @@ -0,0 +1,34 @@ +#!/usr/bin/bash + +# Script to Test and Lint +# requirement: +# - PHP versions defined in ../PHP_VERSIONS installed + +echo "-----------------------------------------------------------" +echo "[PHP $1][php -v]" +php -v +echo "-----------------------------------------------------------" +echo "[PHP $1][parallel-lint]" +./vendor/bin/parallel-lint src tests examples +#echo "-----------------------------------------------------------" +#echo "[PHP $1][neon-lint]" +#./vendor/nette/neon/bin/neon-lint conf +echo "-----------------------------------------------------------" +echo "[PHP $1][phpcs]" +./vendor/bin/phpcs --ignore=vendor \ + --standard=phpcs.xml \ + -p \ + -s \ + . +#echo "-----------------------------------------------------------" +#echo "[PHP $1][phpmd]" +#./vendor/bin/phpmd \ +# ./src/ ./examples/ ./tests/ text \ +# phpmd.xml +echo "-----------------------------------------------------------" +echo "[PHP $1][phpstan]" +./vendor/bin/phpstan analyze -c phpstan.neon +echo "-----------------------------------------------------------" +echo "[PHP $1][phpunit]" +./vendor/bin/phpunit ./tests/ +echo "-----------------------------------------------------------" diff --git a/composer.json b/composer.json index 945abd8..3ecfa56 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "macocci7/purephp-validation", "description": "illuminate/validation wrapper for pure php.", - "version": "0.0.4", + "version": "0.0.5", "type": "library", "license": "MIT", "autoload": { @@ -18,14 +18,14 @@ "minimum-stability": "stable", "require": { "php": ">=8.2", - "illuminate/validation": "^11.5" + "illuminate/validation": "^11.37" }, "require-dev": { - "squizlabs/php_codesniffer": "^3.9", - "phpunit/phpunit": "^11.1", + "squizlabs/php_codesniffer": "^3.11", + "phpunit/phpunit": "^11.5", "phpmd/phpmd": "^2.15", "php-parallel-lint/php-parallel-lint": "^1.4", - "phpstan/phpstan": "^1.10", + "phpstan/phpstan": "^2.1", "askdkc/breezejp": "^1.8" } }