diff --git a/.travis.yml b/.travis.yml index 75ea350c3..92f39f22e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,11 @@ dist: xenial language: php php: +- '8.0' - '7.4' +- '7.3' +- '7.2' +- '7.1' - '7.0' - '5.6' diff --git a/tests/conversion/after-70.sh b/tests/conversion/after-70.sh index ae4f60f15..c91136d9c 100755 --- a/tests/conversion/after-70.sh +++ b/tests/conversion/after-70.sh @@ -1,4 +1,4 @@ #!/bin/bash -e -find vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {} + +#find vendor/danog/madelineproto -type f -name '*.php' -exec sed 's/: EncryptableSocket/: \\Amp\\Socket\\Socket/g' -i {} + diff --git a/tests/conversion/prepare-5.sh b/tests/conversion/prepare-5.sh index 495e84f2e..d26c34a57 100755 --- a/tests/conversion/prepare-5.sh +++ b/tests/conversion/prepare-5.sh @@ -2,9 +2,9 @@ rm -rf vendor/danog/madelineproto/docs -sed -re 's/\?(\w*) (\$\w+)/\2 = NULL/g;s/= null = null/=null/ig;s/: self//g' -i vendor/league/uri-interfaces/src/Contracts/UriInterface.php -php $(dirname $0)/prepare-5.php +#sed -re 's/\?(\w*) (\$\w+)/\2 = NULL/g;s/= null = null/=null/ig;s/: self//g' -i vendor/league/uri-interfaces/src/Contracts/UriInterface.php +#php $(dirname $0)/prepare-5.php -sed -i 's/handleConnectionWindowIncrement[(]\$windowSize[)]/handleConnectionWindowIncrement(int $windowSize)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php +#sed -i 's/handleConnectionWindowIncrement[(]\$windowSize[)]/handleConnectionWindowIncrement(int $windowSize)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php sed -ri 's/^\{/{ use \\MyCallableMaker;/g;s/\\Closure::fromCallable[(]\[(.+), (.+)\][)]/\1->callableFromInstanceMethod(\2)/g' vendor/amphp/http-client/src/Connection/Internal/Http2ConnectionProcessor.php vendor/amphp/http-client/src/Connection/Http{2,1}Connection.php diff --git a/tests/makephar.sh b/tests/makephar.sh index bc705fe4b..918a2e9a7 100755 --- a/tests/makephar.sh +++ b/tests/makephar.sh @@ -16,7 +16,7 @@ skip=n exit 1 } cat tests/MadelineProto.log -} || { + } || { skip=y echo "Skip" } @@ -31,12 +31,19 @@ cd phar7 [ "$IS_RELEASE" == "y" ] && composer=$TRAVIS_BRANCH || composer="dev-$TRAVIS_BRANCH" +sudo add-apt-repository ppa:ondrej/php -y +sudo apt-get update -q +sudo apt-get install php8.0-cli php8.0-json php8.0-mbstring php8.0-curl php8.0-xml php8.0-json -y + +alias composer="php8.0 $(which composer)" + # Install echo '{ "name": "danog/madelineprototests", "minimum-stability":"dev", "require": { "danog/madelineproto": "'$composer'", + "phabel/phabel": "dev-master", "amphp/websocket-client": "dev-master as 1.0.0-rc2", "amphp/dns": "dev-master#eb0b0a2 as v1" }, @@ -56,73 +63,59 @@ echo '{ } ] }' > composer.json -composer config platform.php "7.4" +composer config platform.php "8.0" composer clearcache composer update composer require amphp/mysql -[ $PHP_MAJOR_VERSION -eq 5 ] && { - composer require dstuecken/php7ify - composer require symfony/polyfill-php70 - composer require symfony/polyfill-php71 - composer require symfony/polyfill-php72 - composer require symfony/polyfill-php73 -} -[ $PHP_MAJOR_VERSION -eq 7 ] && [ $PHP_MINOR_VERSION -eq 0 ] && { - composer require symfony/polyfill-php71 - composer require symfony/polyfill-php72 - composer require symfony/polyfill-php73 -} -composer dumpautoload --optimize cp -a $madelinePath/src vendor/danog/madelineproto cd .. -[ $PHP_MAJOR_VERSION -eq 5 ] && { - sudo add-apt-repository ppa:ondrej/php -y - sudo apt-get update -q - sudo apt-get install php7.3-cli php7.3-json php7.3-mbstring php7.3-curl php7.3-xml php7.3-json -y - - composer global require danog/7to5 - [ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5 - [ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5 +phabel() { + cd phar7 + php8.0 vendor/bin/phabel ../phar5 + cd ../phar5 + composer dumpautoload --optimize + cd .. +} +export PHABEL_TARGET="$PHP_MAJOR_VERSION$PHP_MINOR_VERSION" + +php=$PHABEL_TARGET + +[ $PHP_MAJOR_VERSION -eq 5 ] && { + cd phar7 ls $madelinePath/tests/conversion/prepare-5.sh cd .. - - php7.3 $php7to5 convert --copy-all phar7 phar5 - + + phabel + cd phar5 ls $madelinePath/tests/conversion/after-5.sh cd .. - - php -v - php=5 + php -v } [ $PHP_MAJOR_VERSION -eq 7 ] && { - [ $PHP_MINOR_VERSION -eq 0 ] && { - composer global require danog/7to70 - [ -f $HOME/.composer/vendor/bin/php7to70 ] && php7to70=$HOME/.composer/vendor/bin/php7to70 - [ -f $HOME/.config/composer/vendor/bin/php7to70 ] && php7to70=$HOME/.config/composer/vendor/bin/php7to70 - - cd phar7 + cd phar7 ls - $madelinePath/tests/conversion/prepare-70.sh - cd .. - - $php7to70 convert --copy-all phar7 phar5 - - cd phar5 + $madelinePath/tests/conversion/prepare-70.sh + cd .. + + phabel + + cd phar5 ls - $madelinePath/tests/conversion/after-70.sh - cd .. + $madelinePath/tests/conversion/after-70.sh + cd .. +} || { + cp -a phar7 phar5 - php=70 - } || { - cp -a phar7 phar5 - } + cd phar5 + composer dumpautoload --optimize + cd .. } find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} + @@ -186,13 +179,6 @@ ssh-add madeline_rsa git clone git@github.com:danog/MadelineProtoPhar cd MadelineProtoPhar -[ "$php" == "70" ] && { - while [ "$(cat release$branch)" != "$TRAVIS_COMMIT"- ]; do sleep 1; git pull; done -} -[ "$php" == "5" ] && { - while [ "$(cat release70$branch)" != "$TRAVIS_COMMIT"-70 ]; do sleep 1; git pull; done -} - cp "../madeline$php$branch.phar" . cp ../tools/phar.php ../examples/mtproxyd . echo -n "$TRAVIS_COMMIT-$php" > release$php$branch @@ -204,8 +190,12 @@ echo -n "$TRAVIS_COMMIT-$php" > release$php$branch git add -A git commit -am "Release $TRAVIS_BRANCH - $TRAVIS_COMMIT_MESSAGE" -git push origin master - +while :; do + git push origin master && break || { + git fetch + git rebase origin/master + } +done cd .. echo "$TRAVIS_COMMIT_MESSAGE" | grep "Apply fixes from StyleCI" && exit diff --git a/tools/phar.php b/tools/phar.php index c70b79413..cc43a2d3e 100644 --- a/tools/phar.php +++ b/tools/phar.php @@ -36,11 +36,11 @@ function ___install_madeline() } echo "**********************************************************************************$newline"; echo "**********************************************************************************$newline$newline"; - echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 7.3$newline"; + echo "YOU ARE USING AN OLD AND BUGGED VERSION OF PHP, PLEASE UPDATE TO PHP 8.0$newline"; echo "PHP 5/7.0 USERS WILL NOT RECEIVE PHP UPDATES AND BUGFIXES: https://www.php.net/eol.php$newline"; echo "PHP 5/7.0 USERS WILL NOT RECEIVE MADELINEPROTO UPDATES AND BUGFIXES$newline$newline"; - echo "SUPPORTED VERSIONS: PHP 7.1, 7.2, 7.3+$newline"; - echo "RECOMMENDED VERSION: PHP 7.3$newline$newline"; + echo "SUPPORTED VERSIONS: PHP 7.1, 7.2, 7.3, 7.4, 8.0+$newline"; + echo "RECOMMENDED VERSION: PHP 8.0$newline$newline"; echo "**********************************************************************************$newline"; echo "**********************************************************************************$newline"; unset($newline); @@ -79,9 +79,9 @@ function ___install_madeline() if (PHP_MAJOR_VERSION <= 5) { $release_branch = '5'.$release_branch; $release_fallback_branch = '5'.$release_fallback_branch; - } elseif (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION < 4) { - $release_branch = '70'.$release_branch; - $release_fallback_branch = '70'.$release_fallback_branch; + } elseif (PHP_MAJOR_VERSION === 7) { + $release_branch = PHP_MAJOR_VERSION.PHP_MINOR_VERSION.$release_branch; + $release_fallback_branch = PHP_MAJOR_VERSION.PHP_MINOR_VERSION.$release_fallback_branch; } // Checking if defined branch/default branch builds can be downloaded