191 lines (160 loc) · 5.58 KB
/
tests.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Tests
on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
jobs:
ubuntu:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: forge
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:5.0
ports:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: false
matrix:
include:
- php: 7.2.5
- php: 7.2.15
- php: 7.2
- php: 7.2
setup: lowest
- php: 7.3.0
- php: 7.3.5
- php: 7.3
- php: 7.3
setup: lowest
- php: 7.4
coverage: true
- php: 7.4
setup: lowest
- php: 8.0
- php: 8.0
setup: lowest
- php: 8.1
- php: 8.1
setup: lowest
- php: 7.4
laravel: true
- php: 7.4
styleCheck: true
name: ${{ matrix.styleCheck && 'Style check - ' || '' }}${{ matrix.laravel && 'Laravel compatibility - ' || '' }}${{ matrix.coverage && 'Coverage - ' || '' }}PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - ubuntu
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json${{ matrix.laravel && ', dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, memcached' || '' }}
tools: composer:v2
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
- name: Install locales
run: |
sudo apt-get update && sudo apt-get install tzdata locales -y && sudo locale-gen fr_FR.UTF-8 sr_ME.UTF-8 ar_AE.UTF-8 zh_TW.UTF-8 zh_CN.UTF-8 yo_NG.UTF-8 en_US.UTF-8
- name: Setup Memcached
if: matrix.laravel
uses: niden/actions-memcached@v7
- name: Install dependencies
run: |
composer remove --no-update povils/phpmnd --no-interaction --dev;
if [[ "${{ matrix.styleCheck }}" != 'true' ]]; then
composer remove --no-update phpmd/phpmd friendsofphp/php-cs-fixer --no-interaction;
fi;
if [[ "${{ matrix.laravel }}" != 'true' ]]; then
composer remove --no-update kylekatarnls/multi-tester --no-interaction;
fi;
composer update --prefer-dist --no-progress --no-suggest --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }};
- name: Run test suite
run: |
if [[ "${{ matrix.laravel }}" != 'true' && "${{ matrix.styleCheck }}" != 'true' && "${{ matrix.coverage }}" = 'true' ]]; then
php -d memory_limit=-1 -d zend.enable_gc=0 vendor/phpunit/phpunit/phpunit --coverage-clover=coverage.xml --coverage-text;
cp coverage.xml clover.xml;
fi;
if [[ "${{ matrix.laravel }}" != 'true' && "${{ matrix.styleCheck }}" != 'true' && "${{ matrix.coverage }}" != 'true' ]]; then
php -d memory_limit=-1 -d zend.enable_gc=0 vendor/phpunit/phpunit/phpunit;
fi;
if [[ "${{ matrix.laravel }}" != 'true' && "${{ matrix.styleCheck }}" = 'true' ]]; then
composer style-check;
fi;
if [[ "${{ matrix.laravel }}" = 'true' ]]; then
vendor/bin/multi-tester;
fi;
env:
PHP_VERSION: ${{ matrix.php }}
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root
- name: Code Climate Test Reporter
if: matrix.coverage
uses: aktions/codeclimate-test-reporter@v1
with:
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
command: after-build -t clover
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
continue-on-error: true
- name: Coverage
if: matrix.coverage
run: bash <(curl -s https://codecov.io/bash)
env:
PHP_VERSION: ${{ matrix.php }}
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- php: 7.2.5
- php: 7.2.15
- php: 7.2
- php: 7.2
setup: lowest
- php: 7.3.0
- php: 7.3.5
- php: 7.3
- php: 7.3
setup: lowest
- php: 7.4
coverage: true
- php: 7.4
setup: lowest
- php: 8.0
- php: 8.0
setup: lowest
- php: 8.1
- php: 8.1
setup: lowest
- php: 7.3.0
name: PHP ${{ matrix.php }} - ${{ matrix.setup || 'stable' }} - windows
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json
tools: composer:v2
coverage: none
- name: Install dependencies
run: |
composer remove --no-update povils/phpmnd kylekatarnls/multi-tester phpmd/phpmd friendsofphp/php-cs-fixer --no-interaction;
composer update --prefer-dist --no-progress --no-suggest --prefer-${{ matrix.setup || 'stable' }} ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }};
- name: Run test suite
run: |
php -d memory_limit=-1 -d zend.enable_gc=0 vendor/phpunit/phpunit/phpunit;
env:
PHP_VERSION: ${{ matrix.php }}
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379