From f03da59391234082fc7fc0d66e792f6986bfb9f8 Mon Sep 17 00:00:00 2001 From: Radu Maier Date: Fri, 26 May 2023 12:40:49 +0200 Subject: [PATCH] Support PHP 7.4 --- .github/workflows/downgraded_release.yaml | 45 +++++++++++++++++++++++ build/composer-php-74.json | 28 ++++++++++++++ build/rector-downgrade-php-74.php | 10 +++++ composer.json | 1 + 4 files changed, 84 insertions(+) create mode 100644 .github/workflows/downgraded_release.yaml create mode 100644 build/composer-php-74.json create mode 100644 build/rector-downgrade-php-74.php diff --git a/.github/workflows/downgraded_release.yaml b/.github/workflows/downgraded_release.yaml new file mode 100644 index 0000000..1b1faa7 --- /dev/null +++ b/.github/workflows/downgraded_release.yaml @@ -0,0 +1,45 @@ +name: Downgraded Release + +on: + push: + tags: + - '*' + +jobs: + downgrade_release: + runs-on: ubuntu-latest + + steps: + - + uses: "actions/checkout@v2" + + - + uses: "shivammathur/setup-php@v2" + with: + php-version: 8.2 + coverage: none + + - uses: "ramsey/composer-install@v2" + + # downgrade /src to PHP 7.4 + - run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi + + # copy PHP 7.4 composer + - run: cp build/composer-php-74.json composer.json + + # clear the dev files + - run: rm -rf .github .phpcs .scannerwork build tests + + # setup git user + - + run: | + git config user.email "action@github.com" + git config user.name "GitHub Action" + + # publish to the same repository with a new tag + - + name: "Tag Downgraded Code" + run: | + git commit -a -m "release PHP 7.4 downgraded ${GITHUB_REF#refs/tags/}" + git tag "${GITHUB_REF#refs/tags/}.74" + git push origin "${GITHUB_REF#refs/tags/}.74" diff --git a/build/composer-php-74.json b/build/composer-php-74.json new file mode 100644 index 0000000..1da8662 --- /dev/null +++ b/build/composer-php-74.json @@ -0,0 +1,28 @@ +{ + "authors" : [ + { + "name" : "Radu Maier", + "email" : "ariademur@webserv.co" + } + ], + "autoload" : { + "psr-4" : { + "Tests\\Unit\\" : "tests/Unit/", + "WebServCo\\" : "src/WebServCo/" + } + }, + "description" : "A PHP component.", + "homepage" : "https://webserv.co", + "keywords" : [ + "component", + "webservco" + ], + "license" : "MIT", + "name" : "webservco/log", + "require": { + "php" : "^7.4", + "psr/log": "^3" + + }, + "type" : "library" +} diff --git a/build/rector-downgrade-php-74.php b/build/rector-downgrade-php-74.php new file mode 100644 index 0000000..b98900a --- /dev/null +++ b/build/rector-downgrade-php-74.php @@ -0,0 +1,10 @@ +sets([DowngradeLevelSetList::DOWN_TO_PHP_74]); +}; diff --git a/composer.json b/composer.json index d29760e..0d30ff8 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "phpstan/phpstan-phpunit": "^1", "phpstan/phpstan" : "^1", "phpunit/phpunit": "^10", + "rector/rector": "^0", "slevomat/coding-standard": "^8", "squizlabs/php_codesniffer" : "^3", "vimeo/psalm": "^5",