11name : CI
22
3- on : [push]
3+ on : [push, pull_request]
4+
5+ permissions :
6+ contents : read
7+ actions : read
8+ id-token : none
49
510jobs :
611 composer :
712 runs-on : ubuntu-latest
813 strategy :
914 matrix :
10- php : [ 8.1 , 8.2 ]
15+ php : [ 8.3 , 8.4 ]
1116
1217 steps :
13- - uses : actions/checkout@v3
18+ - uses : actions/checkout@v4
1419
1520 - name : Cache Composer dependencies
16- uses : actions/cache@v3
21+ uses : actions/cache@v4
1722 with :
1823 path : /tmp/composer-cache
19- key : ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
24+ key : ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
2025
2126 - name : Composer install
2227 uses : php-actions/composer@v6
2328 with :
2429 php_version : ${{ matrix.php }}
2530
2631 - name : Archive build
27- run : mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
32+ run : mkdir /tmp/github-actions/ && tar --exclude=".git" - cvf /tmp/github-actions/build.tar ./
2833
2934 - name : Upload build archive for test runners
30- uses : actions/upload-artifact@v3
35+ uses : actions/upload-artifact@v4
3136 with :
32- name : build-artifact
37+ name : build-artifact-${{ matrix.php }}
3338 path : /tmp/github-actions
3439
3540 phpunit :
3641 runs-on : ubuntu-latest
3742 needs : [ composer ]
3843 strategy :
3944 matrix :
40- php : [ 8.1 , 8.2 ]
45+ php : [ 8.3 , 8.4 ]
4146
4247 outputs :
4348 coverage : ${{ steps.store-coverage.outputs.coverage_text }}
4449
4550 steps :
46- - uses : actions/download-artifact@v3
51+ - uses : actions/download-artifact@v4
4752 with :
48- name : build-artifact
53+ name : build-artifact-${{ matrix.php }}
4954 path : /tmp/github-actions
5055
5156 - name : Extract build archive
5257 run : tar -xvf /tmp/github-actions/build.tar ./
5358
5459 - name : PHP Unit tests
55- uses : php-actions/phpunit@v3
60+ uses : php-actions/phpunit@v4
5661 env :
5762 XDEBUG_MODE : cover
5863 with :
@@ -62,40 +67,43 @@ jobs:
6267 coverage_clover : _coverage/clover.xml
6368
6469 - name : Store coverage data
65- uses : actions/upload-artifact@v3
70+ uses : actions/upload-artifact@v4
6671 with :
67- name : code-coverage
72+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
6873 path : _coverage
6974
7075 coverage :
7176 runs-on : ubuntu-latest
7277 needs : [ phpunit ]
78+ strategy :
79+ matrix :
80+ php : [ 8.3, 8.4 ]
7381
7482 steps :
75- - uses : actions/checkout@v3
83+ - uses : actions/checkout@v4
7684
77- - uses : actions/download-artifact@v3
85+ - uses : actions/download-artifact@v4
7886 with :
79- name : code-coverage
87+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
8088 path : _coverage
8189
8290 - name : Output coverage
8391 run : cat "_coverage/coverage.txt"
8492
8593 - name : Upload to Codecov
86- uses : codecov/codecov-action@v3
94+ uses : codecov/codecov-action@v5
8795
8896 phpstan :
8997 runs-on : ubuntu-latest
9098 needs : [ composer ]
9199 strategy :
92100 matrix :
93- php : [ 8.1 , 8.2 ]
101+ php : [ 8.3 , 8.4 ]
94102
95103 steps :
96- - uses : actions/download-artifact@v3
104+ - uses : actions/download-artifact@v4
97105 with :
98- name : build-artifact
106+ name : build-artifact-${{ matrix.php }}
99107 path : /tmp/github-actions
100108
101109 - name : Extract build archive
@@ -106,19 +114,18 @@ jobs:
106114 with :
107115 php_version : ${{ matrix.php }}
108116 path : src/
109- level : 6
110117
111118 phpmd :
112119 runs-on : ubuntu-latest
113120 needs : [ composer ]
114121 strategy :
115122 matrix :
116- php : [ 8.1 , 8.2 ]
123+ php : [ 8.3 , 8.4 ]
117124
118125 steps :
119- - uses : actions/download-artifact@v3
126+ - uses : actions/download-artifact@v4
120127 with :
121- name : build-artifact
128+ name : build-artifact-${{ matrix.php }}
122129 path : /tmp/github-actions
123130
124131 - name : Extract build archive
@@ -137,12 +144,12 @@ jobs:
137144 needs : [ composer ]
138145 strategy :
139146 matrix :
140- php : [ 8.1 , 8.2 ]
147+ php : [ 8.3 , 8.4 ]
141148
142149 steps :
143- - uses : actions/download-artifact@v3
150+ - uses : actions/download-artifact@v4
144151 with :
145- name : build-artifact
152+ name : build-artifact-${{ matrix.php }}
146153 path : /tmp/github-actions
147154
148155 - name : Extract build archive
@@ -158,12 +165,15 @@ jobs:
158165 remove_old_artifacts :
159166 runs-on : ubuntu-latest
160167
168+ permissions :
169+ actions : write
170+
161171 steps :
162172 - name : Remove old artifacts for prior workflow runs on this repository
163173 env :
164174 GH_TOKEN : ${{ github.token }}
165175 run : |
166- gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact " | jq ".artifacts[] | select(.name == \"build-artifact\") | .id" > artifact-id-list.txt
176+ gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith( \"build-artifact\") ) | .id" > artifact-id-list.txt
167177 while read id
168178 do
169179 echo -n "Deleting artifact ID $id ... "
0 commit comments