99 runs-on : ubuntu-latest
1010 steps :
1111 - 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+
2013 - name : Restore/cache tools folder
2114 uses : actions/cache@v1
2215 with :
@@ -25,20 +18,24 @@ jobs:
2518 restore-keys : |
2619 all-tools-${{ github.sha }}-
2720 all-tools-
21+
2822 - name : composer
2923 uses : docker://composer
3024 env :
3125 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3226 with :
3327 args : install --no-interaction --prefer-dist --optimize-autoloader
28+
3429 - name : composer-require-checker
3530 uses : docker://phpga/composer-require-checker-ga
3631 env :
3732 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3833 with :
3934 args : check --config-file ./composer-require-config.json composer.json
35+
4036 - name : Install phive
4137 run : make install-phive
38+
4239 - name : Install PHAR dependencies
4340 run : tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5 --force-accept-unsigned
4441
4845 needs : setup
4946 steps :
5047 - uses : actions/checkout@master
48+
5149 - name : Restore/cache vendor folder
5250 uses : actions/cache@v1
5351 with :
5654 restore-keys : |
5755 all-build-${{ hashFiles('**/composer.lock') }}
5856 all-build-
57+
5958 - name : Restore/cache tools folder
6059 uses : actions/cache@v1
6160 with :
@@ -64,14 +63,17 @@ jobs:
6463 restore-keys : |
6564 all-tools-${{ github.sha }}-
6665 all-tools-
66+
6767 - name : PHPUnit
6868 uses : docker://phpdoc/phpunit-ga:latest
6969 env :
7070 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+
7172 - name : Quick check code coverage level
7273 run : php tests/coverage-checker.php 89
7374
7475 phpunit :
76+ name : Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
7577 runs-on : ${{ matrix.operating-system }}
7678 strategy :
7779 matrix :
@@ -80,20 +82,38 @@ jobs:
8082 - windows-latest
8183 - macOS-latest
8284 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+
8489 needs :
8590 - setup
8691 - phpunit-with-coverage
92+
8793 steps :
8894 - 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
90105 uses : actions/cache@v1
91106 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+
97117 - name : Restore/cache tools folder
98118 uses : actions/cache@v1
99119 with :
@@ -102,13 +122,21 @@ jobs:
102122 restore-keys : |
103123 all-tools-${{ github.sha }}-
104124 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
107132 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+
112140 - name : Run PHPUnit
113141 continue-on-error : true
114142 run : php tools/phpunit
@@ -152,30 +180,63 @@ jobs:
152180 args : analyse src --configuration phpstan.neon
153181
154182 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+
157198 steps :
158199 - 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
160210 uses : actions/cache@v1
161211 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
168228 uses : actions/cache@v1
169229 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+
179240
180241 bc_check :
181242 name : BC Check
0 commit comments