1
1
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2
2
3
3
on :
4
- - " pull_request"
5
- - " push"
4
+ - pull_request
5
+ - push
6
6
7
- name : " CI"
7
+ name : CI
8
+
9
+ env :
10
+ COMPOSER_ROOT_VERSION : 6.0.x-dev
11
+ PHP_VERSION : 8.4
8
12
9
13
permissions :
10
14
contents : read
11
15
12
- env :
13
- COMPOSER_ROOT_VERSION : " 6.0.x-dev"
14
-
15
16
jobs :
16
17
coding-guidelines :
17
18
name : Coding Guidelines
18
19
19
20
runs-on : ubuntu-latest
21
+ timeout-minutes : 5
20
22
21
23
steps :
22
24
- name : Checkout
23
- uses : actions/checkout@v4
25
+ uses : actions/checkout@v5
26
+ with :
27
+ fetch-depth : 1
28
+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
29
+
30
+ - name : Use local branch
31
+ shell : bash
32
+ run : |
33
+ BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
34
+ git branch -D $BRANCH 2>/dev/null || true
35
+ git branch $BRANCH HEAD
36
+ git checkout $BRANCH
24
37
25
38
- name : Install PHP
26
39
uses : shivammathur/setup-php@v2
27
40
with :
28
- php-version : 8.3
41
+ php-version : ${{ env.PHP_VERSION }}
29
42
coverage : none
43
+ tools : none
30
44
31
45
- name : Run PHP-CS-Fixer
32
46
run : ./tools/php-cs-fixer fix --dry-run --show-progress=dots --using-cache=no --verbose
@@ -35,16 +49,29 @@ jobs:
35
49
name : Static Analysis
36
50
37
51
runs-on : ubuntu-latest
52
+ timeout-minutes : 5
38
53
39
54
steps :
40
55
- name : Checkout
41
- uses : actions/checkout@v4
56
+ uses : actions/checkout@v5
57
+ with :
58
+ fetch-depth : 1
59
+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
60
+
61
+ - name : Use local branch
62
+ shell : bash
63
+ run : |
64
+ BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
65
+ git branch -D $BRANCH 2>/dev/null || true
66
+ git branch $BRANCH HEAD
67
+ git checkout $BRANCH
42
68
43
69
- name : Install PHP
44
70
uses : shivammathur/setup-php@v2
45
71
with :
46
- php-version : 8.3
72
+ php-version : ${{ env.PHP_VERSION }}
47
73
coverage : none
74
+ tools : none
48
75
49
76
- name : Install dependencies with Composer
50
77
run : ./tools/composer update --no-interaction --no-ansi --no-progress
@@ -56,40 +83,120 @@ jobs:
56
83
name : Tests
57
84
58
85
runs-on : ubuntu-latest
86
+ timeout-minutes : 5
59
87
60
88
strategy :
61
89
fail-fast : false
62
90
matrix :
63
91
php-version :
64
- - " 8.2"
65
- - " 8.3"
66
- - " 8.4"
67
- - " 8.5"
92
+ - 8.2
93
+ - 8.3
94
+ - 8.4
95
+ - 8.5
96
+ - 8.6
68
97
69
98
steps :
70
- - name : " Checkout"
71
- uses : " actions/checkout@v4"
99
+ - name : Checkout
100
+ uses : actions/checkout@v5
101
+ with :
102
+ fetch-depth : 1
103
+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
104
+
105
+ - name : Use local branch
106
+ shell : bash
107
+ run : |
108
+ BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
109
+ git branch -D $BRANCH 2>/dev/null || true
110
+ git branch $BRANCH HEAD
111
+ git checkout $BRANCH
112
+
113
+ - name : Install PHP with extensions
114
+ uses : shivammathur/setup-php@v2
115
+ with :
116
+ php-version : ${{ matrix.php-version }}
117
+ coverage : none
118
+ tools : none
119
+
120
+ - name : Get Composer cache directory
121
+ id : composer-cache
122
+ shell : bash
123
+ run : |
124
+ echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
72
125
73
- - name : " Install PHP with extensions "
74
- uses : " shivammathur/setup-php@v2 "
126
+ - name : Cache Composer cache directory
127
+ uses : actions/cache@v4
75
128
with :
76
- php-version : " ${{ matrix.php-version }}"
77
- coverage : " xdebug "
78
- ini-values : memory_limit=-1
129
+ path : ${{ steps.composer-cache.outputs.dir }}
130
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
131
+ restore-keys : ${{ runner.os }}-composer-
79
132
80
- - name : " Install dependencies with Composer"
81
- run : " ./tools/composer update --no-ansi --no-interaction --no-progress"
133
+ - name : Install dependencies with Composer
134
+ run : ./tools/composer update --no-ansi --no-interaction --no-progress
135
+
136
+ - name : Run tests with PHPUnit
137
+ run : vendor/bin/phpunit
138
+
139
+ code-coverage :
140
+ name : Code Coverage
141
+
142
+ needs :
143
+ - tests
144
+
145
+ runs-on : ubuntu-latest
146
+ timeout-minutes : 5
147
+
148
+ steps :
149
+ - name : Checkout
150
+ uses : actions/checkout@v5
151
+ with :
152
+ fetch-depth : 1
153
+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
154
+
155
+ - name : Use local branch
156
+ shell : bash
157
+ run : |
158
+ BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
159
+ git branch -D $BRANCH 2>/dev/null || true
160
+ git branch $BRANCH HEAD
161
+ git checkout $BRANCH
162
+
163
+ - name : Install PHP with extensions
164
+ uses : shivammathur/setup-php@v2
165
+ with :
166
+ php-version : ${{ matrix.php-version }}
167
+ coverage : xdebug
168
+ tools : none
169
+
170
+ - name : Get Composer cache directory
171
+ id : composer-cache
172
+ shell : bash
173
+ run : |
174
+ echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
175
+
176
+ - name : Cache Composer cache directory
177
+ uses : actions/cache@v4
178
+ with :
179
+ path : ${{ steps.composer-cache.outputs.dir }}
180
+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
181
+ restore-keys : ${{ runner.os }}-composer-
182
+
183
+ - name : Install dependencies with Composer
184
+ run : ./tools/composer update --no-ansi --no-interaction --no-progress
82
185
83
- - name : " Run tests with PHPUnit"
84
- run : " vendor/bin/phpunit --log-junit junit .xml --coverage-clover=coverage.xml"
186
+ - name : Collect code coverage with PHPUnit
187
+ run : vendor/bin/phpunit --log-junit test-results .xml --coverage-clover=code- coverage.xml
85
188
86
189
- name : Upload test results to Codecov.io
87
190
if : ${{ !cancelled() }}
88
191
uses : codecov/test-results-action@v1
89
192
with :
90
193
token : ${{ secrets.CODECOV_TOKEN }}
194
+ disable_search : true
195
+ files : ./test-results.xml
91
196
92
197
- name : Upload code coverage data to Codecov.io
93
198
uses : codecov/codecov-action@v4
94
199
with :
95
200
token : ${{ secrets.CODECOV_TOKEN }}
201
+ disable_search : true
202
+ files : ./code-coverage.xml
0 commit comments