-
Notifications
You must be signed in to change notification settings - Fork 18
280 lines (241 loc) · 8.54 KB
/
main.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
name: oxid module tests
on:
push:
branches:
- '*'
- '!b-6.3.x'
jobs:
install:
strategy:
matrix:
php: [ 7.4 ]
oxid: [ 6.3 ]
runs-on: ubuntu-latest
container:
image: oxidprojects/oxid-apache-php:oxid${{ matrix.oxid }}-php${{ matrix.php }}
options: --tmpfs=/build:noatime
env:
MODULE_NAME: oxid-solution-catalysts/paypal-module
steps:
- uses: actions/checkout@v3
- name: install
run: composer create-project oxid-professional-services/test-oxid /build/oxid dev-oxid${{matrix.oxid}} --no-interaction -s dev --repository="{\"url\":\"https://github.com/keywan-ghadami-oxid/test-oxid.git\", \"type\":\"vcs\"}" --remove-vcs
- name: move artifacts to projects folder
run: |
mkdir -p /build/oxid/project-modules/module-under-test && cp -r * /build/oxid/project-modules/module-under-test
- name: Checkout paypal-client repo
uses: actions/checkout@v3
with:
repository: OXID-eSales/paypal-client
ref: v1.0.3
path: paypal-client
- name: move paypal-client to projects folder
run: |
cp -r paypal-client/ /build/oxid/project-modules/
- name: add project module folder
run:
composer config repositories.build path /build/oxid/project-modules/\*
working-directory: /build/oxid
- name: require module
run: composer require --no-interaction $MODULE_NAME
working-directory: /build/oxid
- name: move config to source folder
run: cp config.inc.php-dist source/config.inc.php
working-directory: /build/oxid
- name: zip temp artifact
run: tar czf /build/oxid.tar.gz --directory /build oxid
- name: Upload oxid-with-deps
uses: actions/upload-artifact@v3
with:
name: oxid${{ matrix.oxid }}-php${{ matrix.php }}-with-deps
path: /build/oxid.tar.gz
static_code_checks:
strategy:
matrix:
php: [ 7.4 ]
oxid: [ 6.3 ]
runs-on: ubuntu-latest
needs: install
container:
image: oxidprojects/oxid-apache-php:oxid${{ matrix.oxid }}-php${{ matrix.php }}
options: --tmpfs=/build:exec,noatime
steps:
- name: Download oxid installation
uses: actions/download-artifact@v3
with:
name: oxid${{ matrix.oxid }}-php${{ matrix.php }}-with-deps
path: /build
- name: extract oxid installation
run: |
tar xzf oxid.tar.gz
working-directory: /build/
- name: prepare autoload
run: composer update
working-directory: /build/oxid/vendor/oxid-solution-catalysts/paypal-module/
- name: run psalm
run: composer psalm-report
working-directory: /build/oxid/vendor/oxid-solution-catalysts/paypal-module/
- name: Save psalm logs
if: always()
uses: actions/upload-artifact@v3
with:
name: psalm-log
path: /build/oxid/vendor/oxid-solution-catalysts/paypal-module/logs/psalm.sonarqube.json
codestyle_checks:
strategy:
matrix:
php: [ 7.4 ]
oxid: [ 6.3 ]
runs-on: ubuntu-latest
needs: install
container:
image: oxidprojects/oxid-apache-php:oxid${{ matrix.oxid }}-php${{ matrix.php }}
steps:
- name: Download oxid installation
uses: actions/download-artifact@v3
with:
name: oxid${{ matrix.oxid }}-php${{ matrix.php }}-with-deps
path: /build
- name: extract oxid installation
run: |
tar xzf oxid.tar.gz
working-directory: /build/
- name: prepare autoload
run: composer update
working-directory: /build/oxid/vendor/oxid-solution-catalysts/paypal-module/
- name: run phpcs
run: composer phpcs
working-directory: /build/oxid/vendor/oxid-solution-catalysts/paypal-module/
oxid_unit_tests:
strategy:
matrix:
php: [ 7.4 ]
oxid: [ 6.3 ]
runs-on: ubuntu-latest
needs: install
env:
MYSQL_DATABASE: oxid
MYSQL_HOST: db
MYSQL_USER: root
MYSQL_PASSWORD: root
SHOP_URL: http://localhost/
services:
db:
image: mariadb:10.5
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: oxid
ports:
- 3306
options: --tmpfs=/tmp:noatime --tmpfs=/var/lib/mysql:noatime --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
container:
image: oxidprojects/oxid-apache-php:oxid${{ matrix.oxid }}-php${{ matrix.php }}
options: --tmpfs=/build:exec,noatime
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: oxid${{ matrix.oxid }}-php${{ matrix.php }}-with-deps
path: /build
- name: extract temp artifact
run: |
tar xzf oxid.tar.gz
working-directory: /build/
- name: mysql shema
run: mysql -u $MYSQL_USER -h db -p$MYSQL_PASSWORD $MYSQL_DATABASE < "vendor/oxid-esales/oxideshop-ce/source/Setup/Sql/database_schema.sql"
working-directory: /build/oxid
- name: mysql data
run: mysql -u $MYSQL_USER -h db -p$MYSQL_PASSWORD $MYSQL_DATABASE < "vendor/oxid-esales/oxideshop-ce/source/Setup/Sql/initial_data.sql"
working-directory: /build/oxid
- name: console
run: vendor/bin/oe-console oe:module:install-configuration source/modules/osc/paypal/
working-directory: /build/oxid
- name: console
run: vendor/bin/oe-console oe:module:apply-configuration
working-directory: /build/oxid
- name: console
run: vendor/bin/oe-eshop-db_migrate migrations:migrate
working-directory: /build/oxid
- name: console
run: vendor/bin/oe-eshop-db_views_generate
working-directory: /build/oxid
- name: console
run: vendor/bin/oe-console oe:module:activate osc-paypal
working-directory: /build/oxid
- name: check mod config
run: cat var/configuration/shops/1.yaml
working-directory: /build/oxid
- name: composer validate
run: composer validate
working-directory: /build/oxid
- name: oxid config
run: cat source/config.inc.php
working-directory: /build/oxid
- name: run unit tests
run: |
XDEBUG_MODE=coverage php vendor/bin/phpunit \
--bootstrap vendor/oxid-esales/testing-library/bootstrap.php \
-c /build/oxid/vendor/oxid-solution-catalysts/paypal-module/tests/phpunit.xml \
--coverage-clover=/build/oxid/logs/clover.xml \
--coverage-text \
--log-junit /build/oxid/logs/phpunit.xml
working-directory: /build/oxid
- name: Save logs
uses: actions/upload-artifact@v3
with:
name: logs
path: /build/oxid/logs
sonarcloud:
needs: [oxid_unit_tests, static_code_checks]
runs-on: ubuntu-latest
if: always() && (needs.oxid_unit_tests.result != 'failure')
steps:
- name: Checkout module
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: List
run: |
pwd
ls -alh
- name: Load phpunit logs
uses: actions/download-artifact@v3
with:
name: logs
path: logs
- name: Load psalm logs
uses: actions/download-artifact@v3
with:
name: psalm-log
path: logs/
- name: Fix phpunit logs
run: |
ls -alh logs
sed -i 's+/build/oxid/project-modules/module-under-test/++gI' logs/clover.xml
sed -i 's+/build/oxid/project-modules/module-under-test/++gI' logs/phpunit.xml
- name: Save logs
uses: actions/upload-artifact@v3
with:
name: logs-adjusted
path: logs
- name: Show logs
run: |
ls -alh logs
cat logs/clover.xml
cat logs/phpunit.xml
cat logs/psalm.sonarqube.json
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.sources=src
-Dsonar.tests=Tests
-Dsonar.sourceEncoding=UTF-8
-Dsonar.php.coverage.reportPaths=logs/clover.xml
-Dsonar.php.tests.reportPath=logs/phpunit.xml
-Dsonar.php.psalm.reportPaths=logs/psalm.sonarqube.json
-Dsonar.cpd.php.minimumTokens=30
-Dsonar.cpd.php.minimumLines=6