Skip to content

PHP Composer

PHP Composer #273

Workflow file for this run

name: PHP Composer
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 0 * * 0'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- name: Prepare hosting deps
run: |
sudo apt-get update
sudo apt-get -y install ghostscript
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Prepare JS/CSS dependencies
env:
FONTAWESOME_AUTH_TOKEN: ${{ secrets.FONTAWESOME_AUTH_TOKEN }}
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" $FONTAWESOME_AUTH_TOKEN
npm install
- name: Build npm
run: npm run build
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: xdebug, imagick
- 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') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-scripts
- name: Lint
run: |
export PHP_CS_FIXER_IGNORE_ENV=1 && php vendor/bin/php-cs-fixer fix --diff --dry-run -v
php bin/console lint:yaml config --parse-tags
php bin/console lint:twig templates
- name: Test
run: |
mv .env.github .env.local
php bin/console doctrine:database:create --no-interaction --if-not-exists
php bin/console doctrine:migrations:migrate --no-interaction
export XDEBUG_MODE=coverage && php vendor/bin/phpunit
- name: Check dependencies
run: |
wget -q -O local-php-security-checker https://github.com/fabpot/local-php-security-checker/releases/download/v2.0.6/local-php-security-checker_2.0.6_linux_amd64
chmod +x local-php-security-checker
./local-php-security-checker