Skip to content

Merge pull request #24 from bedita/dependabot/github_actions/codecov-… #22

Merge pull request #24 from bedita/dependabot/github_actions/codecov-…

Merge pull request #24 from bedita/dependabot/github_actions/codecov-… #22

Workflow file for this run

name: 'php'
on:
pull_request:
paths:
- '**/*.php'
- '.github/workflows/php.yml'
- '**/composer.json'
push:
paths:
- '**/*.php'
- '.github/workflows/php.yml'
- '**/composer.json'
jobs:
cs:
uses: bedita/github-workflows/.github/workflows/php-cs.yml@v1
with:
php_versions: '["7.4", "8.0", "8.1", "8.2"]'
stan:
uses: bedita/github-workflows/.github/workflows/php-stan.yml@v1
with:
php_versions: '["7.4", "8.0", "8.1", "8.2"]'
unit:
name: 'Run unit tests'
if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')"
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
php:
- '7.4'
include:
- php: '8.0'
- php: '8.1'
- php: '8.2'
env:
PHP_VERSION: '${{ matrix.php }}'
steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v2'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php }}'
tools: 'composer'
extensions: 'mbstring, intl'
coverage: 'pcov'
ini-values: 'pcov.directory=., pcov.exclude="~vendor~"'
- name: 'Discover Composer cache directory'
id: 'cachedir'
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'
- name: 'Share Composer cache across runs'
uses: 'actions/cache@v2'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}"
restore-keys: |
composer-${{ matrix.php }}-
composer-
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'
- name: 'Run PHPUnit with coverage'
run: 'vendor/bin/phpunit --coverage-clover=clover.xml'
- name: 'Export coverage results'
uses: 'codecov/codecov-action@v4'
with:
file: './clover.xml'
env_vars: PHP_VERSION,DB_VENDOR
- name: 'Archive code coverage results'
uses: 'actions/upload-artifact@v2'
with:
name: 'PHP ${{ matrix.php }}'
path: 'clover.xml'