9
9
runs-on : ubuntu-latest
10
10
steps :
11
11
- uses : actions/checkout@master
12
- - name : Restore/cache vendor folder
13
- uses : actions/cache@v1
14
- with :
15
- path : vendor
16
- key : all-build-${{ hashFiles('**/composer.lock') }}
17
- restore-keys : |
18
- all-build-${{ hashFiles('**/composer.lock') }}
19
- all-build-
12
+
20
13
- name : Restore/cache tools folder
21
14
uses : actions/cache@v1
22
15
with :
@@ -25,20 +18,24 @@ jobs:
25
18
restore-keys : |
26
19
all-tools-${{ github.sha }}-
27
20
all-tools-
21
+
28
22
- name : composer
29
23
uses : docker://composer
30
24
env :
31
25
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32
26
with :
33
27
args : install --no-interaction --prefer-dist --optimize-autoloader
28
+
34
29
- name : composer-require-checker
35
30
uses : docker://phpga/composer-require-checker-ga
36
31
env :
37
32
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38
33
with :
39
34
args : check --config-file ./composer-require-config.json composer.json
35
+
40
36
- name : Install phive
41
37
run : make install-phive
38
+
42
39
- name : Install PHAR dependencies
43
40
run : tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5 --force-accept-unsigned
44
41
48
45
needs : setup
49
46
steps :
50
47
- uses : actions/checkout@master
48
+
51
49
- name : Restore/cache vendor folder
52
50
uses : actions/cache@v1
53
51
with :
56
54
restore-keys : |
57
55
all-build-${{ hashFiles('**/composer.lock') }}
58
56
all-build-
57
+
59
58
- name : Restore/cache tools folder
60
59
uses : actions/cache@v1
61
60
with :
@@ -64,14 +63,17 @@ jobs:
64
63
restore-keys : |
65
64
all-tools-${{ github.sha }}-
66
65
all-tools-
66
+
67
67
- name : PHPUnit
68
68
uses : docker://phpdoc/phpunit-ga:latest
69
69
env :
70
70
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71
+
71
72
- name : Quick check code coverage level
72
73
run : php tests/coverage-checker.php 89
73
74
74
75
phpunit :
76
+ name : Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
75
77
runs-on : ${{ matrix.operating-system }}
76
78
strategy :
77
79
matrix :
@@ -80,20 +82,38 @@ jobs:
80
82
- windows-latest
81
83
- macOS-latest
82
84
php-versions : ['7.2', '7.3', '7.4']
83
- name : Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
85
+ env :
86
+ extensions : mbstring
87
+ key : cache-v1 # can be any string, change to clear the extension cache.
88
+
84
89
needs :
85
90
- setup
86
91
- phpunit-with-coverage
92
+
87
93
steps :
88
94
- uses : actions/checkout@master
89
- - name : Restore/cache vendor folder
95
+
96
+ - name : Setup cache environment
97
+ id : cache-env
98
+ uses : shivammathur/cache-extensions@v1
99
+ with :
100
+ php-version : ${{ matrix.php-versions }}
101
+ extensions : ${{ env.extensions }}
102
+ key : ${{ env.key }}
103
+
104
+ - name : Cache extensions
90
105
uses : actions/cache@v1
91
106
with :
92
- path : vendor
93
- key : all-build-${{ hashFiles('**/composer.lock') }}
94
- restore-keys : |
95
- all-build-${{ hashFiles('**/composer.lock') }}
96
- all-build-
107
+ path : ${{ steps.cache-env.outputs.dir }}
108
+ key : ${{ steps.cache-env.outputs.key }}
109
+
110
+ - name : Setup PHP
111
+ uses : shivammathur/setup-php@master
112
+ with :
113
+ php-version : ${{ matrix.php-versions }}
114
+ extension : ${{ env.extensions }}
115
+ ini-values : memory_limit=2G, display_errors=On, error_reporting=-1
116
+
97
117
- name : Restore/cache tools folder
98
118
uses : actions/cache@v1
99
119
with :
@@ -102,13 +122,21 @@ jobs:
102
122
restore-keys : |
103
123
all-tools-${{ github.sha }}-
104
124
all-tools-
105
- - name : Setup PHP
106
- uses : shivammathur/setup-php@master
125
+
126
+ - name : Get composer cache directory
127
+ id : composer-cache
128
+ run : echo "::set-output name=dir::$(composer config cache-files-dir)"
129
+
130
+ - name : Cache dependencies
131
+ uses : actions/cache@v1
107
132
with :
108
- php-version : ${{ matrix.php-versions }}
109
- extension-csv : mbstring, intl, iconv, libxml, dom, json, simplexml, zlib
110
- ini-values-csv : memory_limit=2G, display_errors=On, error_reporting=-1
111
- pecl : false
133
+ path : ${{ steps.composer-cache.outputs.dir }}
134
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
135
+ restore-keys : ${{ runner.os }}-composer-
136
+
137
+ - name : Install dependencies
138
+ run : composer install --no-interaction --prefer-dist --optimize-autoloader
139
+
112
140
- name : Run PHPUnit
113
141
continue-on-error : true
114
142
run : php tools/phpunit
@@ -152,30 +180,63 @@ jobs:
152
180
args : analyse src --configuration phpstan.neon
153
181
154
182
psalm :
155
- runs-on : ubuntu-latest
156
- needs : [setup, phpunit]
183
+ name : Psaml
184
+ runs-on : ${{ matrix.operating-system }}
185
+ strategy :
186
+ matrix :
187
+ operating-system :
188
+ - ubuntu-latest
189
+ php-versions : ['7.2']
190
+ env :
191
+ extensions : mbstring
192
+ key : cache-v1 # can be any string, change to clear the extension cache.
193
+
194
+ needs :
195
+ - setup
196
+ - phpunit
197
+
157
198
steps :
158
199
- uses : actions/checkout@master
159
- - name : Restore/cache vendor folder
200
+
201
+ - name : Setup cache environment
202
+ id : cache-env
203
+ uses : shivammathur/cache-extensions@v1
204
+ with :
205
+ php-version : ${{ matrix.php-versions }}
206
+ extensions : ${{ env.extensions }}
207
+ key : ${{ env.key }}
208
+
209
+ - name : Cache extensions
160
210
uses : actions/cache@v1
161
211
with :
162
- path : vendor
163
- key : all-build-${{ hashFiles('**/composer.lock') }}
164
- restore-keys : |
165
- all-build-${{ hashFiles('**/composer.lock') }}
166
- all-build-
167
- - name : Restore/cache tools folder
212
+ path : ${{ steps.cache-env.outputs.dir }}
213
+ key : ${{ steps.cache-env.outputs.key }}
214
+
215
+ - name : Setup PHP
216
+ uses : shivammathur/setup-php@master
217
+ with :
218
+ php-version : ${{ matrix.php-versions }}
219
+ extension : ${{ env.extensions }}
220
+ tools : psalm
221
+ ini-values : memory_limit=2G, display_errors=On, error_reporting=-1
222
+
223
+ - name : Get composer cache directory
224
+ id : composer-cache
225
+ run : echo "::set-output name=dir::$(composer config cache-files-dir)"
226
+
227
+ - name : Cache dependencies
168
228
uses : actions/cache@v1
169
229
with :
170
- path : tools
171
- key : all-tools-${{ github.sha }}
172
- restore-keys : |
173
- all-tools-${{ github.sha }}-
174
- all-tools-
175
- - name : Psalm
176
- uses : docker://mickaelandrieu/psalm-ga
177
- env :
178
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
230
+ path : ${{ steps.composer-cache.outputs.dir }}
231
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
232
+ restore-keys : ${{ runner.os }}-composer-
233
+
234
+ - name : Install dependencies
235
+ run : composer install --no-interaction --prefer-dist --optimize-autoloader
236
+
237
+ - name : Run psalm
238
+ run : psalm --output-format=github
239
+
179
240
180
241
bc_check :
181
242
name : BC Check
0 commit comments