Skip to content

stop-punaises CI

stop-punaises CI #657

Workflow file for this run

# https://help.github.com/en/actions
name: stop-punaises CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
schedule:
- cron: '0 7 * * *'
jobs:
code-quality:
name: STOP-PUNAISES (PHP ${{ matrix.php-versions }})
# https://hub.docker.com/_/ubuntu/
runs-on: ubuntu-latest
services:
# https://docs.docker.com/samples/library/mysql/
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: stopunaises
MYSQL_DATABASE: stopunaises_db
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# https://hub.docker.com/_/elasticsearch/
strategy:
fail-fast: true
matrix:
php-versions: ['8.1']
steps:
# https://github.com/actions/checkout (official)
- name: Checkout
uses: actions/checkout@v2
# https://github.com/shivammathur/setup-php (community)
- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, iconv, json, mbstring
env:
update: true
- name: Check PHP Version
run: php -v
- name: NPM install
uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm install
- name: NPM build
run: npm run build
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
# https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
composer install --working-dir=tools/php-cs-fixer --no-progress --no-suggest --prefer-dist --optimize-autoloader
# https://github.com/symfonycorp/security-checker-action
- name: Security check installed dependencies
uses: symfonycorp/security-checker-action@v3
- name: Lint twig templates
run: php bin/console lint:twig templates/
# https://github.com/phpstan/phpstan
- name: Analyse PHP Code (PHPStan)
run: vendor/bin/phpstan analyse
# https://github.com/FriendsOfPHP/PHP-CS-Fixer
- name: Check PHP coding standard (PHP-CS-Fixer)
run: composer cs-check
- name: Load Doctrine fixtures
run: |
composer require --dev symfony/orm-pack
php bin/console --env=test doctrine:database:create --no-interaction
php bin/console --env=test doctrine:migrations:migrate --no-interaction
php bin/console --env=test doctrine:fixtures:load --no-interaction
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/stopunaises_db
- name: Run tests
run: |
composer require --dev dama/doctrine-test-bundle
./vendor/bin/phpunit --stop-on-failure --testdox -d memory_limit=-1
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/stopunaises_db
NOTIFICATIONS_EMAIL: [email protected]
APP_URL: http://localhost:8080