Skip to content

Commit

Permalink
Merge pull request #157 from SimonFrings/ci
Browse files Browse the repository at this point in the history
 Use GitHub actions for continuous integration (CI)
  • Loading branch information
WyriHaximus authored Feb 9, 2021
2 parents c459d2e + fb4cf11 commit 2859a8c
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 47 deletions.
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 }})
runs-on: ubuntu-20.04
strategy:
matrix:
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 }}
- run: time php examples/91-benchmark-throughput.php

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
- run: time php examples/91-benchmark-throughput.php

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
- run: time php examples/91-benchmark-throughput.php
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/
37 changes: 0 additions & 37 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 @@
# Stream

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

Event-driven readable and writable streams for non-blocking I/O in [ReactPHP](https://reactphp.org/).

Expand Down Expand Up @@ -1185,7 +1185,7 @@ $ composer require react/stream:^1.1.1
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 due to its vast
performance improvements.

Expand Down
4 changes: 2 additions & 2 deletions tests/FunctionalInternetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testUploadBiggerBlockPlain()
public function testUploadKilobyteSecure()
{
$size = 1000;
$stream = stream_socket_client('tls://httpbin.org:443');
$stream = stream_socket_client('ssl://httpbin.org:443');

$loop = Factory::create();
$stream = new DuplexResourceStream($stream, $loop);
Expand All @@ -85,7 +85,7 @@ public function testUploadBiggerBlockSecure()
// a bit to trigger different behavior on Linux vs Mac OS X.
$size = 136 * 1000;

$stream = stream_socket_client('tls://httpbin.org:443');
$stream = stream_socket_client('ssl://httpbin.org:443');

// PHP < 7.1.4 (and PHP < 7.0.18) suffers from a bug when writing big
// chunks of data over TLS streams at once.
Expand Down
11 changes: 11 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,15 @@ public function assertContainsStringIgnoringCase($needle, $haystack)
$this->assertContains($needle, $haystack, '', true);
}
}

public function assertSameIgnoringCase($expected, $actual)
{
if (method_exists($this, 'assertEqualsIgnoringCase')) {
// PHPUnit 7.5+
$this->assertEqualsIgnoringCase($expected, $actual);
} else {
// legacy PHPUnit 4 - PHPUnit 7.5
$this->assertSame($expected, $actual);
}
}
}
2 changes: 1 addition & 1 deletion tests/WritableResourceStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public function testWritingToClosedStream()
$buffer->handleWrite();

$this->assertInstanceOf('Exception', $error);
$this->assertSame('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage());
$this->assertSameIgnoringCase('Unable to write to stream: fwrite(): send of 3 bytes failed with errno=32 Broken pipe', $error->getMessage());
}

private function createWriteableLoopMock()
Expand Down

0 comments on commit 2859a8c

Please sign in to comment.