-
Notifications
You must be signed in to change notification settings - Fork 0
254 lines (249 loc) · 8.05 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: 'Tests: Playground Test'
on:
push:
branches: [ "develop" ]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested
permissions:
contents: write
pull-requests: write
issues: write
repository-projects: write
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: Preparing timer
id: timer_start
run: |
echo "DATE_START=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT
- name: "Slack notification: IN PROGRESS"
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
payload: |
{
"text": "CI Build Status for playground-test: IN PROGRESS\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":runner: CI Build Status for playground-test"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n--"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* IN PROGRESS"
},
{
"type": "mrkdwn",
"text": ":timer_clock: --"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- uses: actions/checkout@v3
- name: Run php-actions/composer@v6
uses: php-actions/composer@v6
with:
php_version: "8.2"
php_extensions: intl
version: 2.x
- uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
version: "10.5"
php_version: "8.2"
php_extensions: intl xdebug
coverage_clover: clover.xml
coverage_text: true
- name: Make code coverage badge
uses: timkrase/[email protected]
with:
coverage_badge_path: output/coverage.svg
push_badge: false
- name: Git push to testing/develop branch
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
publish_branch: testing/develop
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- uses: php-actions/phpstan@v3
with:
level: 9
php_version: "8.2"
path: config/ database/ resources/ src/ tests/Feature/ tests/Unit/
- name: Stopping timer
if: ${{ !cancelled() }}
id: timer_end
env:
TIMESTAMP_START: ${{ steps.timer_start.outputs.TIMESTAMP_START }}
run: |
echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT
- name: "Slack notification: Done"
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"text": "CI Build Status for playground-test: DONE\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":white_check_mark: CI Build Status for playground-test"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* Success"
},
{
"type": "mrkdwn",
"text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: "Send a notification for failures"
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"text": "CI Build Status for playground-test: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":warning: CI Build Status for playground-test"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* FAILED"
},
{
"type": "mrkdwn",
"text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}