@@ -3,26 +3,44 @@ name: CI
33on :
44 pull_request :
55
6+ concurrency :
7+ group : pr-${{ github.event.pull_request.number }}
8+ cancel-in-progress : true
9+
610permissions :
711 contents : read
812
9- env :
10- PHP_VERSION : ' 8.5'
11-
1213jobs :
14+ load-config :
15+ name : Load config
16+ runs-on : ubuntu-latest
17+ timeout-minutes : 5
18+ outputs :
19+ php-version : ${{ steps.config.outputs.php-version }}
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Resolve PHP version from composer.json
25+ id : config
26+ run : |
27+ version=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | head -1)
28+ echo "php-version=$version" >> "$GITHUB_OUTPUT"
29+
1330 build :
1431 name : Build
32+ needs : load-config
1533 runs-on : ubuntu-latest
16-
34+ timeout-minutes : 15
1735 steps :
1836 - name : Checkout
19- uses : actions/checkout@v6
37+ uses : actions/checkout@v4
2038
21- - name : Configure PHP
39+ - name : Setup PHP
2240 uses : shivammathur/setup-php@v2
2341 with :
24- php-version : ${{ env.PHP_VERSION }}
2542 tools : composer:2
43+ php-version : ${{ needs.load-config.outputs.php-version }}
2644
2745 - name : Validate composer.json
2846 run : composer validate --no-interaction
3149 run : composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction
3250
3351 - name : Upload vendor and composer.lock as artifact
34- uses : actions/upload-artifact@v7
52+ uses : actions/upload-artifact@v4
3553 with :
3654 name : vendor-artifact
3755 path : |
@@ -40,21 +58,21 @@ jobs:
4058
4159 auto-review :
4260 name : Auto review
61+ needs : [load-config, build]
4362 runs-on : ubuntu-latest
44- needs : build
45-
63+ timeout-minutes : 15
4664 steps :
4765 - name : Checkout
48- uses : actions/checkout@v6
66+ uses : actions/checkout@v4
4967
50- - name : Configure PHP
68+ - name : Setup PHP
5169 uses : shivammathur/setup-php@v2
5270 with :
53- php-version : ${{ env.PHP_VERSION }}
5471 tools : composer:2
72+ php-version : ${{ needs.load-config.outputs.php-version }}
5573
5674 - name : Download vendor artifact from build
57- uses : actions/download-artifact@v8
75+ uses : actions/download-artifact@v4
5876 with :
5977 name : vendor-artifact
6078 path : .
@@ -64,21 +82,21 @@ jobs:
6482
6583 tests :
6684 name : Tests
85+ needs : [load-config, auto-review]
6786 runs-on : ubuntu-latest
68- needs : auto-review
69-
87+ timeout-minutes : 15
7088 steps :
7189 - name : Checkout
72- uses : actions/checkout@v6
90+ uses : actions/checkout@v4
7391
74- - name : Configure PHP
92+ - name : Setup PHP
7593 uses : shivammathur/setup-php@v2
7694 with :
77- php-version : ${{ env.PHP_VERSION }}
7895 tools : composer:2
96+ php-version : ${{ needs.load-config.outputs.php-version }}
7997
8098 - name : Download vendor artifact from build
81- uses : actions/download-artifact@v8
99+ uses : actions/download-artifact@v4
82100 with :
83101 name : vendor-artifact
84102 path : .
0 commit comments