Skip to content

Commit 7651038

Browse files
authored
Chores (#379)
* format via php-cs-fixer * add unit tests with the lowest possible dependencies * add unit tests with php 8.2 and 8.3 * add integration tests for 2023.1 antelope and yoga * allow skipping integration, unit or both tests in pull requests --------- Co-authored-by: k0ka <k0ka@users.noreply.github.com>
1 parent 47c8ed9 commit 7651038

Some content is hidden

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

87 files changed

+229
-631
lines changed

.github/workflows/format.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Format"
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
7+
jobs:
8+
composer-normalize:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- uses: shivammathur/setup-php@v2
16+
with:
17+
coverage: none
18+
extensions: mbstring
19+
php-version: 8.2
20+
21+
- run: composer install --no-interaction --no-progress --no-suggest
22+
23+
- run: composer normalize
24+
25+
- uses: stefanzweifel/git-auto-commit-action@v4
26+
with:
27+
commit_message: Normalize composer.json
28+
29+
php-cs-fixer:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v3
33+
with:
34+
ref: ${{ github.head_ref }}
35+
36+
- uses: shivammathur/setup-php@v2
37+
with:
38+
coverage: none
39+
extensions: mbstring
40+
php-version: 8.1
41+
42+
- run: composer install --no-interaction --no-progress --no-suggest
43+
44+
- run: vendor/bin/php-cs-fixer fix
45+
46+
- run: git pull
47+
48+
- uses: stefanzweifel/git-auto-commit-action@v4
49+
with:
50+
commit_message: Apply php-cs-fixer changes

.github/workflows/integration_tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99

1010
jobs:
1111
tests:
12-
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
12+
if: |
13+
!contains(github.event.pull_request.body, 'skip ci')
14+
&& !contains(github.event.pull_request.body, 'skip integration')
1315
strategy:
1416
fail-fast: false
1517
matrix:
@@ -19,9 +21,15 @@ jobs:
1921
- name: "bobcat"
2022
openstack_version: "stable/2023.2"
2123
ubuntu_version: "22.04"
24+
- name: "antelope"
25+
openstack_version: "stable/2023.1"
26+
ubuntu_version: "22.04"
2227
- name: "zed"
2328
openstack_version: "stable/zed"
2429
ubuntu_version: "20.04"
30+
- name: "yoga"
31+
openstack_version: "stable/yoga"
32+
ubuntu_version: "20.04"
2533
- name: "wallaby"
2634
openstack_version: "stable/wallaby"
2735
ubuntu_version: "20.04"

.github/workflows/unit_tests.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,45 @@ on:
99
jobs:
1010
tests:
1111
runs-on: ubuntu-22.04
12-
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
12+
if: |
13+
!contains(github.event.pull_request.body, 'skip ci')
14+
&& !contains(github.event.pull_request.body, 'skip unit')
1315
strategy:
1416
fail-fast: false
1517
matrix:
16-
php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ]
17-
name: "php-${{ matrix.php }}"
18+
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 ]
19+
composer:
20+
- name: lowest
21+
arg: "--prefer-lowest --prefer-stable"
22+
- name: highest
23+
arg: "" # No args added as highest is default
24+
name: PHPUnit on PHP ${{ matrix.php }} with ${{ matrix.composer.name }} dependencies
1825
steps:
1926
- uses: actions/checkout@v2
27+
2028
- name: get cache directory
2129
id: composer-cache
2230
run: |
2331
echo "::set-output name=dir::$(composer config cache-files-dir)"
32+
2433
- uses: actions/cache@v2
2534
with:
2635
path: |
2736
~/.php_cs.cache
2837
${{ steps.composer-cache.outputs.dir }}
29-
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
38+
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ matrix.composer.name }}-${{ hashFiles('**.composer.lock') }}
39+
3040
- uses: shivammathur/setup-php@v2
3141
with:
3242
php-version: ${{ matrix.php }}
3343
extensions: curl
3444
tools: composer:v2
3545
coverage: none
36-
- run: composer install --prefer-dist --no-interaction --no-progress
46+
47+
- run: composer update --prefer-dist --no-interaction --no-progress ${{ matrix.composer.arg }}
48+
3749
- run: vendor/bin/parallel-lint --exclude vendor .
50+
3851
- name: execute unit tests
3952
run: vendor/bin/phpunit --configuration phpunit.xml.dist
4053

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
exit(0);
55
}
66

7-
return PhpCsFixer\Config::create()
7+
return (new PhpCsFixer\Config())
88
->setRules(
99
[
1010
'@PSR2' => true,

COVERAGE.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
# OpenStack versions coverage
2+
3+
While we strive to support all versions of OpenStack, we can only test limited number of versions. The current set:
4+
* 2023.2 Bobcat
5+
* 2023.1 Antelope
6+
* Zed
7+
* Yoga
8+
* Wallaby - as the latest version which had BlockStorage v2 API
9+
110
# OpenStack services coverage
211

312
| Name |PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
413
|--------------------|:--:|:--:|:--:|:--:|:--:|:--:|
514
| Block Storage v2 |&#10003;|&#10003;|&#10003;||&#10003;||
615
| Block Storage v3 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
716
| Compute v2 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
8-
| Compute v2 exts |||||||
9-
| Data Processing v1 |||||||
10-
| Database v1 |||||||
1117
| Identity v2 |&#10003;|&#10003;|&#10003;||||
12-
| Identity v2 exts |||||||
1318
| Identity v3 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
14-
| Identity v3 exts |||||||
1519
| Images v2 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
1620
| Networking v2 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
17-
| Networking v2 exts |||||||
1821
| Object Storage v1 |&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|&#10003;|
19-
| Orchestration v1 |||||||
20-
| Telemetry v2 |||||||
2122

2223
## Key
2324

@@ -55,3 +56,4 @@ In order for this to be marked complete, every public operation needs to be docu
5556
have all their keys defined. All types must be defined. Any required options must be marked.
5657
* a human-readable description
5758
* a code sample
59+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ OpenStack services, and versions of services, are supported.
1212
## Links
1313

1414
* [Official documentation](https://php-openstack-sdk.readthedocs.io/en/latest/)
15-
* [Reference documentation](http://refdocs.os.php-opencloud.com)
15+
* [Supported services](/COVERAGE.md)
1616
* [Contributing guide](/CONTRIBUTING.md)
1717
* [Code of Conduct](/CODE_OF_CONDUCT.md)
1818

composer.json

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,67 @@
11
{
22
"name": "php-opencloud/openstack",
33
"description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi",
4+
"license": "Apache-2.0",
45
"keywords": [
56
"php",
67
"openstack",
78
"api",
89
"sdk"
910
],
10-
"homepage": "https://github.com/php-opencloud/openstack",
11-
"license": "Apache-2.0",
1211
"authors": [
1312
{
1413
"name": "Jamie Hannaford",
1514
"email": "jamie.hannaford@rackspace.com",
16-
"homepage" : "https://github.com/jamiehannaford"
15+
"homepage": "https://github.com/jamiehannaford"
1716
},
1817
{
1918
"name": "Ha Phan",
2019
"email": "thanhha.work@gmail.com",
21-
"homepage" : "https://github.com/haphan"
20+
"homepage": "https://github.com/haphan"
21+
},
22+
{
23+
"name": "Konstantin Babushkin",
24+
"email": "koka@idwrx.com",
25+
"homepage": "https://github.com/k0ka"
2226
}
2327
],
28+
"homepage": "https://github.com/php-opencloud/openstack",
29+
"require": {
30+
"php": "^7.2.5 || ^8.0",
31+
"guzzlehttp/guzzle": "^7.0",
32+
"guzzlehttp/psr7": ">=1.7",
33+
"guzzlehttp/uri-template": "^0.2 || ^1.0",
34+
"justinrainbow/json-schema": "^5.2"
35+
},
36+
"require-dev": {
37+
"ergebnis/composer-normalize": "^2.0",
38+
"friendsofphp/php-cs-fixer": "^3",
39+
"php-coveralls/php-coveralls": "^2.0",
40+
"php-parallel-lint/php-parallel-lint": "^1.2",
41+
"phpspec/prophecy": "^1.17",
42+
"phpunit/phpunit": ">=8.5.23 <9.0",
43+
"psr/log": "^1.0"
44+
},
2445
"autoload": {
2546
"psr-4": {
2647
"OpenStack\\": "src/"
2748
}
2849
},
2950
"autoload-dev": {
3051
"psr-4": {
31-
"OpenStack\\Test\\": "tests/unit/",
32-
"OpenStack\\Integration\\": "tests/integration/"
52+
"OpenStack\\Integration\\": "tests/integration/",
53+
"OpenStack\\Test\\": "tests/unit/"
3354
}
3455
},
35-
"require": {
36-
"php": "^7.2.5|^8.0",
37-
"guzzlehttp/guzzle": "^7.0",
38-
"guzzlehttp/uri-template": "^0.2|^1.0",
39-
"justinrainbow/json-schema": "^5.2"
40-
},
41-
"require-dev": {
42-
"phpunit/phpunit": "^8.0",
43-
"psr/log": "^1.0",
44-
"php-coveralls/php-coveralls": "^2.0",
45-
"friendsofphp/php-cs-fixer": "^2.18",
46-
"php-parallel-lint/php-parallel-lint": "^1.2",
47-
"phpspec/prophecy": "^1.17"
56+
"config": {
57+
"allow-plugins": {
58+
"ergebnis/composer-normalize": true
59+
},
60+
"sort-packages": true
4861
},
4962
"extra": {
5063
"branch-alias": {
51-
"dev-master": "3.0-dev"
64+
"dev-master": "3.0-dev"
5265
}
5366
}
5467
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="./vendor/autoload.php" colors="true" strict="true">
2+
<phpunit bootstrap="./vendor/autoload.php" colors="true" beStrictAboutOutputDuringTests="true">
33
<logging>
44
<log type="coverage-clover" target="build/logs/clover.xml"/>
55
</logging>

src/BlockStorage/v2/Models/QuotaSet.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,18 @@ class QuotaSet extends OperatorResource implements Retrievable, Updateable, Dele
5858

5959
protected $resourceKey = 'quota_set';
6060

61-
/**
62-
* {@inheritdoc}
63-
*/
6461
public function retrieve()
6562
{
6663
$response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string) $this->tenantId]);
6764
$this->populateFromResponse($response);
6865
}
6966

70-
/**
71-
* {@inheritdoc}
72-
*/
7367
public function update()
7468
{
7569
$response = $this->executeWithState($this->api->putQuotaSet());
7670
$this->populateFromResponse($response);
7771
}
7872

79-
/**
80-
* {@inheritdoc}
81-
*/
8273
public function delete()
8374
{
8475
$response = $this->executeWithState($this->api->deleteQuotaSet());

src/BlockStorage/v2/Models/Snapshot.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class Snapshot extends OperatorResource implements Listable, Creatable, Updateab
5959
'os-extended-snapshot-attributes:project_id' => 'projectId',
6060
];
6161

62-
/**
63-
* {@inheritdoc}
64-
*/
6562
protected function getAliases(): array
6663
{
6764
return parent::getAliases() + [
@@ -84,8 +81,6 @@ public function retrieve()
8481
}
8582

8683
/**
87-
* {@inheritdoc}
88-
*
8984
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postSnapshots}
9085
*/
9186
public function create(array $userOptions): Creatable

0 commit comments

Comments
 (0)