Skip to content

Commit 85cce0f

Browse files
author
Sean O'Brien
committed
chore: add 8.5 to workflows
1 parent bcc08c5 commit 85cce0f

Some content is hidden

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

45 files changed

+442
-297
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 }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: PHP Composer 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: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ jobs:
5050
composer-options: '--prefer-lowest'
5151
- php-versions: '8.4'
5252
composer-options: ''
53+
- php-versions: '8.4'
54+
composer-options: '--prefer-lowest'
55+
- php-versions: '8.5'
56+
composer-options: ''
5357
# set the name for each job
5458
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }}
5559
# set up environment variables used by unit tests
@@ -60,12 +64,12 @@ jobs:
6064
AWS_SUPPRESS_PHP_DEPRECATION_WARNING: true
6165
steps:
6266
# sets up the correct version of PHP with necessary config options
63-
- name: Setup PHP with Xdebug
67+
- name: Setup PHP with JIT
6468
uses: shivammathur/setup-php@v2
6569
with:
66-
coverage: xdebug
70+
coverage: none
6771
php-version: ${{ matrix.php-versions }}
68-
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
72+
ini-values: memory_limit=4G, phar.readonly=false, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M
6973

7074
# checkout the codebase from github
7175
- name: Checkout codebase
@@ -81,19 +85,14 @@ jobs:
8185
- name: Install dependencies
8286
run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source
8387

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
87-
8888
# run tests
8989
- name: Run test suite
9090
run: make test
9191

9292
# static analysis
9393
- name: Static analysis
9494
run: |
95-
composer require --dev nette/neon "^3.4.4"
96-
composer require --dev phpstan/phpstan "2.1.1"
95+
composer require --dev nette/neon "^3.4.4" phpstan/phpstan "2.1.1" --ignore-platform-req=php --update-with-all-dependencies
9796
vendor/bin/phpstan analyse src
9897
9998
# generate package
@@ -103,8 +102,3 @@ jobs:
103102
composer config platform.php 8.1
104103
composer update
105104
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.5",
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/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/RetryMiddleware.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ private static function isRetryable(
177177
) {
178178
if (method_exists($previous, 'getHandlerContext')) {
179179
$context = $previous->getHandlerContext();
180-
return !empty($context['errno'])
180+
return !empty($context)
181+
&& !empty($context['errno'])
181182
&& isset($retryCurlErrors[$context['errno']]);
182183
}
183184

src/RetryMiddlewareV2.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ private static function isRetryable(
322322
) {
323323
if (method_exists($previous, 'getHandlerContext')) {
324324
$context = $previous->getHandlerContext();
325-
return !empty($context['errno'])
325+
return !empty($context)
326+
&& !empty($context['errno'])
326327
&& isset($retryCurlErrors[$context['errno']]);
327328
}
328329

src/UserAgentMiddleware.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ private function getOsName(): string
172172
if (function_exists('php_uname')
173173
&& !in_array('php_uname', $disabledFunctions, true)
174174
) {
175-
$osName = "OS/" . php_uname('s') . '#' . php_uname('r');
175+
// Replace spaces with underscores to prevent breaking the user agent format
176+
$os = str_replace(' ', '_', php_uname('s'));
177+
$release = php_uname('r');
178+
$osName = "OS/{$os}#{$release}";
179+
176180
if (!empty($osName)) {
177181
return $osName;
178182
}

tests/AbstractConfigurationProviderTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function testGetsHomeDirectoryForWindowsUsers()
2929
putenv('HOMEPATH=\\My\\Home');
3030
$ref = new \ReflectionClass('\Aws\AbstractConfigurationProvider');
3131
$meth = $ref->getMethod('getHomeDir');
32-
$meth->setAccessible(true);
3332
$this->assertSame('C:\\My\\Home', $meth->invoke(null));
3433
}
3534

@@ -79,7 +78,6 @@ public function testsPersistsToCache()
7978
// Set interfaceClass property that's normally set by child class
8079
$ref = new \ReflectionClass('\Aws\AbstractConfigurationProvider');
8180
$property = $ref->getProperty('interfaceClass');
82-
$property->setAccessible(true);
8381
$property->setValue(null,'\Aws\ResultInterface');
8482

8583
$timesCalled = 0;

tests/Api/Parser/EventParsingIteratorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public function testParsedEventsMatchExpectedType($iterator)
122122
{
123123
$reflectedIteratorClass = new \ReflectionClass(get_class($iterator));
124124
$shapeProperty = $reflectedIteratorClass->getProperty('shape');
125-
$shapeProperty->setAccessible(true);
126125
$shape = $shapeProperty->getValue($iterator);
127126
foreach ($iterator as $event) {
128127
$this->parsedEventMatchesExpectedType($shape, $event);

0 commit comments

Comments
 (0)