1
1
name : CI
2
2
3
- on : [push]
3
+ on : [push, pull_request]
4
+
5
+ permissions :
6
+ contents : read
7
+ actions : read
8
+ id-token : none
4
9
5
10
jobs :
6
11
composer :
7
12
runs-on : ubuntu-latest
8
13
strategy :
9
14
matrix :
10
- php : [ 8.1 , 8.2 ]
15
+ php : [ 8.3 , 8.4 ]
11
16
12
17
steps :
13
- - uses : actions/checkout@v3
18
+ - uses : actions/checkout@v4
14
19
15
20
- name : Cache Composer dependencies
16
- uses : actions/cache@v3
21
+ uses : actions/cache@v4
17
22
with :
18
23
path : /tmp/composer-cache
19
- key : ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
24
+ key : ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
20
25
21
26
- name : Composer install
22
27
uses : php-actions/composer@v6
23
28
with :
24
29
php_version : ${{ matrix.php }}
25
30
26
31
- 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 ./
28
33
29
34
- name : Upload build archive for test runners
30
- uses : actions/upload-artifact@v3
35
+ uses : actions/upload-artifact@v4
31
36
with :
32
- name : build-artifact
37
+ name : build-artifact-${{ matrix.php }}
33
38
path : /tmp/github-actions
34
39
35
40
phpunit :
36
41
runs-on : ubuntu-latest
37
42
needs : [ composer ]
38
43
strategy :
39
44
matrix :
40
- php : [ 8.1 , 8.2 ]
45
+ php : [ 8.3 , 8.4 ]
41
46
42
47
outputs :
43
48
coverage : ${{ steps.store-coverage.outputs.coverage_text }}
44
49
45
50
steps :
46
- - uses : actions/download-artifact@v3
51
+ - uses : actions/download-artifact@v4
47
52
with :
48
- name : build-artifact
53
+ name : build-artifact-${{ matrix.php }}
49
54
path : /tmp/github-actions
50
55
51
56
- name : Extract build archive
52
57
run : tar -xvf /tmp/github-actions/build.tar ./
53
58
54
59
- name : PHP Unit tests
55
- uses : php-actions/phpunit@v3
60
+ uses : php-actions/phpunit@v4
56
61
env :
57
62
XDEBUG_MODE : cover
58
63
with :
@@ -62,40 +67,43 @@ jobs:
62
67
coverage_clover : _coverage/clover.xml
63
68
64
69
- name : Store coverage data
65
- uses : actions/upload-artifact@v3
70
+ uses : actions/upload-artifact@v4
66
71
with :
67
- name : code-coverage
72
+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
68
73
path : _coverage
69
74
70
75
coverage :
71
76
runs-on : ubuntu-latest
72
77
needs : [ phpunit ]
78
+ strategy :
79
+ matrix :
80
+ php : [ 8.3, 8.4 ]
73
81
74
82
steps :
75
- - uses : actions/checkout@v3
83
+ - uses : actions/checkout@v4
76
84
77
- - uses : actions/download-artifact@v3
85
+ - uses : actions/download-artifact@v4
78
86
with :
79
- name : code-coverage
87
+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
80
88
path : _coverage
81
89
82
90
- name : Output coverage
83
91
run : cat "_coverage/coverage.txt"
84
92
85
93
- name : Upload to Codecov
86
- uses : codecov/codecov-action@v3
94
+ uses : codecov/codecov-action@v5
87
95
88
96
phpstan :
89
97
runs-on : ubuntu-latest
90
98
needs : [ composer ]
91
99
strategy :
92
100
matrix :
93
- php : [ 8.1 , 8.2 ]
101
+ php : [ 8.3 , 8.4 ]
94
102
95
103
steps :
96
- - uses : actions/download-artifact@v3
104
+ - uses : actions/download-artifact@v4
97
105
with :
98
- name : build-artifact
106
+ name : build-artifact-${{ matrix.php }}
99
107
path : /tmp/github-actions
100
108
101
109
- name : Extract build archive
@@ -106,19 +114,18 @@ jobs:
106
114
with :
107
115
php_version : ${{ matrix.php }}
108
116
path : src/
109
- level : 6
110
117
111
118
phpmd :
112
119
runs-on : ubuntu-latest
113
120
needs : [ composer ]
114
121
strategy :
115
122
matrix :
116
- php : [ 8.1 , 8.2 ]
123
+ php : [ 8.3 , 8.4 ]
117
124
118
125
steps :
119
- - uses : actions/download-artifact@v3
126
+ - uses : actions/download-artifact@v4
120
127
with :
121
- name : build-artifact
128
+ name : build-artifact-${{ matrix.php }}
122
129
path : /tmp/github-actions
123
130
124
131
- name : Extract build archive
@@ -137,12 +144,12 @@ jobs:
137
144
needs : [ composer ]
138
145
strategy :
139
146
matrix :
140
- php : [ 8.1 , 8.2 ]
147
+ php : [ 8.3 , 8.4 ]
141
148
142
149
steps :
143
- - uses : actions/download-artifact@v3
150
+ - uses : actions/download-artifact@v4
144
151
with :
145
- name : build-artifact
152
+ name : build-artifact-${{ matrix.php }}
146
153
path : /tmp/github-actions
147
154
148
155
- name : Extract build archive
@@ -158,12 +165,15 @@ jobs:
158
165
remove_old_artifacts :
159
166
runs-on : ubuntu-latest
160
167
168
+ permissions :
169
+ actions : write
170
+
161
171
steps :
162
172
- name : Remove old artifacts for prior workflow runs on this repository
163
173
env :
164
174
GH_TOKEN : ${{ github.token }}
165
175
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
167
177
while read id
168
178
do
169
179
echo -n "Deleting artifact ID $id ... "
0 commit comments