Skip to content

Merge pull request #172 from thepacer/dependabot/npm_and_yarn/webpack… #180

Merge pull request #172 from thepacer/dependabot/npm_and_yarn/webpack…

Merge pull request #172 from thepacer/dependabot/npm_and_yarn/webpack… #180

Workflow file for this run

# GitHub Action for Symfony with MySQL
name: CI Build and Test
on: [push, pull_request]
jobs:
build:
name: Build and Test (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: symfony
MYSQL_DATABASE: symfony_test
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: xdebug #optional
- name: Start mysql service
run: sudo systemctl start mysql.service
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install Node dependencies
run: npm ci
- name: Build Webpack
run: npm run build
- name: Run Migration
run: |
php bin/console doctrine:database:create --if-not-exists -n
php bin/console doctrine:migrations:migrate -n
php bin/console doctrine:fixtures:load -n
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony_test
- name: Run Validators
run: |
php bin/console lint:yaml config
php bin/console lint:twig templates
php bin/console lint:xliff translations
php bin/console doctrine:schema:validate -vvv --no-interaction
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony_test
- name: Run PHPUnit
run: bin/phpunit --coverage-clover build/coverage-${{ matrix.php-versions }}.xml --log-junit build/phpunit-${{ matrix.php-versions }}.xml
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/symfony
- name: Upload test result artifacts
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.php-versions }}
path: build/
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}