Skip to content

Commit de17925

Browse files
authored
Merge pull request #62 from php-http/fix-setup
move from defunct travis to github workflow
2 parents ec9d873 + c28dd3d commit de17925

File tree

12 files changed

+229
-64
lines changed

12 files changed

+229
-64
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ $foo->doSomething();
4141
#### To Do
4242

4343
- [ ] If the PR is not complete but you want to discuss the approach, list what remains to be done here
44+
45+
#### Note
46+
47+
The CI runs the integration tests with all implementations. It is normal that not all tests succeed. When adding test cases, please check the output if the new test fails and if so report it to the affected implementations.

.github/workflows/.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*.yml]
2+
indent_size = 2

.github/workflows/guzzle.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Guzzle
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
latest:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
15+
uses: ./.github/workflows/integration.yml
16+
with:
17+
php: ${{ matrix.php }}
18+
suite: Guzzle
19+
package: guzzlehttp/psr7
20+
21+
# - Laminas
22+
# - Slim
23+
# - Nyholm
24+
# - RingCentral

.github/workflows/integration.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
php:
5+
required: true
6+
type: string
7+
suite:
8+
required: true
9+
type: string
10+
package:
11+
required: true
12+
type: string
13+
14+
jobs:
15+
latest:
16+
name: ${{ inputs.suite }} PHP ${{ inputs.php }}
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ inputs.php }}
27+
tools: composer
28+
coverage: none
29+
30+
- name: Install dependencies
31+
# we need to remove all dev dependencies to avoid failures due to php version constraints
32+
# then we install the dependencies
33+
# and finally require the implementation to test with source flag (to get integration test cases that might be excluded in git-attributes)
34+
run: |
35+
composer remove --dev guzzlehttp/psr7 laminas/laminas-diactoros nyholm/psr7 ringcentral/psr7 slim/psr7 --no-update
36+
composer update --no-interaction --no-progress
37+
composer require ${{ inputs.package }} --no-interaction --no-progress --prefer-source
38+
39+
- name: Execute tests
40+
run: composer test -- --testsuite ${{ inputs.suite }}

.github/workflows/laminas.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Laminas
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
latest:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
15+
uses: ./.github/workflows/integration.yml
16+
with:
17+
php: ${{ matrix.php }}
18+
suite: Laminas
19+
package: laminas/laminas-diactoros

.github/workflows/nyholm.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Nyholm
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
latest:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
15+
uses: ./.github/workflows/integration.yml
16+
with:
17+
php: ${{ matrix.php }}
18+
suite: Nyholm
19+
package: nyholm/psr7

.github/workflows/ringcentral.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: RingCentral
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
latest:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
15+
uses: ./.github/workflows/integration.yml
16+
with:
17+
php: ${{ matrix.php }}
18+
suite: RingCentral
19+
package: ringcentral/psr7

.github/workflows/slim.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Slim
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
latest:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '8.0', '8.1', '8.2' ]
15+
uses: ./.github/workflows/integration.yml
16+
with:
17+
php: ${{ matrix.php }}
18+
suite: Slim
19+
package: slim/psr7

.travis.yml

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

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88

99
| PSR7 Implementation | Status |
1010
| ------------------- |:-------------:|
11-
| Guzzle | [![Guzzle](https://travis-matrix-badges.herokuapp.com/repos/php-http/psr7-integration-tests/branches/master/1)](https://travis-ci.org/php-http/psr7-integration-tests) |
12-
| Laminas | [![Laminas](https://travis-matrix-badges.herokuapp.com/repos/php-http/psr7-integration-tests/branches/master/2)](https://travis-ci.org/php-http/psr7-integration-tests) |
13-
| Slim | [![Slim](https://travis-matrix-badges.herokuapp.com/repos/php-http/psr7-integration-tests/branches/master/3)](https://travis-ci.org/php-http/psr7-integration-tests) |
14-
| Nyholm | [![Nyholm](https://travis-matrix-badges.herokuapp.com/repos/php-http/psr7-integration-tests/branches/master/4)](https://travis-ci.org/php-http/psr7-integration-tests) |
15-
| RingCentral | [![RingCentral](https://travis-matrix-badges.herokuapp.com/repos/php-http/psr7-integration-tests/branches/master/5)](https://travis-ci.org/php-http/psr7-integration-tests) |
11+
| Guzzle | [![Guzzle](https://github.com/php-http/psr7-integration-tests/actions/workflows/guzzle.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/guzzle.yml) |
12+
| Laminas | [![Laminas](https://github.com/php-http/psr7-integration-tests/actions/workflows/laminas.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/laminas.yml) |
13+
| Slim | [![Slim](https://github.com/php-http/psr7-integration-tests/actions/workflows/slim.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/slim.yml) |
14+
| Nyholm | [![Nyholm](https://github.com/php-http/psr7-integration-tests/actions/workflows/nyholm.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/nyholm.yml) |
15+
| RingCentral | [![RingCentral](https://github.com/php-http/psr7-integration-tests/actions/workflows/ringcentral.yml/badge.svg)](https://github.com/php-http/psr7-integration-tests/actions/workflows/ringcentral.yml) |
16+
1617

1718
## Install
1819

19-
Via Composer
20+
To use the integration tests with a PSR-7 implementation, add this package to the dev dependencies:
2021

2122
``` bash
2223
$ composer require --dev php-http/psr7-integration-tests
2324
```
2425

26+
Then set up phpunit to run the tests for your implementation.
2527

2628
## Documentation
2729

@@ -30,14 +32,26 @@ Please see the [official documentation](http://docs.php-http.org/en/latest).
3032

3133
## Testing
3234

35+
This repository also is set up to test a couple of implementations directly. You need to install dependencies from source for the tests to work:
36+
37+
``` bash
38+
$ composer update --prefer-source
39+
```
40+
41+
**Note:** If you already have the sources installed, you need to delete the vendor folder before running the above command.
42+
43+
Run the test suite for one implementation with:
44+
3345
``` bash
34-
$ composer test
46+
$ composer test -- --testsuite <name>
3547
```
3648

49+
The names are `Guzzle`, `Laminas`, `Slim`, `Nyholm`, `RingCentral`.
50+
3751
It is also possible to exclude tests that require a live internet connection:
3852

3953
``` bash
40-
$ composer test -- --exclude-group internet
54+
$ composer test -- --testsuite <name> --exclude-group internet
4155
```
4256

4357
## Contributing

0 commit comments

Comments
 (0)