Skip to content
Open
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/php-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: PHP-CI

on: [push]

jobs:
coding_standards:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4' ]
actions:
- { name: Code sniffer, run: composer code-sniffer }
- { name: Copy paste detector, run: composer copy-paste-detector }
- { name: Mess detector, run: composer mess-detector }
- { name: PHPStan, run: composer phpstan }
- { name: PHPUnit, run: composer coverage, coverage: pcov, artifact: coverage-html.tgz }

name: ${{ matrix.actions.name}} (${{ matrix.php }})

steps:
- uses: eonx-com/actions-checkout@v2

- uses: eonx-com/actions-setup-php@v1
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.actions.coverage }}

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

- uses: eonx-com/actions-cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php }}-comp-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.php }}-comp-

- run: composer global require hirak/prestissimo
- run: composer install --prefer-dist --no-progress

- name: '[CI] Check ${{ matrix.actions.name }} [CI]'
run: ${{ matrix.actions.run }}
shell: bash

- name: Upload artifacts
if: matrix.actions.artifact
uses: eonx-com/actions-upload-artifact@v1
with:
name: '${{ matrix.php }}-${{ matrix.actions.artifact }}'
path: coverage-html.tgz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
*.cache
.idea/*
21 changes: 20 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "BSD-3-Clause",
"type": "library",
"require": {
"php": ">=7.2",
"php": "^7.3",
"ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
Expand Down Expand Up @@ -86,5 +86,24 @@
"config": {
"optimize-autoloader": true,
"sort-packages": true
},
"scripts": {
"code-sniffer": "phpcs --standard=vendor/eonx-com/standards/php-code-sniffer/EoneoPay --colors --report=full src tests -p",
"copy-paste-detector": "phpcpd --ansi --min-lines=5 --min-tokens=70 src tests",
"mess-detector": "phpmd src,tests text phpmd.xml",
"phpstan": "phpstan analyze src tests -c phpstan.neon --ansi --level max --memory-limit=2048M",
"phpunit": "phpunit --configuration phpunit.xml",
"coverage": [
"@composer phpunit -- --coverage-text=coverage_output.txt --coverage-html=coverage-html",
"tar zcf coverage-html.tgz --directory=coverage-html .",
"easy-test check-coverage -c 100 coverage_output.txt"
],
"standards": [
"@code-sniffer",
"@copy-paste-detector",
"@mess-detector",
"@phpstan",
"@phpunit"
]
}
}
Loading