Skip to content

Commit 223d73d

Browse files
author
Sean O'Brien
committed
chore: add 8.5 to workflows
1 parent f8b5f12 commit 223d73d

File tree

54 files changed

+567
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+567
-370
lines changed

.github/workflows/coverage.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches: [master]
6+
schedule:
7+
- cron: '0 0 * * 0'
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
coverage:
15+
runs-on: ubuntu-latest
16+
name: Code Coverage
17+
env:
18+
AWS_ACCESS_KEY_ID: foo
19+
AWS_SECRET_ACCESS_KEY: bar
20+
AWS_CSM_ENABLED: false
21+
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
22+
steps:
23+
- name: Setup PHP with Xdebug
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
coverage: xdebug
27+
php-version: '8.3'
28+
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
29+
30+
- name: Checkout codebase
31+
uses: actions/checkout@v5
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Validate composer.json and composer.lock
36+
run: composer validate
37+
38+
- name: Install dependencies
39+
run: composer install --no-interaction --prefer-source
40+
41+
- name: Run test suite with coverage
42+
run: vendor/bin/phpunit --testsuite=unit --coverage-clover=clover.xml
43+
44+
- name: Upload coverage to Codecov
45+
uses: codecov/codecov-action@v4
46+
with:
47+
file: ./clover.xml
48+
fail_ci_if_error: false
49+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/docs-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build API documentation
1+
name: Build API Documentation
22
permissions:
33
contents: read
44
on:
@@ -14,12 +14,12 @@ jobs:
1414
php-versions: ['8.1']
1515
name: Build API documentation for PHP ${{ matrix.php-versions }}
1616
steps:
17-
- name: Setup PHP with Xdebug
17+
- name: Setup PHP with JIT
1818
uses: shivammathur/setup-php@v2
1919
with:
20-
coverage: xdebug
20+
coverage: none
2121
php-version: ${{ matrix.php-versions }}
22-
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
22+
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
2323

2424
- name: Checkout CodeBase
2525
uses: actions/checkout@v6
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Model Change Scan
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
verify-no-models-changes:
12+
runs-on: ubuntu-latest
13+
name: Check for model changes
14+
steps:
15+
- name: Checkout codebase
16+
uses: actions/checkout@v5
17+
with:
18+
fetch-depth: 0
19+
- run: |
20+
BASE_REPO="${{ github.event.pull_request.base.repo.clone_url }}"
21+
git fetch $BASE_REPO master:master -q
22+
CHANGED_FILES=$(git diff --name-only FETCH_HEAD...HEAD -- src/data/)
23+
if [ ! -z "$CHANGED_FILES" ]; then
24+
echo "Changes detected in the following models:"
25+
echo "$CHANGED_FILES"
26+
exit 1
27+
fi
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Unit Tests (Windows)
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
run:
14+
runs-on: windows-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- php-versions: '8.1'
19+
composer-options: ''
20+
- php-versions: '8.2'
21+
composer-options: ''
22+
- php-versions: '8.3'
23+
composer-options: ''
24+
- php-versions: '8.4'
25+
composer-options: ''
26+
- php-versions: '8.5'
27+
composer-options: ''
28+
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }}
29+
env:
30+
AWS_ACCESS_KEY_ID: foo
31+
AWS_SECRET_ACCESS_KEY: bar
32+
AWS_CSM_ENABLED: false
33+
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
34+
steps:
35+
- name: Setup PHP with JIT
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
coverage: none
39+
php-version: ${{ matrix.php-versions }}
40+
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
41+
extensions: sockets
42+
43+
- name: Checkout codebase
44+
uses: actions/checkout@v5
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Validate composer.json and composer.lock
49+
run: composer validate
50+
51+
- name: Install dependencies
52+
run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source
53+
54+
- name: Run test suite
55+
run: make test
56+
57+
- name: Static analysis
58+
run: |
59+
composer require --dev nette/neon "^3.4.4" phpstan/phpstan "2.1.1" --ignore-platform-req=php --update-with-all-dependencies
60+
vendor\bin\phpstan analyse src

.github/workflows/tests.yml

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: Unit Tests (Linux)
22

33
# whenever master has a PR or is pushed to
44
on:
@@ -11,25 +11,6 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
verify-no-models-changes:
15-
runs-on: ubuntu-latest
16-
name: Check for model changes
17-
if: github.event_name == 'pull_request'
18-
steps:
19-
- name: Checkout codebase
20-
uses: actions/checkout@v6
21-
with:
22-
fetch-depth: 0
23-
- run: |
24-
BASE_REPO="${{ github.event.pull_request.base.repo.clone_url }}"
25-
git fetch $BASE_REPO master:master -q
26-
CHANGED_FILES=$(git diff --name-only FETCH_HEAD...HEAD -- src/data/)
27-
if [ ! -z "$CHANGED_FILES" ]; then
28-
echo "Changes detected in the following models:"
29-
echo "$CHANGED_FILES"
30-
exit 1
31-
fi
32-
3314
run:
3415
runs-on: ubuntu-latest
3516
strategy:
@@ -50,6 +31,10 @@ jobs:
5031
composer-options: '--prefer-lowest'
5132
- php-versions: '8.4'
5233
composer-options: ''
34+
- php-versions: '8.4'
35+
composer-options: '--prefer-lowest'
36+
- php-versions: '8.5'
37+
composer-options: ''
5338
# set the name for each job
5439
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }}
5540
# set up environment variables used by unit tests
@@ -60,12 +45,12 @@ jobs:
6045
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
6146
steps:
6247
# sets up the correct version of PHP with necessary config options
63-
- name: Setup PHP with Xdebug
48+
- name: Setup PHP with JIT
6449
uses: shivammathur/setup-php@v2
6550
with:
66-
coverage: xdebug
51+
coverage: none
6752
php-version: ${{ matrix.php-versions }}
68-
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
53+
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
6954

7055
# checkout the codebase from github
7156
- name: Checkout codebase
@@ -79,11 +64,18 @@ jobs:
7964

8065
# get dependencies
8166
- name: Install dependencies
82-
run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source
83-
84-
# php 8.1+ requirements
85-
- name: PHP 8.1+ requirements
86-
run: composer require --dev phpunit/phpunit "^9.5" guzzlehttp/guzzle "^7.4.5" --no-interaction --prefer-source --with-all-dependencies
67+
run: |
68+
if [[ "${{ matrix.composer-options }}" == "--prefer-lowest" ]]; then
69+
# PHP 8.3+ needs PSR HTTP Message 2.0+ and compatible Guzzle packages
70+
if [[ "${{ matrix.php-versions }}" == "8.3" ]] || [[ "${{ matrix.php-versions }}" == "8.4" ]]; then
71+
composer update ${{ matrix.composer-options }} --no-interaction --prefer-source --with-all-dependencies
72+
composer update psr/http-message guzzlehttp/psr7 guzzlehttp/guzzle --with-all-dependencies --no-interaction
73+
else
74+
composer update ${{ matrix.composer-options }} --no-interaction --prefer-source --with-all-dependencies
75+
fi
76+
else
77+
composer update ${{ matrix.composer-options }} --no-interaction --prefer-source
78+
fi
8779
8880
# run tests
8981
- name: Run test suite
@@ -92,8 +84,7 @@ jobs:
9284
# static analysis
9385
- name: Static analysis
9486
run: |
95-
composer require --dev nette/neon "^3.4.4"
96-
composer require --dev phpstan/phpstan "2.1.1"
87+
composer require --dev nette/neon "^3.4.4" phpstan/phpstan "2.1.1" --ignore-platform-req=php --update-with-all-dependencies
9788
vendor/bin/phpstan analyse src
9889
9990
# generate package
@@ -103,8 +94,3 @@ jobs:
10394
composer config platform.php 8.1
10495
composer update
10596
make package
106-
107-
# generate code coverage
108-
- if: ${{ matrix.composer-options == '' }}
109-
name: Code Coverage
110-
run: bash <(curl -s https://codecov.io/bash)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,30 @@
2525
"ext-json": "*",
2626
"ext-simplexml": "*",
2727
"aws/aws-crt-php": "^1.2.3",
28-
"psr/http-message": "^1.0 || ^2.0"
28+
"psr/http-message": "^1.0 || ^2.0",
29+
"symfony/filesystem": "^v6.4.3 || ^v7.1.0"
2930
},
3031
"require-dev": {
3132
"composer/composer" : "^2.7.8",
3233
"ext-openssl": "*",
3334
"ext-dom": "*",
34-
"ext-pcntl": "*",
3535
"ext-sockets": "*",
36-
"phpunit/phpunit": "^5.6.3 || ^8.5 || ^9.5",
36+
"phpunit/phpunit": "^9.6",
3737
"behat/behat": "~3.0",
3838
"doctrine/cache": "~1.4",
3939
"aws/aws-php-sns-message-validator": "~1.0",
4040
"andrewsville/php-token-reflection": "^1.4",
4141
"psr/cache": "^2.0 || ^3.0",
4242
"psr/simple-cache": "^2.0 || ^3.0",
4343
"sebastian/comparator": "^1.2.3 || ^4.0 || ^5.0",
44-
"symfony/filesystem": "^v6.4.0 || ^v7.1.0",
4544
"yoast/phpunit-polyfills": "^2.0",
4645
"dms/phpunit-arraysubset-asserts": "^0.4.0"
4746
},
4847
"suggest": {
4948
"ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
5049
"ext-curl": "To send requests using cURL",
5150
"ext-sockets": "To use client-side monitoring",
51+
"ext-pcntl": "To use client-side monitoring",
5252
"doctrine/cache": "To use the DoctrineCacheAdapter",
5353
"aws/aws-php-sns-message-validator": "To validate incoming SNS notifications"
5454
},

src/Api/Serializer/RestSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function applyPayload(StructureShape $input, $name, array $args, array &
146146
// This path skips setting the content-type header usually done in
147147
// RestJsonSerializer and RestXmlSerializer.certain S3 and glacier
148148
// operations determine content type in Middleware::ContentType()
149-
if (!isset(self::$excludeContentType[$this->api->getServiceName()])) {
149+
if (!isset(self::$excludeContentType[$this->api->getServiceName() ?? ''])) {
150150
switch ($type) {
151151
case 'string':
152152
$opts['headers']['Content-Type'] = 'text/plain';

src/AwsClient.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,12 @@ private function loadAliases($file = null)
568568
$aliases = \Aws\load_compiled_json($file);
569569
$serviceId = $this->api->getServiceId();
570570
$version = $this->getApi()->getApiVersion();
571-
if (!empty($aliases['operations'][$serviceId][$version])) {
572-
$this->aliases = array_flip($aliases['operations'][$serviceId][$version]);
571+
// Avoid nested array access on potentially null value
572+
$serviceAliases = isset($aliases['operations'][$serviceId ?? ''])
573+
? $aliases['operations'][$serviceId]
574+
: null;
575+
if ($serviceAliases && isset($serviceAliases[$version])) {
576+
$this->aliases = array_flip($serviceAliases[$version]);
573577
}
574578
}
575579
}

src/Configuration/ConfigurationResolver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,11 @@ private static function retrieveValueFromIniSubsection(
238238
"services {$data[$profile]['services']}"
239239
);
240240

241-
if (!isset($services_section[$options['subsection']][$options['key']])
242-
) {
241+
if (empty($options['subsection']) || empty($options['key'])) {
242+
return null;
243+
}
244+
245+
if (!isset($services_section[$options['subsection']][$options['key']])) {
243246
return null;
244247
}
245248

src/EndpointDiscovery/EndpointDiscoveryMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ private function handleInvalidEndpoint(
322322

323323
// If no more cached endpoints, make discovery call
324324
// if none made within cooldown for given key
325-
if (time() - $this->discoveryTimes[$cacheKey]
326-
< self::$discoveryCooldown
325+
if (isset($this->discoveryTimes[$cacheKey])
326+
&& time() - $this->discoveryTimes[$cacheKey] < self::$discoveryCooldown
327327
) {
328328

329329
// If no more cached endpoints and it's required,

0 commit comments

Comments
 (0)