diff --git a/.github/workflows/test_pull_request.yml b/.github/workflows/test_pull_request.yml index 56f4132..073b673 100644 --- a/.github/workflows/test_pull_request.yml +++ b/.github/workflows/test_pull_request.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] steps: - name: Set up PHP @@ -19,12 +19,12 @@ jobs: tools: composer:v2 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: '22.x' + node-version: '24.x' - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 @@ -74,12 +74,12 @@ jobs: tools: composer:v2 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: '22.x' + node-version: '24.x' - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/PHP_VERSIONS b/PHP_VERSIONS index 75df3c4..2563267 100644 --- a/PHP_VERSIONS +++ b/PHP_VERSIONS @@ -1,3 +1,4 @@ +8.5 8.4 8.3 8.2 diff --git a/README.md b/README.md index e13f4fc..031530f 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,19 @@ ## 1. Features -`Bash Colorizer` outputs strings in specified colors and attributes. +`Bash Colorizer` outputs strings to the bash terminal with specified colors and attributes. Let's make your `bash` terminal full of colors! +```php +use Macocci7\BashColorizer\Colorizer; + +Colorizer::attributes(['italic']) + ->foreground('#ffff00') + ->background('#0000ff') + ->echo('Hi, there!', PHP_EOL); +``` + ## 2. Contents - [1. Features](#1-features) @@ -31,7 +40,7 @@ Let's make your `bash` terminal full of colors! - PHP 8.1 or later installed - Composer v2 installed -- Bash v5 installed +- Bash v5 installed (or Zsh) ## 5. Installation diff --git a/bin/TestAndLint.sh b/bin/TestAndLint.sh index 4a3b743..9609a43 100644 --- a/bin/TestAndLint.sh +++ b/bin/TestAndLint.sh @@ -5,7 +5,7 @@ # - https://github.com/jdx/mise installed # - PHP versions defined in ../PHP_VERSIONS installed -CMD=mise +CMD=phpenv $CMD -v &> /dev/null if [ $? -ne 0 ]; then echo "command [${CMD}] not found!" @@ -19,13 +19,40 @@ if [ $? -ne 0 ]; then exit 1 fi -switch_version() { +test_and_lint() { echo "===========================================================" - echo "[PHP $1][Switching PHP version to $1]" - mise x php@$1 -- bash bin/TestAndLintSub.sh $1; + echo "[PHP $1][phpenv local $1]" + phpenv local $1 + if [ $? -ne 0 ]; then + echo "Failed to switch version to $1. skipped." + return 1 + fi + echo "-----------------------------------------------------------" + echo "[PHP $1][php -v]" + php -v + echo "-----------------------------------------------------------" + echo "[PHP $1][parallel-lint]" + ./vendor/bin/parallel-lint src tests + #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][phpstan]" + ./vendor/bin/phpstan analyze -c phpstan.neon + echo "-----------------------------------------------------------" + echo "[PHP $1][phpunit]" + ./vendor/bin/phpunit ./tests/ + echo "-----------------------------------------------------------" } -echo "[[TestAndLint.sh]]" +echo "[[TesAndLint.sh]]" SUPPORTED_PHP_VERSIONS=PHP_VERSIONS if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then @@ -40,6 +67,6 @@ if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then fi STR_CMD='' while read version ; do - STR_CMD="$STR_CMD switch_version $version;" + STR_CMD="$STR_CMD test_and_lint $version;" done < $SUPPORTED_PHP_VERSIONS eval $STR_CMD diff --git a/bin/TestAndLintSub.sh b/bin/TestAndLintSub.sh deleted file mode 100644 index c395c39..0000000 --- a/bin/TestAndLintSub.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 playground -echo "-----------------------------------------------------------" -echo "[PHP $1][phpcs]" -./vendor/bin/phpcs --ignore=vendor \ - --standard=phpcs.xml \ - -p \ - -s \ - . -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 eae45bf..fbc33e1 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require-dev": { "phpunit/phpunit": "^10.5", "php-parallel-lint/php-parallel-lint": "^1.4", - "squizlabs/php_codesniffer": "^3.12", + "squizlabs/php_codesniffer": "^4", "phpstan/phpstan": "^2.1" } }