From a4130a6355002225a1d7dc2ede74a30e7c54f692 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Feb 2021 15:30:25 +0100 Subject: [PATCH 1/4] Use GitHub actions for continuous integration (CI) Bye bye Travis CI, you've served us well. --- .gitattributes | 6 ++-- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 4 +-- .travis.yml | 46 ------------------------------ README.md | 2 +- 5 files changed, 67 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes index 64ab6e0f..fc0be872 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,7 @@ /.gitattributes export-ignore +/.github/ export-ignore /.gitignore export-ignore -/.travis.yml export-ignore -/examples export-ignore +/examples/ export-ignore /phpunit.xml.dist export-ignore /phpunit.xml.legacy export-ignore -/tests export-ignore +/tests/ export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..078b70ad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + pull_request: + +jobs: + PHPUnit: + name: PHPUnit (PHP ${{ matrix.php }} on ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-20.04 + - windows-2019 + php: + - 7.4 + - 7.3 + - 7.2 + - 7.1 + - 7.0 + - 5.6 + - 5.5 + - 5.4 + - 5.3 + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + - run: composer install + - run: vendor/bin/phpunit --coverage-text + if: ${{ matrix.php >= 7.3 }} + - run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy + if: ${{ matrix.php < 7.3 }} + + PHPUnit-macOS: + name: PHPUnit (macOS) + runs-on: macos-10.15 + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + coverage: xdebug + - run: composer install + - run: vendor/bin/phpunit --coverage-text + + PHPUnit-hhvm: + name: PHPUnit (HHVM) + runs-on: ubuntu-18.04 + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - uses: azjezz/setup-hhvm@v1 + with: + version: lts-3.30 + - run: hhvm $(which composer) install + - run: hhvm vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index 987e2a25..c8153b57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -composer.lock -vendor +/composer.lock +/vendor/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d1d2b11e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: php - -# lock distro so new future defaults will not break the build -dist: trusty - -jobs: - include: - - php: 5.3 - dist: precise - - php: 5.4 - - php: 5.5 - - php: 5.6 - - php: 7.0 - - php: 7.1 - - php: 7.2 - - php: 7.3 - - php: 7.4 - - php: hhvm-3.18 - - name: Mac OS X - os: osx - language: generic - before_install: - - curl -s http://getcomposer.org/installer | php - - mv composer.phar /usr/local/bin/composer - - name: Windows - os: windows - language: bash - before_install: - - choco install php - - choco install composer - - export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')" - - php -r "file_put_contents(php_ini_loaded_file(),'extension_dir=ext'.PHP_EOL,FILE_APPEND);" - - php -r "file_put_contents(php_ini_loaded_file(),'extension=sockets'.PHP_EOL,FILE_APPEND);" - install: - - composer install - allow_failures: - - php: hhvm-3.18 - - os: osx - - os: windows - -install: - - composer install - -script: - - if [[ "$TRAVIS_PHP_VERSION" > "7.2" ]]; then vendor/bin/phpunit --coverage-text; fi - - if [[ "$TRAVIS_PHP_VERSION" < "7.3" ]]; then vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy; fi diff --git a/README.md b/README.md index fafc66f8..c50b7433 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Socket -[![Build Status](https://travis-ci.org/reactphp/socket.svg?branch=master)](https://travis-ci.org/reactphp/socket) +[![CI status](https://github.com/reactphp/socket/workflows/CI/badge.svg)](https://github.com/reactphp/socket/actions) Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for [ReactPHP](https://reactphp.org/). From 7ec5fbd8ff6f11a3bda8464a9580e0f3d0206ddb Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 9 Feb 2021 16:06:54 +0100 Subject: [PATCH 2/4] Set Xdebug's stack limit to 256 for legacy PHP --- tests/FunctionalConnectorTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/FunctionalConnectorTest.php b/tests/FunctionalConnectorTest.php index edce03cd..59e4cb7e 100644 --- a/tests/FunctionalConnectorTest.php +++ b/tests/FunctionalConnectorTest.php @@ -77,6 +77,9 @@ public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueTo */ public function connectionToRemoteTCP4n6ServerShouldResultInOurIP() { + // max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP + ini_set('xdebug.max_nesting_level', 256); + $loop = Factory::create(); $connector = new Connector($loop, array('happy_eyeballs' => true)); From 51e613f4baf849658bed758d4a43574e9752d9aa Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Thu, 11 Feb 2021 10:59:45 +0100 Subject: [PATCH 3/4] Skip failing test for macOS and windows --- tests/FunctionalConnectorTest.php | 4 ++++ tests/FunctionalSecureServerTest.php | 4 ++-- tests/IntegrationTest.php | 4 ++++ tests/SecureIntegrationTest.php | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/FunctionalConnectorTest.php b/tests/FunctionalConnectorTest.php index 59e4cb7e..33655926 100644 --- a/tests/FunctionalConnectorTest.php +++ b/tests/FunctionalConnectorTest.php @@ -40,6 +40,10 @@ public function connectionToTcpServerShouldSucceedWithLocalhost() */ public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueToLocalDnsCache() { + if ((DIRECTORY_SEPARATOR === '\\' && PHP_VERSION_ID < 70000) || defined('HHVM_VERSION')) { + $this->markTestSkipped('Not supported on Windows for PHP versions < 7.0 and legacy HHVM'); + } + $loop = Factory::create(); $socket = stream_socket_server('udp://127.0.0.1:0', $errno, $errstr, STREAM_SERVER_BIND); diff --git a/tests/FunctionalSecureServerTest.php b/tests/FunctionalSecureServerTest.php index 568732f5..58b1cf4d 100644 --- a/tests/FunctionalSecureServerTest.php +++ b/tests/FunctionalSecureServerTest.php @@ -15,7 +15,7 @@ class FunctionalSecureServerTest extends TestCase { - const TIMEOUT = 0.5; + const TIMEOUT = 2; /** * @before @@ -174,7 +174,7 @@ public function testClientUsesTls10WhenCryptoMethodIsExplicitlyConfiguredByClien try { $client = Block\await($promise, $loop, self::TIMEOUT); } catch (\RuntimeException $e) { - if (strpos($e->getMessage(), 'no protocols available') !== false) { + if (strpos($e->getMessage(), 'no protocols available') !== false || strpos($e->getMessage(), 'routines:state_machine:internal error') !== false) { $this->markTestSkipped('TLS v1.0 not available on this system'); } diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 7ec2047e..71e77b2c 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -101,6 +101,10 @@ public function gettingPlaintextStuffFromEncryptedGoogleShouldNotWork() public function testConnectingFailsIfConnectorUsesInvalidDnsResolverAddress() { + if (PHP_OS === 'Darwin') { + $this->markTestSkipped('Skipped on macOS due to a bug in reactphp/dns (solved in reactphp/dns#171)'); + } + $loop = Factory::create(); $factory = new ResolverFactory(); diff --git a/tests/SecureIntegrationTest.php b/tests/SecureIntegrationTest.php index c55880b6..16d6dc35 100644 --- a/tests/SecureIntegrationTest.php +++ b/tests/SecureIntegrationTest.php @@ -15,7 +15,7 @@ class SecureIntegrationTest extends TestCase { - const TIMEOUT = 0.5; + const TIMEOUT = 2; private $loop; private $server; From 95fba525395e424b4bf9cd2a6970e2e8fb11ab96 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Wed, 24 Feb 2021 12:10:48 +0100 Subject: [PATCH 4/4] Support PHP 8 --- .github/workflows/ci.yml | 3 ++- README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 078b70ad..1d9d32ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: - ubuntu-20.04 - windows-2019 php: + - 8.0 - 7.4 - 7.3 - 7.2 @@ -43,7 +44,7 @@ jobs: - uses: actions/checkout@v2 - uses: shivammathur/setup-php@v2 with: - php-version: 7.4 + php-version: 8.0 coverage: xdebug - run: composer install - run: vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index c50b7433..85d3186b 100644 --- a/README.md +++ b/README.md @@ -1433,7 +1433,7 @@ $ composer require react/socket:^1.6 See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. +extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM. It's *highly recommended to use PHP 7+* for this project, partly due to its vast performance improvements and partly because legacy PHP versions require several workarounds as described below. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy