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.1, 8.2, 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
- env :
24
- COMPOSER_ROOT_VERSION : dev-master
25
28
with :
26
29
php_version : ${{ matrix.php }}
27
30
28
31
- name : Archive build
29
- 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 ./
30
33
31
34
- name : Upload build archive for test runners
32
- uses : actions/upload-artifact@v3
35
+ uses : actions/upload-artifact@v4
33
36
with :
34
- name : build-artifact
37
+ name : build-artifact-${{ matrix.php }}
35
38
path : /tmp/github-actions
36
39
37
40
phpunit :
38
41
runs-on : ubuntu-latest
39
42
needs : [ composer ]
40
43
strategy :
41
44
matrix :
42
- php : [ 8.1, 8.2 ]
45
+ php : [ 8.1, 8.2, 8.3, 8.4 ]
43
46
44
47
outputs :
45
48
coverage : ${{ steps.store-coverage.outputs.coverage_text }}
46
49
47
50
steps :
48
- - uses : actions/download-artifact@v3
51
+ - uses : actions/download-artifact@v4
49
52
with :
50
- name : build-artifact
53
+ name : build-artifact-${{ matrix.php }}
51
54
path : /tmp/github-actions
52
55
53
56
- name : Extract build archive
54
57
run : tar -xvf /tmp/github-actions/build.tar ./
55
58
56
59
- name : PHP Unit tests
57
- uses : php-actions/phpunit@v3
60
+ uses : php-actions/phpunit@v4
58
61
env :
59
62
XDEBUG_MODE : cover
60
63
with :
61
- version : " 10.1"
62
64
php_version : ${{ matrix.php }}
63
65
php_extensions : xdebug
64
66
coverage_text : _coverage/coverage.txt
65
67
coverage_clover : _coverage/clover.xml
66
68
67
69
- name : Store coverage data
68
- uses : actions/upload-artifact@v3
70
+ uses : actions/upload-artifact@v4
69
71
with :
70
- name : code-coverage
72
+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
71
73
path : _coverage
72
74
73
75
coverage :
74
76
runs-on : ubuntu-latest
75
77
needs : [ phpunit ]
78
+ strategy :
79
+ matrix :
80
+ php : [ 8.1, 8.2, 8.3, 8.4 ]
76
81
77
82
steps :
78
- - uses : actions/checkout@v3
83
+ - uses : actions/checkout@v4
79
84
80
- - uses : actions/download-artifact@v3
85
+ - uses : actions/download-artifact@v4
81
86
with :
82
- name : code-coverage
87
+ name : code-coverage-${{ matrix.php }}-${{ github.run_number }}
83
88
path : _coverage
84
89
85
90
- name : Output coverage
86
91
run : cat "_coverage/coverage.txt"
87
92
88
93
- name : Upload to Codecov
89
- uses : codecov/codecov-action@v3
94
+ uses : codecov/codecov-action@v5
90
95
91
96
phpstan :
92
97
runs-on : ubuntu-latest
93
98
needs : [ composer ]
94
99
strategy :
95
100
matrix :
96
- php : [ 8.1, 8.2 ]
101
+ php : [ 8.1, 8.2, 8.3, 8.4 ]
97
102
98
103
steps :
99
- - uses : actions/download-artifact@v3
104
+ - uses : actions/download-artifact@v4
100
105
with :
101
- name : build-artifact
106
+ name : build-artifact-${{ matrix.php }}
102
107
path : /tmp/github-actions
103
108
104
109
- name : Extract build archive
@@ -107,22 +112,21 @@ jobs:
107
112
- name : PHP Static Analysis
108
113
uses : php-actions/phpstan@v3
109
114
with :
110
- version : " 1.12.6"
111
115
php_version : ${{ matrix.php }}
112
116
path : src/
113
- level : 7
117
+ configuration : phpstan.neon
114
118
115
119
phpmd :
116
120
runs-on : ubuntu-latest
117
121
needs : [ composer ]
118
122
strategy :
119
123
matrix :
120
- php : [ 8.1, 8.2 ]
124
+ php : [ 8.1, 8.2, 8.3, 8.4 ]
121
125
122
126
steps :
123
- - uses : actions/download-artifact@v3
127
+ - uses : actions/download-artifact@v4
124
128
with :
125
- name : build-artifact
129
+ name : build-artifact-${{ matrix.php }}
126
130
path : /tmp/github-actions
127
131
128
132
- name : Extract build archive
@@ -141,12 +145,12 @@ jobs:
141
145
needs : [ composer ]
142
146
strategy :
143
147
matrix :
144
- php : [ 8.1, 8.2 ]
148
+ php : [ 8.1, 8.2, 8.3, 8.4 ]
145
149
146
150
steps :
147
- - uses : actions/download-artifact@v3
151
+ - uses : actions/download-artifact@v4
148
152
with :
149
- name : build-artifact
153
+ name : build-artifact-${{ matrix.php }}
150
154
path : /tmp/github-actions
151
155
152
156
- name : Extract build archive
@@ -162,12 +166,15 @@ jobs:
162
166
remove_old_artifacts :
163
167
runs-on : ubuntu-latest
164
168
169
+ permissions :
170
+ actions : write
171
+
165
172
steps :
166
173
- name : Remove old artifacts for prior workflow runs on this repository
167
174
env :
168
175
GH_TOKEN : ${{ github.token }}
169
176
run : |
170
- gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact " | jq ".artifacts[] | select(.name == \"build-artifact\") | .id" > artifact-id-list.txt
177
+ gh api "/repos/${{ github.repository }}/actions/artifacts" | jq ".artifacts[] | select(.name | startswith( \"build-artifact\") ) | .id" > artifact-id-list.txt
171
178
while read id
172
179
do
173
180
echo -n "Deleting artifact ID $id ... "
0 commit comments