Skip to content

Commit

Permalink
- add more unit tests and integration tests
Browse files Browse the repository at this point in the history
- add format.yml
  • Loading branch information
k0ka committed Jan 5, 2024
1 parent 47c8ed9 commit 4c4bd22
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 6 deletions.
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.2

- 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
8 changes: 7 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
tests:
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip integration')"
strategy:
fail-fast: false
matrix:
Expand All @@ -19,9 +19,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
19 changes: 15 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,43 @@ 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.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip unit')"
strategy:
fail-fast: false
matrix:
php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ]
name: "php-${{ matrix.php }}"
composer:
- name: lowest
arg: "--prefer-lowest --prefer-stable"
- name: highest
arg: "" # No args added as highest is default
name: "php-${{ matrix.php }}-composer-${{ matrix.composer.name }}"
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 install --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

7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"name": "Ha Phan",
"email": "[email protected]",
"homepage" : "https://github.com/haphan"
},
{
"name": "Konstantin Babushkin",
"email": "[email protected]",
"homepage" : "https://github.com/k0ka"
}
],
"autoload": {
Expand All @@ -42,7 +47,7 @@
"phpunit/phpunit": "^8.0",
"psr/log": "^1.0",
"php-coveralls/php-coveralls": "^2.0",
"friendsofphp/php-cs-fixer": "^2.18",
"friendsofphp/php-cs-fixer": "^3",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpspec/prophecy": "^1.17"
},
Expand Down

0 comments on commit 4c4bd22

Please sign in to comment.