Skip to content

Commit 7776279

Browse files
authored
Faster code downgrade to speedup CI
1 parent c82e555 commit 7776279

File tree

6 files changed

+69
-133
lines changed

6 files changed

+69
-133
lines changed

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,27 @@ jobs:
4747
- name: "Install dependencies"
4848
run: "composer install --no-interaction --no-progress"
4949

50+
- name: "Change to simple-downgrade PHP version"
51+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
52+
uses: "shivammathur/setup-php@v2"
53+
with:
54+
coverage: "none"
55+
php-version: "8.4"
56+
5057
- name: "Transform source code"
5158
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
5259
run: |
5360
composer install --no-interaction --no-progress --working-dir=compiler
5461
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
5562
composer dump
5663
64+
- name: "Re-store PHP version"
65+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
66+
uses: "shivammathur/setup-php@v2"
67+
with:
68+
coverage: "none"
69+
php-version: "${{ matrix.php-version }}"
70+
5771
- name: "Validate Composer"
5872
run: "composer validate"
5973

.github/workflows/static-analysis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ jobs:
5757
- name: "Install dependencies"
5858
run: "composer install --no-interaction --no-progress"
5959

60+
- name: "Change to simple-downgrade PHP version"
61+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
62+
uses: "shivammathur/setup-php@v2"
63+
with:
64+
coverage: "none"
65+
php-version: "8.4"
66+
ini-file: development
67+
extensions: mbstring
68+
6069
- name: "Transform source code"
6170
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
6271
shell: bash
@@ -65,6 +74,15 @@ jobs:
6574
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
6675
composer dump
6776
77+
- name: "Re-store PHP version"
78+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
79+
uses: "shivammathur/setup-php@v2"
80+
with:
81+
coverage: "none"
82+
php-version: "${{ matrix.php-version }}"
83+
ini-file: development
84+
extensions: mbstring
85+
6886
- name: "PHPStan"
6987
run: "make phpstan"
7088

.github/workflows/tests.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,34 @@ jobs:
187187
shell: bash
188188
run: "composer require --dev phpunit/phpunit:^9.6 brianium/paratest:^6.5 symfony/console:^5.4 symfony/process:^5.4 --update-with-dependencies --ignore-platform-reqs --working-dir=tests"
189189

190+
- name: "Change to simple-downgrade PHP version"
191+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
192+
uses: "shivammathur/setup-php@v2"
193+
with:
194+
coverage: "none"
195+
php-version: "8.4"
196+
tools: pecl
197+
extensions: ds,mbstring
198+
ini-file: development
199+
ini-values: memory_limit=2G
200+
190201
- name: "Transform source code"
191202
shell: bash
192203
run: |
193204
composer install --no-interaction --no-progress --working-dir=compiler
194205
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
195206
composer dump
196207
208+
- name: "Re-store PHP version"
209+
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
210+
uses: "shivammathur/setup-php@v2"
211+
with:
212+
coverage: "none"
213+
php-version: "${{ matrix.php-version }}"
214+
tools: pecl
215+
extensions: ds,mbstring
216+
ini-file: development
217+
ini-values: memory_limit=2G
218+
197219
- name: "Tests"
198220
run: "make tests"

compiler/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "PHAR Compiler for PHPStan",
55
"license": ["MIT"],
66
"require": {
7-
"php": "^8.0",
7+
"php": "^8.2",
88
"nette/neon": "^3.0.0",
9-
"ondrejmirtes/simple-downgrader": "^2.2.1",
9+
"ondrejmirtes/simple-downgrader": "^2.2.2",
1010
"seld/phar-utils": "^1.2",
1111
"symfony/console": "^5.4.43",
1212
"symfony/filesystem": "^5.4.43",
@@ -30,7 +30,7 @@
3030
},
3131
"config": {
3232
"platform": {
33-
"php": "8.0.99"
33+
"php": "8.2.99"
3434
},
3535
"platform-check": false,
3636
"sort-packages": true

compiler/composer.lock

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

tests/PHPStan/Rules/TooWideTypehints/TooWideMethodReturnTypehintRuleTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ public function testBug10312b(): void
208208
$this->analyse([__DIR__ . '/data/bug-10312b.php'], []);
209209
}
210210

211+
#[RequiresPhp('>= 8.1')]
211212
public function testBug10312c(): void
212213
{
213214
$this->checkProtectedAndPublicMethods = true;
214215
$this->analyse([__DIR__ . '/data/bug-10312c.php'], []);
215216
}
216217

218+
#[RequiresPhp('>= 8.1')]
217219
public function testBug10312d(): void
218220
{
219221
$this->checkProtectedAndPublicMethods = true;

0 commit comments

Comments
 (0)