-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (88 loc) · 3.67 KB
/
php.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Dependencies and Tests
on:
push:
branches: [ master, feature/** ]
pull_request:
branches: [ master ]
jobs:
build:
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: juvem
MYSQL_DATABASE: juvem
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 }}
extensions: exif, json, ctype, fileinfo, iconv, intl, mbstring, xml, xmlwriter, pdo, mysql, zip
coverage: xdebug #optional
- name: Start database service
run: sudo /etc/init.d/mysql start
- name: Install jre
run: sudo apt-get update -qq && sudo apt-get -q -y install openjdk-8-jre openjdk-8-jre-headless
- name: Install libreoffice
run: sudo apt-get -q -y install libreoffice-core libreoffice-writer libreoffice-java-common --no-install-recommends
- name: Ensure home config is available for user
run: chown -R --reference="$HOME" ~/.config
- name: Ensure home config is available for root
run: sudo chown -R --reference="$HOME" ~/.config
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer --working-dir=app config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/app/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Validate Composer files
run: composer validate --working-dir=app
- name: Copy testing parameters config
run: cp app/config/parameters.yml.test var/config/parameters.yml
- name: Insert database port number in config file
run: echo " database_port${{':'}} ${{ job.services.mysql.ports['3306'] }}" >> var/config/parameters.yml
- name: Install Composer dependencies
run: |
composer install --no-progress --prefer-dist --optimize-autoloader --working-dir=app
- name: Run Migration
run: |
php app/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
php app/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
- name: Copy test config
run: cp phpunit.xml.dist phpunit.xml
- name: Run Tests
run: php app/bin/phpunit --coverage-text --coverage-clover ./phpunit-result-clover.xml
- uses: actions/upload-artifact@v2
with:
name: phpunit-result-clover
path: ./phpunit-result-clover.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./phpunit-result-clover.xml
flags: unittests
name: clover-coverage
fail_ci_if_error: false
- name: Upload coverage to codeclimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageLocations: |
./phpunit-result-clover.xml:clover