Skip to content

Delete phpunit.xml.dist #7

Delete phpunit.xml.dist

Delete phpunit.xml.dist #7

Workflow file for this run

name: CI/CD
on:
push:
branches:
- master
- develop
paths:
- .github/workflows/ci-cd.yml
- "src/**"
- "tests/**"
- .php_cs.dist
- .phpcs.xml
- .scrutinizer.yml
- composer.json
- phpunit.xml.dist
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [7.1, 7.2, 7.3, 7.4]
include:
- php: 7.4
test_with_coverage: 1
name: Test on PHP v${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
if: matrix.test_with_coverage != 1
with:
# Specify the PHP version you want to setup.
php-version: "${{ matrix.php }}"
# Specify the extensions you want to add or remove. (eg. mbstring, :opcache)
# extensions: # optional
# Specify the values you want to add to php.ini. (post_max_size=256M, short_open_tag=On)
# ini-values: # optional
# Specify the code coverage driver you want to setup. (xdebug, pcov or none)
coverage: none # optional
# Specify the tools you want to setup. (eg. phpunit, phpcs)
# tools: # optional
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
if: matrix.test_with_coverage == 1
with:
# Specify the PHP version you want to setup.
php-version: "${{ matrix.php }}"
# Specify the extensions you want to add or remove. (eg. mbstring, :opcache)
# extensions: # optional
# Specify the values you want to add to php.ini. (post_max_size=256M, short_open_tag=On)
# ini-values: # optional
# Specify the code coverage driver you want to setup. (xdebug, pcov or none)
coverage: xdebug # optional
# Specify the tools you want to setup. (eg. phpunit, phpcs)
# tools: # optional
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# https://github.com/actions/cache/blob/main/examples.md#php---composer
- name: Get Composer Cache Directory
id: composer-cache-dir-path
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache local composer repository
uses: actions/cache@v2
id: composer-cache
with:
# A list of files, directories, and wildcard patterns to cache and restore. See @actions/glob for supported patterns.
path: ${{ steps.composer-cache-dir-path.outputs.dir }}
# An explicit key for restoring and saving the cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Check composer.json and composer.lock validity
run: composer validate --strict
- name: Check with phpcs
run: ./vendor/bin/phpcs
# Don't make this a requirement for now, php-cs-fixer fails to follow PSR-12 standard
- name: Check whether code follows Symfony Code Syntax rules
continue-on-error: true
run: ./vendor/bin/php-cs-fixer fix --diff --dry-run -v
- name: Run tests
run: ./vendor/bin/phpunit
# https://github.com/php-coveralls/php-coveralls
- name: Upload coverage report to Coveralls
if: github.event_name == 'push' && github.repository == 'D3strukt0r/votifier-client-php' && matrix.test_with_coverage == 1
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
curl -fsSL -o php-coveralls.phar https://github.com/php-coveralls/php-coveralls/releases/latest/download/php-coveralls.phar
php php-coveralls.phar -v --coverage_clover=coverage/logs/clover.xml --json_path=coverage/logs/coveralls-upload.json
# https://scrutinizer-ci.com/docs/tools/external-code-coverage/
# https://github.com/scrutinizer-ci/ocular
- name: Upload coverage report to Scrutinizer
if: github.event_name == 'push' && github.repository == 'D3strukt0r/votifier-client-php' && matrix.test_with_coverage == 1
run: |
curl -fsSL -o ocular.phar https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload -v --format=php-clover coverage/logs/clover.xml