Skip to content

GitHub actions #159

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

Closed
wants to merge 7 commits into from
Closed
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
30 changes: 15 additions & 15 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.editorconfig export-ignore
.gitattributes export-ignore
/.github/ export-ignore
.gitignore export-ignore
/.php_cs export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/behat.yml.dist export-ignore
/features/ export-ignore
/phpspec.ci.yml export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/spec/ export-ignore
/tests/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
/.github/ export-ignore
.gitignore export-ignore
/.php_cs.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/phpspec.ci.yml export-ignore
/phpspec.yml.dist export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/spec/ export-ignore
/tests/ export-ignore
2 changes: 2 additions & 0 deletions .github/workflows/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.yml]
indent_size = 2
42 changes: 42 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Checks

on:
push:
branches:
- master
pull_request:

jobs:
composer-normalize:
name: Composer Normalize
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Install
uses: docker://composer
with:
args: install

- name: Require normalize
uses: docker://composer
with:
args: require --dev ergebnis/composer-normalize

- name: Normalize
uses: docker://composer
with:
args: composer normalize --dry-run

roave-bc-check:
name: Roave BC Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build-lowest-version:
name: Build lowest version
runs-on: ubuntu-latest

steps:
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: '7.0'

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Checkout code
uses: actions/checkout@v1

- name: Download dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --no-suggest --prefer-lowest

- name: Run tests
run: composer test

build:
name: Build
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4']

steps:
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Checkout code
uses: actions/checkout@v1

- name: Download dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --no-suggest

- name: Run tests
run: composer test
34 changes: 34 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Static analysis

on:
push:
branches:
- master
pull_request:

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
with:
args: analyze --no-progress

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run --diff-format udiff
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/behat.yml
.php_cs
.php_cs.cache
/build/
/composer.lock
/phpspec.yml
Expand Down
13 changes: 0 additions & 13 deletions .php_cs

This file was deleted.

16 changes: 16 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->name('*.php')
)
;

return $config;
28 changes: 16 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
{
"name": "php-http/httplug",
"description": "HTTPlug, the HTTP client abstraction for PHP",
"license": "MIT",
"keywords": ["http", "client"],
"keywords": [
"http",
"client"
],
"homepage": "http://httplug.io",
"license": "MIT",
"authors": [
{
"name": "Eric GELOEN",
"email": "[email protected]"
},
{
"name": "Márk Sági-Kazár",
"email": "[email protected]"
"email": "[email protected]",
"homepage": "https://sagikazarmark.hu"
}
],
"require": {
"php": "^7.0",
"psr/http-message": "^1.0",
"php-http/promise": "^1.0",
"psr/http-client": "^1.0",
"php-http/promise": "^1.0"
"psr/http-message": "^1.0"
},
"require-dev": {
"phpspec/phpspec": "^4.3.4|^5.0|^6.0",
"friends-of-phpspec/phpspec-code-coverage" : "^4.1"
"friends-of-phpspec/phpspec-code-coverage": "^4.1",
"phpspec/phpspec": "^4.3.4 || ^5.0 || ^6.0"
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
Expand All @@ -32,10 +41,5 @@
"scripts": {
"test": "vendor/bin/phpspec run",
"test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
}
}
22 changes: 22 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
parameters:
ignoreErrors:
-
message: "#^Method Http\\\\Client\\\\Exception\\\\HttpException\\:\\:create\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/Exception/HttpException.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/Exception/HttpException.php

-
message: "#^Method Http\\\\Client\\\\Exception\\\\NetworkException\\:\\:setRequest\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/Exception/NetworkException.php

-
message: "#^Method Http\\\\Client\\\\Exception\\\\RequestException\\:\\:setRequest\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/Exception/RequestException.php

7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- phpstan-baseline.neon

parameters:
level: max
paths:
- src
5 changes: 1 addition & 4 deletions src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class HttpException extends RequestException
protected $response;

/**
* @param string $message
* @param RequestInterface $request
* @param ResponseInterface $response
* @param \Exception|null $previous
* @param string $message
*/
public function __construct(
$message,
Expand Down
6 changes: 2 additions & 4 deletions src/Exception/NetworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\Client\Exception;

use Psr\Http\Message\RequestInterface;
use Psr\Http\Client\NetworkExceptionInterface as PsrNetworkException;
use Psr\Http\Message\RequestInterface;

/**
* Thrown when the request cannot be completed because of network issues.
Expand All @@ -17,9 +17,7 @@ class NetworkException extends TransferException implements PsrNetworkException
use RequestAwareTrait;

/**
* @param string $message
* @param RequestInterface $request
* @param \Exception|null $previous
* @param string $message
*/
public function __construct($message, RequestInterface $request, \Exception $previous = null)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Exception/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Http\Client\Exception;

use Psr\Http\Message\RequestInterface;
use Psr\Http\Client\RequestExceptionInterface as PsrRequestException;
use Psr\Http\Message\RequestInterface;

/**
* Exception for when a request failed, providing access to the failed request.
Expand All @@ -18,9 +18,7 @@ class RequestException extends TransferException implements PsrRequestException
use RequestAwareTrait;

/**
* @param string $message
* @param RequestInterface $request
* @param \Exception|null $previous
* @param string $message
*/
public function __construct($message, RequestInterface $request, \Exception $previous = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/HttpAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface HttpAsyncClient
*
* Exceptions related to processing the request are available from the returned Promise.
*
* @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception.
* @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception
*
* @throws \Exception If processing the request is impossible (eg. bad configuration).
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Promise/HttpFulfilledPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ final class HttpFulfilledPromise implements Promise
*/
private $response;

/**
* @param ResponseInterface $response
*/
public function __construct(ResponseInterface $response)
{
$this->response = $response;
Expand Down
3 changes: 0 additions & 3 deletions src/Promise/HttpRejectedPromise.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ final class HttpRejectedPromise implements Promise
*/
private $exception;

/**
* @param Exception $exception
*/
public function __construct(Exception $exception)
{
$this->exception = $exception;
Expand Down