1
0
mirror of https://github.com/danog/loop.git synced 2024-12-02 09:17:51 +01:00
loop/.github/workflows/main.yml

60 lines
1.7 KiB
YAML

name: build
on:
pull_request:
push:
jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
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 }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, sockets
coverage: pcov
tools: phpunit
- name: Check environment
run: |
php --version
composer --version
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist
- name: Run tests
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: |
phpunit --coverage-text --coverage-clover build/logs/clover.xml
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