Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub actions for continuous integration (CI) #254

Merged
merged 4 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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:
- 8.0
- 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: 8.0
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
composer.lock
vendor
/composer.lock
/vendor/
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/).
Expand Down Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions tests/FunctionalConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -77,6 +81,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));
Expand Down
4 changes: 2 additions & 2 deletions tests/FunctionalSecureServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class FunctionalSecureServerTest extends TestCase
{
const TIMEOUT = 0.5;
const TIMEOUT = 2;

/**
* @before
Expand Down Expand Up @@ -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');
}

Expand Down
4 changes: 4 additions & 0 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)');
clue marked this conversation as resolved.
Show resolved Hide resolved
}

$loop = Factory::create();

$factory = new ResolverFactory();
Expand Down
2 changes: 1 addition & 1 deletion tests/SecureIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class SecureIntegrationTest extends TestCase
{
const TIMEOUT = 0.5;
const TIMEOUT = 2;

private $loop;
private $server;
Expand Down