-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (82 loc) · 3.32 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# GitHub Action for Symfony with MySQL
name: Testing Symfony with MySQL
on: [push, pull_request]
jobs:
symfony:
name: Symfony (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['7.4']
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, composer:v1
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, :redis
coverage: xdebug #optional
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Remove only_full_group_by from mysql
run: mysql -uroot -proot -e "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"
- 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: Create .env file
run: cp .env.dist .env
- name: Change DATABASE_URL
run: sed -i 's+DATABASE_URL=mysql://dbuser:dbpass@dbhost/dbname+DATABASE_URL=mysql://root:root@localhost/karma_shop+g' .env
- name: Set APP_DEBUG=1
run: sed -i 's+APP_DEBUG=0+APP_DEBUG=1+g' .env
- name: Set APP_ENV=dev
run: sed -i 's+APP_ENV=prod+APP_ENV=dev+g' .env
- name: Change REDIS_URL
run: sed -i 's+REDIS_URL="redis://redis:6379"+REDIS_URL="redis://localhost:6379"+g' .env
- name: Install packages frontend
run: cd frontend/; yarn install
- name: Install packages main folder
run: yarn install
- name: Build website
run: yarn build
- name: Install Composer dependencies
run: composer install --no-progress
- name: Install redis
run: sudo apt-get install -y redis-tools redis-server
- name: Verify that redis is up
run: redis-cli -h 127.0.0.1 -p 6379 ping
- name: Chceck redis connection
run: php bin/console app:redis:check-connection
- name: Create database
run: php bin/console doctrine:database:create
- name: Update schema
run: php bin/console d:s:u --force
- name: Load fixtures
run: php bin/console --env=dev doctrine:fixtures:load --append
- name: Set chmod 777 var folder
run: sudo chmod 777 -R ./var/
- name: Flush all redis
run: php bin/console app:redis:flushall
- name: Run tests
run: ./bin/phpunit --coverage-text