Skip to content

Commit 6c9366f

Browse files
authored
Merge pull request #119 from phpDocumentor/php8.1
Add php 8.1 to build matrix
2 parents 6759f22 + 0967b8d commit 6c9366f

File tree

9 files changed

+163
-97
lines changed

9 files changed

+163
-97
lines changed

.github/workflows/push.yml

Lines changed: 99 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,14 @@ on:
44
- 1.x
55
pull_request:
66
name: Qa workflow
7+
env:
8+
phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1
79
jobs:
8-
setup:
10+
composer-check:
911
runs-on: ubuntu-latest
1012
steps:
1113
- uses: actions/checkout@v2
1214

13-
- name: Restore/cache tools folder
14-
uses: actions/cache@v2
15-
with:
16-
path: tools
17-
key: all-tools-${{ github.sha }}
18-
restore-keys: |
19-
all-tools-${{ github.sha }}-
20-
all-tools-
21-
2215
- name: composer
2316
uses: docker://composer
2417
env:
@@ -33,16 +26,9 @@ jobs:
3326
with:
3427
args: check --config-file ./composer-require-config.json composer.json
3528

36-
- name: Install phive
37-
run: make install-phive
38-
39-
- name: Install PHAR dependencies
40-
run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,8A03EA3B385DBAA1 --force-accept-unsigned
41-
4229
phpunit-with-coverage:
4330
runs-on: ubuntu-latest
4431
name: Unit tests
45-
needs: setup
4632
steps:
4733
- uses: actions/checkout@v2
4834

@@ -52,27 +38,17 @@ jobs:
5238
php-version: 7.2
5339
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
5440
coverage: pcov
41+
tools: phive
5542

56-
- name: Restore/cache tools folder
57-
uses: actions/cache@v2
58-
with:
59-
path: tools
60-
key: all-tools-${{ github.sha }}
61-
restore-keys: |
62-
all-tools-${{ github.sha }}-
63-
all-tools-
43+
- name: Install PHAR dependencies
44+
env:
45+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} --force-accept-unsigned
6447

6548
- name: Get composer cache directory
6649
id: composer-cache
6750
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
6851

69-
- name: Cache composer dependencies
70-
uses: actions/cache@v2
71-
with:
72-
path: ${{ steps.composer-cache.outputs.dir }}
73-
key: ubuntu-latest-composer-${{ hashFiles('**/composer.lock') }}
74-
restore-keys: ubuntu-latest-composer-
75-
7652
- name: Install Composer dependencies
7753
run: |
7854
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
@@ -81,70 +57,88 @@ jobs:
8157
run: php tools/phpunit
8258

8359
phpunit:
60+
name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
8461
runs-on: ${{ matrix.operating-system }}
62+
continue-on-error: ${{ matrix.php-versions == '8.1' }}
8563
strategy:
8664
matrix:
8765
operating-system:
8866
- ubuntu-latest
8967
- windows-latest
9068
- macOS-latest
91-
php-versions: ['7.2', '7.3', '7.4', '8.0']
92-
name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
69+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
70+
env:
71+
extensions: mbstring
72+
key: cache-v1 # can be any string, change to clear the extension cache.
73+
9374
needs:
94-
- setup
9575
- phpunit-with-coverage
76+
9677
steps:
9778
- uses: actions/checkout@v2
9879

99-
- name: Restore/cache vendor folder
100-
uses: actions/cache@v2
80+
- name: Setup cache environment
81+
id: cache-env
82+
uses: shivammathur/cache-extensions@v1
10183
with:
102-
path: vendor
103-
key: all-build-${{ hashFiles('**/composer.lock') }}
104-
restore-keys: |
105-
all-build-${{ hashFiles('**/composer.lock') }}
106-
all-build-
84+
php-version: ${{ matrix.php-versions }}
85+
extensions: ${{ env.extensions }}
86+
key: ${{ env.key }}
10787

108-
- name: Restore/cache tools folder
88+
- name: Cache extensions
10989
uses: actions/cache@v2
11090
with:
111-
path: tools
112-
key: all-tools-${{ github.sha }}
113-
restore-keys: |
114-
all-tools-${{ github.sha }}-
115-
all-tools-
91+
path: ${{ steps.cache-env.outputs.dir }}
92+
key: ${{ steps.cache-env.outputs.key }}
11693

11794
- name: Setup PHP
11895
uses: shivammathur/setup-php@v2
11996
with:
12097
php-version: ${{ matrix.php-versions }}
98+
extensions: ${{ env.extensions }}
12199
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
122-
coverage: none
100+
tools: phive
101+
102+
- name: Install PHAR dependencies
103+
env:
104+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} --force-accept-unsigned
106+
107+
- name: Install phpunit 8 for php 7.2
108+
if: matrix.php-versions == '7.2'
109+
env:
110+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5
123112

124113
- name: Get composer cache directory
125114
id: composer-cache
126115
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
127116

128-
- name: Cache composer dependencies
117+
- name: Cache dependencies
129118
uses: actions/cache@v2
130119
with:
131120
path: ${{ steps.composer-cache.outputs.dir }}
132121
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
133122
restore-keys: ${{ runner.os }}-composer-
134123

135-
- name: Install Composer dependencies
136-
run: |
137-
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
124+
- name: Install dependencies
125+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
138126

139127
- name: Run PHPUnit
140128
continue-on-error: true
141129
run: php tools/phpunit
142130

143131
codestyle:
144132
runs-on: ubuntu-latest
145-
needs: [setup, phpunit]
133+
needs: [phpunit]
146134
steps:
147135
- uses: actions/checkout@v2
136+
- name: composer
137+
uses: docker://composer
138+
env:
139+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140+
with:
141+
args: install --no-interaction --prefer-dist --optimize-autoloader
148142
- name: Restore/cache vendor folder
149143
uses: actions/cache@v2
150144
with:
@@ -160,64 +154,93 @@ jobs:
160154

161155
phpstan:
162156
runs-on: ubuntu-latest
163-
needs: [setup, phpunit]
157+
needs: [phpunit]
164158
steps:
165159
- uses: actions/checkout@v2
166-
- name: Restore/cache vendor folder
167-
uses: actions/cache@v2
160+
- name: composer
161+
uses: docker://composer
162+
env:
163+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168164
with:
169-
path: vendor
170-
key: all-build-${{ hashFiles('**/composer.lock') }}
171-
restore-keys: |
172-
all-build-${{ hashFiles('**/composer.lock') }}
173-
all-build-
165+
args: install --no-interaction --prefer-dist --optimize-autoloader
166+
174167
- name: PHPStan
175-
uses: phpDocumentor/phpstan-ga@master
168+
uses: phpDocumentor/phpstan-ga@0.12.9
176169
env:
177170
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178171
with:
179172
args: analyse src --configuration phpstan.neon
180173

181174
psalm:
182-
runs-on: ubuntu-latest
183-
needs: [setup, phpunit]
175+
name: Psalm
176+
runs-on: ${{ matrix.operating-system }}
177+
strategy:
178+
matrix:
179+
operating-system:
180+
- ubuntu-latest
181+
php-versions: ['7.3']
182+
env:
183+
extensions: mbstring
184+
key: cache-v1 # can be any string, change to clear the extension cache.
185+
186+
needs:
187+
- phpunit
188+
184189
steps:
185190
- uses: actions/checkout@v2
186191

192+
- name: Setup cache environment
193+
id: cache-env
194+
uses: shivammathur/cache-extensions@v1
195+
with:
196+
php-version: ${{ matrix.php-versions }}
197+
extensions: ${{ env.extensions }}
198+
key: ${{ env.key }}
199+
200+
- name: Cache extensions
201+
uses: actions/cache@v2
202+
with:
203+
path: ${{ steps.cache-env.outputs.dir }}
204+
key: ${{ steps.cache-env.outputs.key }}
205+
187206
- name: Setup PHP
188207
uses: shivammathur/setup-php@v2
189208
with:
190-
php-version: 7.2
209+
php-version: ${{ matrix.php-versions }}
210+
extensions: ${{ env.extensions }}
191211
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
192-
tools: psalm
193-
coverage: none
194212

195213
- name: Get composer cache directory
196214
id: composer-cache
197215
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
198216

199-
- name: Cache composer dependencies
217+
- name: Cache dependencies
200218
uses: actions/cache@v2
201219
with:
202220
path: ${{ steps.composer-cache.outputs.dir }}
203221
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
204222
restore-keys: ${{ runner.os }}-composer-
205223

206-
- name: Install Composer dependencies
207-
run: |
208-
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
224+
- name: Install dependencies
225+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
209226

210-
- name: Psalm
211-
run: psalm --output-format=github
227+
- name: Run psalm
228+
run: vendor/bin/psalm.phar
212229

213230
bc_check:
214231
name: BC Check
215232
runs-on: ubuntu-latest
216-
needs: [setup, phpunit]
233+
needs: [phpunit]
217234
steps:
218235
- uses: actions/checkout@v2
219236
- name: fetch tags
220237
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
238+
- name: composer
239+
uses: docker://composer
240+
env:
241+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
242+
with:
243+
args: install --no-interaction --prefer-dist --optimize-autoloader
221244
- name: Restore/cache vendor folder
222245
uses: actions/cache@v2
223246
with:
@@ -232,7 +255,7 @@ jobs:
232255
profile:
233256
runs-on: ubuntu-latest
234257
name: profile
235-
needs: [setup, phpunit]
258+
needs: [phpunit]
236259
services:
237260
blackfire:
238261
image: blackfire/blackfire

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ phpstan:
2525

2626
.PHONY: psalm
2727
psalm:
28-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/psalm
28+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.3 vendor/bin/psalm.phar
2929

3030
.PHONY: test
3131
test:

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"phpdocumentor/reflection-common": "^2.0"
1515
},
1616
"require-dev": {
17-
"ext-tokenizer": "*"
17+
"ext-tokenizer": "*",
18+
"psalm/phar": "^4.8"
1819
},
1920
"autoload": {
2021
"psr-4": {

composer.lock

Lines changed: 40 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phive.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
33
<phar name="phpunit" version="^8.4" installed="8.4.3" location="./tools/phpunit" copy="true"/>
4-
<phar name="psalm" version="^3.7.2" installed="3.16" location="./tools/psalm" copy="true"/>
54
</phive>

0 commit comments

Comments
 (0)