forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (195 loc) · 9.51 KB
/
packages.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
name: Packages
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- "src/Sylius/Bundle/**"
- "src/Sylius/Component/**"
- ".github/workflows/packages.yml"
pull_request:
paths:
- "src/Sylius/Bundle/**"
- "src/Sylius/Component/**"
- ".github/workflows/packages.yml"
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~
jobs:
list:
runs-on: ubuntu-latest
name: "Create a list of packages"
steps:
-
uses: actions/checkout@v3
-
name: "Provide the list"
id: create-list
run: echo "packages=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" >> $GITHUB_OUTPUT
outputs:
packages: "${{ steps.create-list.outputs.packages }}"
test:
needs: list
runs-on: ubuntu-latest
name: "${{ matrix.package }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1"]
symfony: ["^5.4", "^6.0"]
package: "${{ fromJson(needs.list.outputs.packages) }}"
swiftmailer: [false]
include:
-
php: "8.0"
symfony: "^5.4"
package: "Bundle/CoreBundle"
swiftmailer: true
-
php: "8.1"
symfony: "^5.4"
package: "Bundle/CoreBundle"
swiftmailer: true
-
php: "8.1"
symfony: "^5.4"
package: "Bundle/ApiBundle"
swiftmailer: true
-
php: "8.1"
symfony: "^5.4"
package: "Bundle/AdminBundle"
swiftmailer: true
steps:
-
uses: actions/checkout@v3
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: none
-
name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
name: Cache Composer
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-${{ hashFiles(format('src/Sylius/{0}/composer.json', matrix.package)) }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-
${{ runner.os }}-php-${{ matrix.php }}-package-
-
name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:1.18.5"
composer config extra.symfony.require "${{ matrix.symfony }}"
working-directory: "src/Sylius/${{ matrix.package }}"
-
name: Configure Swiftmailer (if needed)
working-directory: "src/Sylius/${{ matrix.package }}"
run: |
composer require --no-progress --no-update --no-scripts --no-plugins "sylius/mailer-bundle:^1.8"
composer require --no-progress --no-update --no-scripts --no-plugins "symfony/swiftmailer-bundle:^3.4"
echo "APP_ENV=test_with_swiftmailer" >> $GITHUB_ENV
if: matrix.swiftmailer == true
-
name: Validate composer.json
run: composer validate --ansi --strict
working-directory: "src/Sylius/${{ matrix.package }}"
-
name: Install dependencies
run: composer update --no-interaction --no-scripts
env:
COMPOSER_ROOT_VERSION: dev-master
working-directory: "src/Sylius/${{ matrix.package }}"
id: end-of-setup
-
name: Create empty manifest.json files (AdminBundle, CoreBundle)
working-directory: "src/Sylius/${{ matrix.package }}"
if: matrix.package == 'Bundle/AdminBundle' || matrix.package == 'Bundle/CoreBundle' || matrix.package == 'Bundle/ApiBundle'
run: |
mkdir -p test/public/build/admin test/public/build/shop
echo "{}" >> test/public/build/shop/manifest.json
echo "{}" >> test/public/build/admin/manifest.json
-
name: Run PHPArkitect
working-directory: "src/Sylius/${{ matrix.package }}"
run: vendor/phparkitect/phparkitect/bin-stub/phparkitect check
if: always() && steps.end-of-setup.outcome == 'success' && matrix.package == 'Bundle/ApiBundle'
-
name: Setup Database (for ApiBundle)
working-directory: "src/Sylius/${{ matrix.package }}"
run: test/bin/console doctrine:schema:update --force
if: matrix.package == 'Bundle/ApiBundle'
-
name: Remove Specifications not supported on Symfony >= 6.0
working-directory: "src/Sylius/${{ matrix.package }}"
if: ${{ true != contains( matrix.symfony, '^5.4' ) && matrix.package == 'Bundle/UserBundle' }}
run: |
rm spec/Security/UserPasswordEncoderSpec.php
-
name: Run PHPSpec
working-directory: "src/Sylius/${{ matrix.package }}"
run: vendor/bin/phpspec run --ansi --no-interaction -f dot
-
name: Check the existence of phpunit.xml.dist
id: phpunit_xml_dist_existence_check
uses: andstor/file-existence-action@v2
with:
files: "src/Sylius/${{ matrix.package }}/phpunit.xml.dist"
-
name: Check the existence of phpunit.xml
id: phpunit_xml_existence_check
uses: andstor/file-existence-action@v2
with:
files: "src/Sylius/${{ matrix.package }}/phpunit.xml"
-
name: Run PHPUnit
working-directory: "src/Sylius/${{ matrix.package }}"
if: steps.phpunit_xml_dist_existence_check.outputs.files_exists == 'true' || steps.phpunit_xml_existence_check.outputs.files_exists == 'true'
run: vendor/bin/phpunit --colors=always
notify-about-build-failure:
runs-on: ubuntu-latest
if: failure() && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release')
needs: [test]
name: "Notify about build failure"
timeout-minutes: 5
steps:
-
name: "Process data"
id: process-data
shell: bash
run: |
echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT
echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT
-
name: "Notify on Slack"
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: env.SLACK_WEBHOOK_URL != null
with:
channel: "#builds"
username: "GitHub Actions"
text: |
*<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ${{ github.workflow }} #${{ github.run_number }} build on ${{ github.repository }} repository has failed for ${{ steps.process-data.outputs.branch }} branch.>*
_ _ _ _ _ _ _
color: "danger"
fields: |
[
{ "title": "Repository", "value": "<https://github.com/${{ github.repository }} | ${{ github.repository }}>", "short": true },
{ "title": "Action", "value": "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ${{ github.workflow }} #${{ github.run_number }}>", "short": true },
{ "title": "Reference", "value": "<https://github.com/${{ github.repository }}/tree/${{ steps.process-data.outputs.branch }} | ${{ steps.process-data.outputs.branch }}>", "short": true },
{ "title": "Commit", "value": "<https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ${{ steps.process-data.outputs.sha }}>", "short": true },
{ "title": "Event", "value": "${{ github.event_name }}", "short": true }
]