Skip to content

Refactor/template styles (#14) #74

Refactor/template styles (#14)

Refactor/template styles (#14) #74

Workflow file for this run

name: Symfony
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
symfony-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_db_test
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, intl, pdo, pdo_mysql, ctype, iconv, gd
ini-values: post_max_size=256M, upload_max_filesize=256M, max_execution_time=300
coverage: none
- name: Checkout Repository
uses: actions/checkout@v4
- name: Copy .env if not exists
run: php -r "file_exists('.env') || copy('.env.SAMPLE', '.env');"
- name: Copy .env.test.local if not exists
run: php -r "file_exists('.env.test.local') || copy('.env.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: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --optimize-autoloader
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress --ansi
- name: Wait for MySQL to be ready
run: until mysqladmin ping -h127.0.0.1 -uroot -proot --silent; do sleep 1; done
- name: Run Database Migrations
run: php bin/console doctrine:migrations:migrate --no-interaction --env=test
env:
DATABASE_URL: 'mysql://test_user:test_password@127.0.0.1:3306/test_db'
- name: Create directories if they do not exist
run: |
mkdir -p var public/uploads public/uploads/categories public/uploads/products public/uploads/settings
- name: Set Permissions
run: |
chmod -R 775 var public/uploads
- name: Run PHPUnit Tests
run: vendor/bin/phpunit --testdox --colors=always --log-junit junit.xml --coverage-text --coverage-clover=coverage.xml
env:
DATABASE_URL: 'mysql://test_user:test_password@127.0.0.1:3306/test_db'
- name: Upload JUnit Test Report
uses: actions/upload-artifact@v4
with:
name: junit-test-report
path: junit.xml