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
50 changes: 50 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Format"
on:
push:
branches:
- '*'

jobs:
composer-normalize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 8.2

- run: composer install --no-interaction --no-progress --no-suggest

- run: composer normalize

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Normalize composer.json

php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- uses: shivammathur/setup-php@v2
with:
coverage: none
extensions: mbstring
php-version: 8.1

- run: composer install --no-interaction --no-progress --no-suggest

- run: vendor/bin/php-cs-fixer fix

- run: git pull

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply php-cs-fixer changes
10 changes: 9 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:

jobs:
tests:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
if: |
!contains(github.event.pull_request.body, 'skip ci')
&& !contains(github.event.pull_request.body, 'skip integration')
strategy:
fail-fast: false
matrix:
Expand All @@ -19,9 +21,15 @@ jobs:
- name: "bobcat"
openstack_version: "stable/2023.2"
ubuntu_version: "22.04"
- name: "antelope"
openstack_version: "stable/2023.1"
ubuntu_version: "22.04"
- name: "zed"
openstack_version: "stable/zed"
ubuntu_version: "20.04"
- name: "yoga"
openstack_version: "stable/yoga"
ubuntu_version: "20.04"
- name: "wallaby"
openstack_version: "stable/wallaby"
ubuntu_version: "20.04"
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,45 @@ on:
jobs:
tests:
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
if: |
!contains(github.event.pull_request.body, 'skip ci')
&& !contains(github.event.pull_request.body, 'skip unit')
strategy:
fail-fast: false
matrix:
php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ]
name: "php-${{ matrix.php }}"
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 ]
composer:
- name: lowest
arg: "--prefer-lowest --prefer-stable"
- name: highest
arg: "" # No args added as highest is default
name: PHPUnit on PHP ${{ matrix.php }} with ${{ matrix.composer.name }} dependencies
steps:
- uses: actions/checkout@v2

- name: get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ matrix.composer.name }}-${{ hashFiles('**.composer.lock') }}

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl
tools: composer:v2
coverage: none
- run: composer install --prefer-dist --no-interaction --no-progress

- run: composer update --prefer-dist --no-interaction --no-progress ${{ matrix.composer.arg }}

- run: vendor/bin/parallel-lint --exclude vendor .

- name: execute unit tests
run: vendor/bin/phpunit --configuration phpunit.xml.dist

2 changes: 1 addition & 1 deletion .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
exit(0);
}

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules(
[
'@PSR2' => true,
Expand Down
18 changes: 10 additions & 8 deletions COVERAGE.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# OpenStack versions coverage

While we strive to support all versions of OpenStack, we can only test limited number of versions. The current set:
* 2023.2 Bobcat
* 2023.1 Antelope
* Zed
* Yoga
* Wallaby - as the latest version which had BlockStorage v2 API

# OpenStack services coverage

| Name |PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
|--------------------|:--:|:--:|:--:|:--:|:--:|:--:|
| Block Storage v2 |✓|✓|✓||✓||
| Block Storage v3 |✓|✓|✓|✓|✓|✓|
| Compute v2 |✓|✓|✓|✓|✓|✓|
| Compute v2 exts |||||||
| Data Processing v1 |||||||
| Database v1 |||||||
| Identity v2 |✓|✓|✓||||
| Identity v2 exts |||||||
| Identity v3 |✓|✓|✓|✓|✓|✓|
| Identity v3 exts |||||||
| Images v2 |✓|✓|✓|✓|✓|✓|
| Networking v2 |✓|✓|✓|✓|✓|✓|
| Networking v2 exts |||||||
| Object Storage v1 |✓|✓|✓|✓|✓|✓|
| Orchestration v1 |||||||
| Telemetry v2 |||||||

## Key

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OpenStack services, and versions of services, are supported.
## Links

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

Expand Down
53 changes: 33 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,67 @@
{
"name": "php-opencloud/openstack",
"description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi",
"license": "Apache-2.0",
"keywords": [
"php",
"openstack",
"api",
"sdk"
],
"homepage": "https://github.com/php-opencloud/openstack",
"license": "Apache-2.0",
"authors": [
{
"name": "Jamie Hannaford",
"email": "jamie.hannaford@rackspace.com",
"homepage" : "https://github.com/jamiehannaford"
"homepage": "https://github.com/jamiehannaford"
},
{
"name": "Ha Phan",
"email": "thanhha.work@gmail.com",
"homepage" : "https://github.com/haphan"
"homepage": "https://github.com/haphan"
},
{
"name": "Konstantin Babushkin",
"email": "koka@idwrx.com",
"homepage": "https://github.com/k0ka"
}
],
"homepage": "https://github.com/php-opencloud/openstack",
"require": {
"php": "^7.2.5 || ^8.0",
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/psr7": ">=1.7",
"guzzlehttp/uri-template": "^0.2 || ^1.0",
"justinrainbow/json-schema": "^5.2"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.0",
"friendsofphp/php-cs-fixer": "^3",
"php-coveralls/php-coveralls": "^2.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpspec/prophecy": "^1.17",
"phpunit/phpunit": ">=8.5.23 <9.0",
"psr/log": "^1.0"
},
"autoload": {
"psr-4": {
"OpenStack\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"OpenStack\\Test\\": "tests/unit/",
"OpenStack\\Integration\\": "tests/integration/"
"OpenStack\\Integration\\": "tests/integration/",
"OpenStack\\Test\\": "tests/unit/"
}
},
"require": {
"php": "^7.2.5|^8.0",
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/uri-template": "^0.2|^1.0",
"justinrainbow/json-schema": "^5.2"
},
"require-dev": {
"phpunit/phpunit": "^8.0",
"psr/log": "^1.0",
"php-coveralls/php-coveralls": "^2.0",
"friendsofphp/php-cs-fixer": "^2.18",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpspec/prophecy": "^1.17"
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php" colors="true" strict="true">
<phpunit bootstrap="./vendor/autoload.php" colors="true" beStrictAboutOutputDuringTests="true">
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
Expand Down
9 changes: 0 additions & 9 deletions src/BlockStorage/v2/Models/QuotaSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,18 @@ class QuotaSet extends OperatorResource implements Retrievable, Updateable, Dele

protected $resourceKey = 'quota_set';

/**
* {@inheritdoc}
*/
public function retrieve()
{
$response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string) $this->tenantId]);
$this->populateFromResponse($response);
}

/**
* {@inheritdoc}
*/
public function update()
{
$response = $this->executeWithState($this->api->putQuotaSet());
$this->populateFromResponse($response);
}

/**
* {@inheritdoc}
*/
public function delete()
{
$response = $this->executeWithState($this->api->deleteQuotaSet());
Expand Down
5 changes: 0 additions & 5 deletions src/BlockStorage/v2/Models/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class Snapshot extends OperatorResource implements Listable, Creatable, Updateab
'os-extended-snapshot-attributes:project_id' => 'projectId',
];

/**
* {@inheritdoc}
*/
protected function getAliases(): array
{
return parent::getAliases() + [
Expand All @@ -84,8 +81,6 @@ public function retrieve()
}

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postSnapshots}
*/
public function create(array $userOptions): Creatable
Expand Down
11 changes: 0 additions & 11 deletions src/BlockStorage/v2/Models/Volume.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ class Volume extends OperatorResource implements Creatable, Listable, Updateable
'volume_image_metadata' => 'volumeImageMetadata',
];

/**
* {@inheritdoc}
*/
protected function getAliases(): array
{
return parent::getAliases() + [
Expand All @@ -110,8 +107,6 @@ public function retrieve()
}

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postVolumes}
*/
public function create(array $userOptions): Creatable
Expand Down Expand Up @@ -179,12 +174,6 @@ public function setImageMetadata(array $metadata)
/**
* Administrator only. Resets the status, attach status, and migration status for a volume. Specify the os-reset_status action in the request body.
*
* @param array $options
*
* $options['status'] = (string) The volume status.
* $options['migrationStatus'] = (string) The volume migration status.
* $options['attachStatus'] = (string) The volume attach status. [OPTIONAL]
*
* @see https://developer.openstack.org/api-ref/block-storage/v2/index.html#volume-actions-volumes-action
*/
public function resetStatus(array $options)
Expand Down
2 changes: 0 additions & 2 deletions src/BlockStorage/v2/Models/VolumeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class VolumeType extends OperatorResource implements Listable, Creatable, Update
protected $resourcesKey = 'volume_types';

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postTypes}
*/
public function create(array $userOptions): Creatable
Expand Down
3 changes: 2 additions & 1 deletion src/BlockStorage/v2/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use OpenStack\Common\Service\AbstractService;

/**
* @property \OpenStack\BlockStorage\v2\Api $api
* @property Api $api
*/
class Service extends AbstractService
{
Expand All @@ -31,6 +31,7 @@ public function createVolume(array $userOptions): Volume
*
* @param bool $detail if set to TRUE, more information will be returned
* @param array $userOptions {@see Api::getVolumes}
*
* @return \Generator<mixed, \OpenStack\BlockStorage\v2\Models\Volume>
*/
public function listVolumes(bool $detail = false, array $userOptions = []): \Generator
Expand Down
3 changes: 1 addition & 2 deletions src/BlockStorage/v3/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class Api extends \OpenStack\BlockStorage\v2\Api
{

}
}
Loading