Skip to content

Commit eef95f0

Browse files
authored
Merge pull request #254 from SimonFrings/ci
Use GitHub actions for continuous integration (CI)
2 parents 28fac70 + 95fba52 commit eef95f0

9 files changed

+83
-56
lines changed

.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/.gitattributes export-ignore
2+
/.github/ export-ignore
23
/.gitignore export-ignore
3-
/.travis.yml export-ignore
4-
/examples export-ignore
4+
/examples/ export-ignore
55
/phpunit.xml.dist export-ignore
66
/phpunit.xml.legacy export-ignore
7-
/tests export-ignore
7+
/tests/ export-ignore

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
PHPUnit:
9+
name: PHPUnit (PHP ${{ matrix.php }} on ${{ matrix.os }})
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os:
14+
- ubuntu-20.04
15+
- windows-2019
16+
php:
17+
- 8.0
18+
- 7.4
19+
- 7.3
20+
- 7.2
21+
- 7.1
22+
- 7.0
23+
- 5.6
24+
- 5.5
25+
- 5.4
26+
- 5.3
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
coverage: xdebug
33+
- run: composer install
34+
- run: vendor/bin/phpunit --coverage-text
35+
if: ${{ matrix.php >= 7.3 }}
36+
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
37+
if: ${{ matrix.php < 7.3 }}
38+
39+
PHPUnit-macOS:
40+
name: PHPUnit (macOS)
41+
runs-on: macos-10.15
42+
continue-on-error: true
43+
steps:
44+
- uses: actions/checkout@v2
45+
- uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: 8.0
48+
coverage: xdebug
49+
- run: composer install
50+
- run: vendor/bin/phpunit --coverage-text
51+
52+
PHPUnit-hhvm:
53+
name: PHPUnit (HHVM)
54+
runs-on: ubuntu-18.04
55+
continue-on-error: true
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: azjezz/setup-hhvm@v1
59+
with:
60+
version: lts-3.30
61+
- run: hhvm $(which composer) install
62+
- run: hhvm vendor/bin/phpunit

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
composer.lock
2-
vendor
1+
/composer.lock
2+
/vendor/

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Socket
22

3-
[![Build Status](https://travis-ci.org/reactphp/socket.svg?branch=master)](https://travis-ci.org/reactphp/socket)
3+
[![CI status](https://github.com/reactphp/socket/workflows/CI/badge.svg)](https://github.com/reactphp/socket/actions)
44

55
Async, streaming plaintext TCP/IP and secure TLS socket server and client
66
connections for [ReactPHP](https://reactphp.org/).
@@ -1433,7 +1433,7 @@ $ composer require react/socket:^1.6
14331433
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
14341434

14351435
This project aims to run on any platform and thus does not require any PHP
1436-
extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM.
1436+
extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM.
14371437
It's *highly recommended to use PHP 7+* for this project, partly due to its vast
14381438
performance improvements and partly because legacy PHP versions require several
14391439
workarounds as described below.

tests/FunctionalConnectorTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public function connectionToTcpServerShouldSucceedWithLocalhost()
4040
*/
4141
public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueToLocalDnsCache()
4242
{
43+
if ((DIRECTORY_SEPARATOR === '\\' && PHP_VERSION_ID < 70000) || defined('HHVM_VERSION')) {
44+
$this->markTestSkipped('Not supported on Windows for PHP versions < 7.0 and legacy HHVM');
45+
}
46+
4347
$loop = Factory::create();
4448

4549
$socket = stream_socket_server('udp://127.0.0.1:0', $errno, $errstr, STREAM_SERVER_BIND);
@@ -77,6 +81,9 @@ public function testConnectTwiceWithoutHappyEyeBallsOnlySendsSingleDnsQueryDueTo
7781
*/
7882
public function connectionToRemoteTCP4n6ServerShouldResultInOurIP()
7983
{
84+
// max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
85+
ini_set('xdebug.max_nesting_level', 256);
86+
8087
$loop = Factory::create();
8188

8289
$connector = new Connector($loop, array('happy_eyeballs' => true));

tests/FunctionalSecureServerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class FunctionalSecureServerTest extends TestCase
1717
{
18-
const TIMEOUT = 0.5;
18+
const TIMEOUT = 2;
1919

2020
/**
2121
* @before
@@ -174,7 +174,7 @@ public function testClientUsesTls10WhenCryptoMethodIsExplicitlyConfiguredByClien
174174
try {
175175
$client = Block\await($promise, $loop, self::TIMEOUT);
176176
} catch (\RuntimeException $e) {
177-
if (strpos($e->getMessage(), 'no protocols available') !== false) {
177+
if (strpos($e->getMessage(), 'no protocols available') !== false || strpos($e->getMessage(), 'routines:state_machine:internal error') !== false) {
178178
$this->markTestSkipped('TLS v1.0 not available on this system');
179179
}
180180

tests/IntegrationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ public function gettingPlaintextStuffFromEncryptedGoogleShouldNotWork()
101101

102102
public function testConnectingFailsIfConnectorUsesInvalidDnsResolverAddress()
103103
{
104+
if (PHP_OS === 'Darwin') {
105+
$this->markTestSkipped('Skipped on macOS due to a bug in reactphp/dns (solved in reactphp/dns#171)');
106+
}
107+
104108
$loop = Factory::create();
105109

106110
$factory = new ResolverFactory();

tests/SecureIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class SecureIntegrationTest extends TestCase
1717
{
18-
const TIMEOUT = 0.5;
18+
const TIMEOUT = 2;
1919

2020
private $loop;
2121
private $server;

0 commit comments

Comments
 (0)