Skip to content

Commit f44fd3a

Browse files
committed
Composite action for downgrading code
1 parent d393a1d commit f44fd3a

File tree

4 files changed

+36
-67
lines changed

4 files changed

+36
-67
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Downgrade code'
2+
description: 'Downgrade code'
3+
inputs:
4+
php-version:
5+
description: 'Original PHP version'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
11+
- name: "Change to simple-downgrade PHP version"
12+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
13+
uses: "shivammathur/setup-php@v2"
14+
with:
15+
coverage: "none"
16+
php-version: "8.4"
17+
18+
- name: "Transform source code"
19+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
20+
shell: bash
21+
run: |
22+
composer install --no-interaction --no-progress --working-dir=compiler
23+
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ inputs.php-version }}
24+
composer dump
25+
26+
- name: "Re-store PHP version"
27+
if: inputs.php-version == '7.4' || inputs.php-version == '8.0' || inputs.php-version == '8.1'
28+
uses: "shivammathur/setup-php@v2"
29+
with:
30+
coverage: "none"
31+
php-version: "${{ inputs.php-version }}"
32+
ini-file: development
33+
extensions: ds,mbstring

.github/workflows/lint.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,8 @@ jobs:
4646

4747
- uses: "ramsey/composer-install@v3"
4848

49-
- name: "Change to simple-downgrade PHP version"
50-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
51-
uses: "shivammathur/setup-php@v2"
52-
with:
53-
coverage: "none"
54-
php-version: "8.4"
55-
56-
- name: "Transform source code"
57-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
58-
run: |
59-
composer install --no-interaction --no-progress --working-dir=compiler
60-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
61-
composer dump
62-
63-
- name: "Re-store PHP version"
64-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
65-
uses: "shivammathur/setup-php@v2"
49+
- uses: ./.github/actions/downgrade-code
6650
with:
67-
coverage: "none"
6851
php-version: "${{ matrix.php-version }}"
6952

7053
- name: "Validate Composer"

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,9 @@ jobs:
5656

5757
- uses: "ramsey/composer-install@v3"
5858

59-
- name: "Change to simple-downgrade PHP version"
60-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
61-
uses: "shivammathur/setup-php@v2"
62-
with:
63-
coverage: "none"
64-
php-version: "8.4"
65-
ini-file: development
66-
extensions: mbstring
67-
68-
- name: "Transform source code"
69-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
70-
shell: bash
71-
run: |
72-
composer install --no-interaction --no-progress --working-dir=compiler
73-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
74-
composer dump
75-
76-
- name: "Re-store PHP version"
77-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
78-
uses: "shivammathur/setup-php@v2"
59+
- uses: ./.github/actions/downgrade-code
7960
with:
80-
coverage: "none"
8161
php-version: "${{ matrix.php-version }}"
82-
ini-file: development
83-
extensions: mbstring
8462

8563
- name: "PHPStan"
8664
run: "make phpstan"

.github/workflows/tests.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -191,34 +191,9 @@ jobs:
191191
shell: bash
192192
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"
193193

194-
- name: "Change to simple-downgrade PHP version"
195-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
196-
uses: "shivammathur/setup-php@v2"
197-
with:
198-
coverage: "none"
199-
php-version: "8.4"
200-
tools: pecl
201-
extensions: ds,mbstring
202-
ini-file: development
203-
ini-values: memory_limit=2G
204-
205-
- name: "Transform source code"
206-
shell: bash
207-
run: |
208-
composer install --no-interaction --no-progress --working-dir=compiler
209-
./compiler/vendor/bin/simple-downgrade downgrade -c build/downgrade.php ${{ matrix.php-version }}
210-
composer dump
211-
212-
- name: "Re-store PHP version"
213-
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
214-
uses: "shivammathur/setup-php@v2"
194+
- uses: ./.github/actions/downgrade-code
215195
with:
216-
coverage: "none"
217196
php-version: "${{ matrix.php-version }}"
218-
tools: pecl
219-
extensions: ds,mbstring
220-
ini-file: development
221-
ini-values: memory_limit=2G
222197

223198
- name: "Tests"
224199
run: "make tests"

0 commit comments

Comments
 (0)