Skip to content

Commit

Permalink
switch to github workflow (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed May 21, 2022
1 parent 98ead1f commit 6a53322
Show file tree
Hide file tree
Showing 25 changed files with 277 additions and 202 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/.editorconfig
@@ -0,0 +1,2 @@
[*.yml]
indent_size = 2
19 changes: 19 additions & 0 deletions .github/workflows/checks.yml
@@ -0,0 +1,19 @@
name: Checks

on:
push:
branches:
- master
pull_request:

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

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

- name: Roave BC Check
uses: "docker://nyholm/roave-bc-check-ga"
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,94 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
latest:
name: PHP ${{ matrix.php }} Latest
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Install PHP 7 dependencies
run: composer update --prefer-dist --no-interaction --no-progress
if: "startsWith(matrix.php, '7.')"

- name: Install PHP 8 dependencies
run: |
composer require "phpdocumentor/reflection-docblock:^5.2@dev" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --no-interaction --no-progress --ignore-platform-req=php
if: "startsWith(matrix.php, '8.')"

- name: Execute tests
run: composer test

lowest:
name: PHP ${{ matrix.php }} Lowest
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.4']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v1
coverage: none

- name: Install dependencies
run: |
wget https://github.com/puli/cli/releases/download/1.0.0-beta9/puli.phar && chmod +x puli.phar
composer require "sebastian/comparator:^3.0.2" "puli/composer-plugin:1.0.0-beta9" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
- name: Execute tests
run: composer test

coverage:
name: Code Coverage
runs-on: ubuntu-latest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2
coverage: xdebug

- name: Install dependencies
run: |
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: composer test-ci

- name: Upload coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml
94 changes: 94 additions & 0 deletions .github/workflows/installation.yml
@@ -0,0 +1,94 @@
name: Installation
on:
push:
branches:
- master
pull_request:

jobs:
installation:
name: Installation test ${{ matrix.expect }} ${{ matrix.method }} ${{ matrix.requirements }} ${{ matrix.pecl }}
runs-on: ubuntu-latest

strategy:
matrix:
include:
# Test that we find Guzzle 6 v1
- expect: will-find
requirements: "php-http/guzzle6-adapter:^1.1.1"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# Test that we find Guzzle 6 v2
- expect: will-find
requirements: "php-http/guzzle6-adapter:^2.0.1"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# Test that we find Guzzle 7 Adapter
- expect: will-find
requirements: "php-http/guzzle7-adapter:^0.1"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# Test that we find a client with Symfony and Guzzle PSR-7
- expect: will-find
requirements: "symfony/http-client:^5 php-http/httplug php-http/message-factory guzzlehttp/psr7:^1 http-interop/http-factory-guzzle"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# We should fail if we dont have php-http/message-factory or PSR-17
- expect: cant-find
requirements: "symfony/http-client:^5 php-http/httplug php-http/message-factory guzzlehttp/psr7:^1"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
- expect: cant-find
requirements: "symfony/http-client:^5 php-http/httplug guzzlehttp/psr7:^1 http-interop/http-factory-guzzle"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# We should be able to find a client when Symfony is only partly installed and we have guzzle adapter installed
- expect: will-find
requirements: "symfony/http-client:^5 php-http/guzzle6-adapter php-http/httplug php-http/message-factory guzzlehttp/psr7:^1"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# Test that we find a client with Symfony and Guzzle
- expect: will-find
requirements: "php-http/client-common:^2 php-http/message:^1.8 symfony/http-client:^4 php-http/guzzle6-adapter"
method: "Http\\Discovery\\HttpClientDiscovery::find();"
# Test that we find an async client with Symfony and Guzzle
- expect: will-find
requirements: "php-http/client-common:^2 php-http/message:^1.8 symfony/http-client:^4 php-http/guzzle6-adapter"
method: "Http\\Discovery\\HttpAsyncClientDiscovery::find();"
# Test that we find PSR-18 Guzzle 6
- expect: will-find
requirements: "php-http/guzzle6-adapter:^2.0.1"
method: "Http\\Discovery\\Psr18ClientDiscovery::find();"
# Test that we find PSR-18 Guzzle 7
- expect: will-find
requirements: "guzzlehttp/guzzle:^7.0.1"
method: "Http\\Discovery\\Psr18ClientDiscovery::find();"
# Test that we find PSR-18 Symfony 4
- expect: will-find
requirements: "symfony/http-client:^4 php-http/httplug nyholm/psr7:^1.3"
method: "Http\\Discovery\\Psr18ClientDiscovery::find();"
# Test that we find PSR-18 Symfony 5
- expect: will-find
requirements: "symfony/http-client:^5 php-http/httplug nyholm/psr7:^1.3"
method: "Http\\Discovery\\Psr18ClientDiscovery::find();"
# Test that we find PSR-17 http-interop
- expect: will-find
requirements: "http-interop/http-factory-guzzle:^1"
method: "Http\\Discovery\\Psr17FactoryDiscovery::findRequestFactory();"
# Test that we find PSR-17 nyholm
- expect: will-find
requirements: "nyholm/psr7:^1.3"
method: "Http\\Discovery\\Psr17FactoryDiscovery::findRequestFactory();"
# Test that we find Phalcon with PSR
- expect: will-find
pecl: "psr-1.0.0, phalcon-4.0.6"
method: "Http\\Discovery\\Psr17FactoryDiscovery::findRequestFactory();"

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
tools: composer:v2
coverage: xdebug
extensions: ${{ matrix.pecl }}

- name: Check Install
run: |
tests/install.sh ${{ matrix.expect }} "${{ matrix.method }}" "${{ matrix.requirements }}"
21 changes: 21 additions & 0 deletions .github/workflows/static.yml
@@ -0,0 +1,21 @@
name: Static analysis

on:
push:
branches:
- master
pull_request:

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

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

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@
/phpunit.xml
/puli.json
/vendor/
.php-cs-fixer.cache
16 changes: 16 additions & 0 deletions .php-cs-fixer.php
@@ -0,0 +1,16 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->name('*.php')
;

$config = (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
;

return $config;
13 changes: 0 additions & 13 deletions .php_cs

This file was deleted.

8 changes: 0 additions & 8 deletions .scrutinizer.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .styleci.yml

This file was deleted.

0 comments on commit 6a53322

Please sign in to comment.