Skip to content

[TASK] Fix phpstan for level 5, Generate baseline for level max #992

[TASK] Fix phpstan for level 5, Generate baseline for level max

[TASK] Fix phpstan for level 5, Generate baseline for level max #992

name: Continuous Integration / Deployment (CI/CD)
on:
push:
branches:
- develop
- production
- stage
pull_request:
jobs:
validation:
name: Composer validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Validate composer.json
run: composer validate --strict
json_lint:
name: JSON Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Lint YAML files
run: composer ci:json:lint
yaml_lint:
name: YAML Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Lint YAML files
run: composer ci:yaml:lint
php_lint:
name: PHP Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Lint PHP files
run: composer ci:php:lint
php_coding_standards:
name: PHP Coding Standards
needs:
- php_lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Validation of coding standards for PHP files
run: composer ci:php:cs
php_stan:
name: PHP Stan
needs:
- php_lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Run PHPStan
run: composer ci:php:stan
tests:
name: Tests
needs:
- php_lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-latest-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-latest-
${{ runner.os }}-composer-
- name: Setup authentication for Composer
run: composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: composer install --prefer-dist --ansi --no-interaction --no-progress
- name: Unit Tests
run: composer ci:tests:php:unit
- name: Functional Tests
run: composer ci:tests:php:functional
- name: Upload Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: var/log
retention-days: 7
deployment:
name: Deployment
needs:
- json_lint
- yaml_lint
- validation
- php_coding_standards
- php_stan
if: ${{ github.event_name == 'push' }}
uses: ./.github/workflows/deployment.yml
secrets:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_PASSPHRASE: ${{ secrets.SSH_PASSPHRASE }}