Skip to content
Merged
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
189 changes: 40 additions & 149 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,185 +6,76 @@ on:
- "**"

jobs:
php84:
name: "php 8.4"
php-tests:
name: php ${{ matrix.php-version }}
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.4"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: composer install

- name: Run static analysis
run: composer stan
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.3', '8.4', '8.5']

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi

- name: Run tests
run: composer test

php83:
name: "php 8.3"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.3"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start mock server
run: docker run -d -p 1080:1080 mockserver/mockserver

- name: Install dependencies
run: composer install

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi

- name: Run tests
run: composer test

php82:
name: "php 8.2 psr/http-message 2.0"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.2"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
extensions: mbstring, intl, curl

- name: Install dependencies
run: composer update --no-interaction --with psr/http-message:^2.0
run: composer install --no-interaction

- name: Check code style
- name: Check code style (PHP 8.5)
if: matrix.php-version == '8.5'
run: composer cs-check

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://localhost:1080/mockserver/openapi

- name: Run tests
run: composer test

php82psrmessage10:
name: "php 8.2 psr/http-message 1.0"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.2"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies
run: composer update --no-interaction --with psr/http-message:^1.0

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi

- name: Run tests
run: composer test

php81:
name: "php 8.1"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.1"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies
run: composer install --no-interaction

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi

- name: Run tests
run: composer test

php80:
name: "php 8.0"
php-with-psr-tests:
name: php ${{ matrix.php-version }} psr/http-message ${{ matrix.psr-http-message-version }}
runs-on: ubuntu-latest
container: "nofutur3/php-tests:8.0"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
- name: Checkout repository
uses: actions/checkout@v3
strategy:
fail-fast: false
matrix:
php-version: ['8.2']
psr-http-message-version: ['1.0', '2.0']

- name: Install dependencies
run: composer install --no-interaction

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi

- name: Run tests
run: composer test

php74:
name: "php 7.4"
runs-on: ubuntu-latest
container: "nofutur3/php-tests:7.4"
services:
openAPImock:
image: mockserver/mockserver
ports:
- 1080:1080
steps:
# Deprecation example for future support removal.
#
#- name: Deprecation check (2023-01-01T00:00:00+01:00)
# run: if [ "$(date +%s)" -gt "1672527600" ]; then echo "This PHP version support ended"; exit1; else echo "Deprecation OK"; fi
- name: Start mock server
run: docker run -d -p 1080:1080 mockserver/mockserver

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
extensions: mbstring, intl, curl

- name: Install dependencies
run: composer install --no-interaction
run: composer update --no-interaction --with psr/http-message:^${{ matrix.psr-http-message-version }}

- name: Run static analysis
run: composer stan

- name: Create mock server from our production OpenAPI
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://openAPImock:1080/mockserver/openapi
run: curl -X PUT -d "{\"specUrlOrPayload\":\"https://gate.thepay.cz/openapi.yaml\"}" http://localhost:1080/mockserver/openapi

- name: Run tests
run: composer test
Expand All @@ -195,7 +86,7 @@ jobs:
container: "node"
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Install dependencies
run: npm install
Expand Down
5 changes: 1 addition & 4 deletions tests/Mocks/TheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct()
*/
public function getApiUrl(?string $specificVersion = null): string
{
if ($specificVersion !== null) {
return 'http://openAPImock:1080/' . $specificVersion . '/';
}
return 'http://openAPImock:1080/' . $this->getApiVersion() . '/';
return 'http://localhost:1080/' . ($specificVersion ?? $this->getApiVersion()) . '/';
}
}