2020-07-23 14:21:26 +02:00
|
|
|
name: build
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
jobs:
|
|
|
|
run:
|
2020-07-23 16:56:51 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-07-23 14:21:26 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-07-23 16:56:51 +02:00
|
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
php-versions: ["7.1", "7.2", "7.3", "7.4"]
|
|
|
|
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.os }}
|
2020-07-23 14:21:26 +02:00
|
|
|
steps:
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-07-23 14:21:26 +02:00
|
|
|
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Setup PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2020-07-23 17:03:53 +02:00
|
|
|
extensions: mbstring, intl, sockets
|
2020-07-23 17:21:32 +02:00
|
|
|
coverage: xdebug
|
2020-07-23 14:21:26 +02:00
|
|
|
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Check environment
|
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
2020-07-23 14:21:26 +02:00
|
|
|
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Get composer cache directory
|
|
|
|
id: composercache
|
|
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
2020-07-23 14:21:26 +02:00
|
|
|
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Cache dependencies
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composercache.outputs.dir }}
|
2020-07-23 17:21:32 +02:00
|
|
|
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-composer-${{ matrix.php-versions }}-
|
2020-07-23 14:21:26 +02:00
|
|
|
|
2020-07-23 16:56:51 +02:00
|
|
|
- name: Install dependencies
|
|
|
|
run: composer install --prefer-dist
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
env:
|
|
|
|
PHP_CS_FIXER_IGNORE_ENV: 1
|
|
|
|
run: |
|
2020-07-23 17:21:32 +02:00
|
|
|
vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
|
2020-07-23 16:56:51 +02:00
|
|
|
vendor/bin/php-cs-fixer --diff --dry-run -v fix
|
|
|
|
vendor/bin/psalm
|
|
|
|
|
|
|
|
- name: Collect code coverage
|
|
|
|
if: success() && matrix.php-versions == 7.4
|
|
|
|
env:
|
|
|
|
COVERALLS_REPO_TOKEN: ${{secrets.COVERALLS_REPO_TOKEN}}
|
|
|
|
COVERALLS_FLAG_NAME: ${{ matrix.os }}
|
|
|
|
run: |
|
|
|
|
composer global require cedx/coveralls
|
|
|
|
coveralls build/logs/clover.xml
|