Skip to content

Fix PHP CS

Fix PHP CS #53

name: "Continuous Integration"
on:
- pull_request
- push
jobs:
coding-standards:
name: "Coding Standards"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Install PHP 8.2"
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: mbstring, xml
tools: composer:v1
- name: "Cache dependencies"
uses: actions/cache@v1
id: cache
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: "Validate composer.json"
run: php $(which composer) validate --strict
- name: "Install dependencies with composer"
run: php $(which composer) install --no-interaction --no-progress
- name: "Run PHP CodeSniffer"
run: php vendor/bin/phpcs --standard=phpcs.xml
static-code-analysis:
name: "Static Code Analysis"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Install PHP 8.2"
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: mbstring, xml
tools: composer:v1
- name: "Cache dependencies"
uses: actions/cache@v1
id: cache
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: "Install dependencies with composer"
run: php $(which composer) install --no-interaction --no-progress --no-plugins
- name: "Run phpstan/phpstan"
run: php vendor/bin/phpstan analyse --level max src tests
tests:
name: "Tests"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
dependencies:
- lowest
- highest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Install PHP ${{ matrix.php-version }}"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, xml
coverage: xdebug
tools: composer:v1
- name: "Cache dependencies"
uses: actions/cache@v1
id: cache
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: "Install lowest dependencies with composer"
if: matrix.dependencies == 'lowest'
run: php $(which composer) update --no-interaction --no-progress --no-plugins --prefer-lowest
- name: "Install highest dependencies with composer"
if: matrix.dependencies == 'highest'
run: php $(which composer) update --no-interaction --no-progress --no-plugins
- name: "Run unit tests"
run: php vendor/bin/phpunit
code-coverage:
name: "Code Coverage"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Install PHP 8.2"
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
extensions: mbstring, xml
coverage: xdebug:v2
tools: composer:v1
- name: "Cache dependencies"
uses: actions/cache@v1
id: cache
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: "Install dependencies with composer"
run: composer install --no-interaction --no-progress --no-plugins
- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
- name: "Download code coverage uploader for Codecov.io"
run: curl -s https://codecov.io/bash -o codecov
- name: "Send code coverage report to Codecov.io"
run: bash codecov -t ${{ secrets.CODECOV_TOKEN }}