Skip to content

Linting

Linting #7522

Workflow file for this run

name: CI
on: push
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
name: Unit tests ${{ matrix.php-versions }}
services:
mysql:
image: bitnami/mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_PASSWORD: vagrant
MYSQL_ROOT_PASSWORD: vagrant
MYSQL_USER: vagrant
MYSQL_DATABASE: udb3_test
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: πŸ“€ Checkout project
uses: actions/checkout@v4
- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: xdebug.mode=coverage
extensions: bcmath, tidy
tools: composer
- name: ✌️ Check PHP Version
run: php -v
- name: πŸ›‚ Validate composer.json and composer.lock
run: composer validate
- name: πŸ“© Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}-v1
restore-keys: |
${{ runner.os }}-php-
- name: πŸ“¦ Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest
- name: βœ… Run tests
run: composer test
env:
DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
name: Code style ${{ matrix.php-versions }}
steps:
- name: πŸ“€ Checkout project
uses: actions/checkout@v4
- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: tidy, zip
tools: composer
- name: πŸ“© Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: πŸ“¦ Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest
- name: ✨ Run code style check
run: composer cs
phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
name: Static analysis ${{ matrix.php-versions }}
steps:
- name: πŸ“€ Checkout project
uses: actions/checkout@v4
- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: tidy, zip
tools: composer
- name: πŸ“© Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: πŸ“¦ Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest
- name: πŸ” Run static analysis
run: composer phpstan
unused:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0", "8.1"]
name: Unused composer dependencies ${{ matrix.php-versions }}
steps:
- name: πŸ“€ Checkout project
uses: actions/checkout@v4
- name: 🐘 Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: tidy, zip
tools: composer
- name: πŸ“© Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: πŸ“¦ Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --no-progress --no-suggest
- name: πŸ—‘ Run unused dependencies check
run: composer unused