Skip to content

UnitTest & Lint

UnitTest & Lint #50

Workflow file for this run

name: UnitTest & Lint
on:
push:
branches:
- master
- develop
pull_request:
branches:
- '*'
schedule:
- cron: "0 7 1 * *"
branches:
- master
jobs:
testsuite:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2']
coverage: ['no']
test-tld: ['no']
include:
- php-version: '8.2'
coverage: 'coverage'
test-tld: 'no'
- php-version: '8.2'
coverage: 'no'
test-tld: 'test-tld'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist
- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '8.1' || matrix.php-version == '8.2'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run PHPUnit
run: |
if [[ ${{ matrix.coverage }} == 'coverage' ]]; then
vendor/bin/phpunit --exclude-group deprecated,tld --stderr --verbose --coverage-clover=coverage.xml
elif [[ ${{ matrix.test-tld }} == 'test-tld' ]]; then
vendor/bin/phpunit --group tld --stderr
else
vendor/bin/phpunit --exclude-group deprecated,tld --stderr
fi
- name: Submit code coverage
if: matrix.coverage == 'coverage'
uses: codecov/codecov-action@v1
codestyle:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, intl, apcu
coverage: none
tools: cs2pr, phpcs
- name: Run PHP CodeSniffer
run: phpcs -qn --report=checkstyle --extensions=php --standard=PSR12 ./lib ./tests | cs2pr