-
Notifications
You must be signed in to change notification settings - Fork 9
95 lines (80 loc) · 3.2 KB
/
main.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
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI
on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master ]
jobs:
cs-fixer:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
extensions: mbstring, intl, dom, gmp, xml
ini-values: memory_limit=-1
- name: Checking PHP files with php-cs-fixer
run: |
bin/php-cs-fixer fix --rules=@Symfony -v --dry-run --stop-on-violation --using-cache=false backend/src
phpunit:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
# Install custom MySQL via mirromutth/[email protected]
- name: Set up MySQL
uses: mirromutth/[email protected]
with:
mysql version: '5.7'
mysql database: 'campr'
mysql root password: 'campr'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
extensions: mbstring, intl, dom, gmp, xml, mysql, curl, opcache, mcrypt, gd, apcu, redis, apc
tools: pecl
ini-values: memory_limit=-1
- name: Setup Redis
uses: zhulik/[email protected]
with:
redis version: '5'
- 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@v1
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: Setup test env
run: |
export SYMFONY_ENV=test
export SYMFONY__DATABASE_NAME=campr
export SYMFONY__DATABASE_PASSWORD=campr
rm -rf var/cache/*
composer install --quiet --prefer-dist --no-interaction
cp phpunit.xml.dist phpunit.xml
rm -rf web/uploads/tests
mkdir -p backend/src/AppBundle/Tests/Resources/files/ && touch backend/src/AppBundle/Tests/Resources/files/file.txt
bin/console doctrine:database:drop --if-exists --force --env=test
bin/console doctrine:database:create --env=test
bin/console doctrine:migrations:migrate --no-interaction --env=test
bin/console doctrine:schema:validate --env=test
bin/console doctrine:fixtures:load --append --fixtures=backend/src/AppBundle/DataFixtures/ORM/ --no-interaction --env=test
bin/console cache:clear --env=test
- name: Running phpunit tests
run: |
export SYMFONY_ENV=test
export SYMFONY__DATABASE_NAME=campr
export SYMFONY__DATABASE_PASSWORD=campr
backend/vendor/bin/phpunit -c . backend/src