Skip to content

Commit f2d94e7

Browse files
ci(phpstan): use a matrix for phpstan jobs
This is to speed it up more.
1 parent daf5166 commit f2d94e7

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

.github/workflows/lint-and-analyse-php.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,20 @@ jobs:
129129
analyse-php:
130130
runs-on: ubuntu-latest
131131
strategy:
132+
fail-fast: false
132133
matrix:
133-
php-version: ["8.4"]
134+
include:
135+
- php-version: "8.4"
136+
stan-label: "base"
137+
composer-script: "phpstan"
138+
stan-cache-dir: "base"
139+
stan-config-file: "phpstan.neon"
140+
- php-version: "8.4"
141+
stan-label: "next"
142+
composer-script: "phpstan_next"
143+
stan-cache-dir: "next"
144+
stan-config-file: "phpstan_next.neon"
145+
name: analyse-php (${{ matrix.stan-label }})
134146
steps:
135147
- name: Checkout code
136148
uses: actions/checkout@v6
@@ -146,16 +158,13 @@ jobs:
146158
- name: Cache PHPStan result cache
147159
uses: actions/cache@v5
148160
with:
149-
path: var/cache/phpstan
150-
key: phpstan-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.lock', 'phpstan.neon', 'phpstan_next.neon') }}
161+
path: var/cache/phpstan/${{ matrix.stan-cache-dir }}
162+
key: phpstan-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.stan-cache-dir }}-${{ hashFiles('composer.lock', matrix.stan-config-file) }}
151163
restore-keys: |
152-
phpstan-${{ runner.os }}-${{ matrix.php-version }}-
164+
phpstan-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.stan-cache-dir }}-
153165
154166
- name: Analyse files with PHPStan
155-
run: composer phpstan -- --error-format=github --no-progress --memory-limit 2G
156-
157-
- name: Analyse files with PHPStan (next level)
158-
run: composer phpstan_next -- --error-format=github --no-progress --memory-limit 2G
167+
run: composer ${{ matrix.composer-script }} -- --error-format=github --no-progress --memory-limit 2G
159168

160169
# - name: Analyse files with Psalm
161170
# # Allow the previous check to fail but not abort

0 commit comments

Comments
 (0)