Fix issue #87 #221
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request] | |
env: | |
DEFAULT_COMPOSER_FLAGS: "--no-interaction" | |
CC_TEST_REPORTER_ID: 69cbfa73f14104ba64b475240faca52ae05f3cd2f72942c9c62eba324cf4a351 | |
jobs: | |
## PHPSTAN | |
phpstan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP | |
uses: shivammathur/[email protected] | |
with: | |
php-version: '8.0' | |
extensions: mbstring, intl | |
coverage: none | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update: true | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
- name: PHPStan tests | |
run: composer phpstan | |
## Rector | |
rector: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install PHP | |
uses: shivammathur/[email protected] | |
with: | |
php-version: '8.0' | |
extensions: mbstring, intl | |
coverage: none | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
update: true | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
- name: Rector tests | |
run: composer rector | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply rector changes | |
php-cs-fixer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install | |
run: composer install | |
- name: Run php-cs-fixer | |
run: composer phpcsfixer | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply php-cs-fixer changes | |
## PHPUNIT | |
phpunit: | |
name: PHP ${{ matrix.php }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] | |
steps: | |
## checkout the repoistory | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
## Install(?) php | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, mbstring, mcrypt, zip | |
ini-values: date.timezone='UTC' | |
tools: composer:v1 | |
env: | |
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
## install composer | |
## clear cache issue: https://github.com/composer/composer/issues/5982 | |
- name: Install dependencies | |
run: composer clearcache && composer install --prefer-dist | |
## run unit tests | |
- name: PHP Unit tests for PHP | |
run: vendor/bin/phpunit --verbose --configuration actions.phpunit.xml | |
if: matrix.php == '8.3' || matrix.php == '8.2' || matrix.php == '8.1' || matrix.php == '8.0' || matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' | |
## unit test with coverage | |
- name: PHP Unit tests for PHP 7.2 | |
run: vendor/bin/phpunit --verbose --coverage-clover=clover.xml --configuration actions.phpunit.xml | |
if: matrix.php == '7.2' | |
## coverage | |
- name: Code coverage | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter after-build -t clover | |
if: matrix.php == '7.2' | |
continue-on-error: true # if is fork |