Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

PHP Check

PHP Check #6507

Workflow file for this run

name: PHP Check
on:
workflow_call:
pull_request:
merge_group:
jobs:
stan:
name: PHP Stan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@2.31.1
with:
php-version: 8.3
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Dependencies
run: make vendor -B
- name: PHP Stan Analyse
run: vendor/bin/phpstan analyse
lint:
name: Symfony Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@2.31.1
with:
php-version: 8.3
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Dependencies
run: make all -B
env:
APP_ENV: dev
- name: Lint Container
run: bin/console lint:container
- name: Lint Twig
run: bin/console lint:twig
coverage:
name: PHP Code Coverage
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.6.4
ports:
- 3306
env:
MYSQL_USER: db
MYSQL_PASSWORD: db
MYSQL_DATABASE: db_test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
ssh-key: '${{ secrets.SSHKEY }}'
lfs: true
- uses: shivammathur/setup-php@2.31.1
with:
php-version: 8.3
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Replace variables
env:
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
echo "DATABASE_URL=mysql://db:db@127.0.0.1:${DB_PORT}/db?serverVersion=mariadb-10.6.4" >> .env.test.local
echo "APP_VERSION=test" >> .env.test.local
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Dependencies
run: make all -B
- run: make coverage.xml
- name: Check test coverage
id: test-coverage
uses: johanvanhelden/gha-clover-test-coverage-check@v1
with:
percentage: "50"
filename: "coverage.xml"
- uses: actions/upload-artifact@master
if: ${{ always() }}
with:
name: coverage
path: coverage-html
infection:
name: PHP Infection Test
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.6.4
ports:
- 3306
env:
MYSQL_USER: db
MYSQL_PASSWORD: db
MYSQL_DATABASE: db_test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
ssh-key: '${{ secrets.SSHKEY }}'
lfs: true
- uses: shivammathur/setup-php@2.31.1
with:
php-version: 8.3
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Replace variables
env:
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
echo "DATABASE_URL=mysql://db:db@127.0.0.1:${DB_PORT}/db?serverVersion=mariadb-10.6.4" >> .env.test.local
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Dependencies
run: make all -B
- run: make infection_test
- uses: actions/upload-artifact@master
if: ${{ failure() }}
with:
name: infection_log
path: infection.log
test:
name: Unittest
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php: [8.3]
experimental: [false]
#include:
# - php: 8.4
# experimental: true
services:
mariadb:
image: mariadb:10.6.4
ports:
- 3306
env:
MYSQL_USER: db
MYSQL_PASSWORD: db
MYSQL_DATABASE: db_test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: shivammathur/setup-php@2.31.1
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: intl, mbstring, imap, zip, dom, pdo_mysql
- name: Replace variables
env:
DB_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
echo "DATABASE_URL=mysql://db:db@127.0.0.1:${DB_PORT}/db?serverVersion=mariadb-10.6.4" >> .env.test.local
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- run: make install -B
name: Install dependencies
env:
APP_ENV: test
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
- name: Run Unittests
run: bin/phpunit
env:
APP_ENV: test