-
Notifications
You must be signed in to change notification settings - Fork 122
198 lines (173 loc) · 6.45 KB
/
Copy pathcode_quality.yml
File metadata and controls
198 lines (173 loc) · 6.45 KB
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
name: "Code quality"
on:
pull_request:
branches: [master]
env:
MAGENTO_CODING_STANDARD: "v30"
jobs:
static_code_check:
name: "Static code check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phpcs, cs2pr
- name: Install and setup Magento 2 coding standard
run: |
vendor_path=$(composer global config vendor-dir --absolute) && \
composer global require magento/magento-coding-standard:${{ env.MAGENTO_CODING_STANDARD }} && \
phpcs --config-set installed_paths "$vendor_path/magento/magento-coding-standard/,$vendor_path/phpcompatibility/php-compatibility/"
- name: Run phpcs
run: phpcs -n -q --report=checkstyle --standard=Magento2 . | cs2pr
tests:
name: "Tests"
runs-on: ubuntu-latest
services:
db:
image: mariadb:10.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: magento
MYSQL_USER: magento
MYSQL_PASSWORD: magento
ports:
- 33060:3306
options: >-
--health-cmd="mysqladmin -proot ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
os:
image: opensearchproject/opensearch:${{ matrix.opensearch }}
env:
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
ports:
- 9200:9200
options: >-
-e "discovery.type=single-node"
-e "plugins.security.disabled=true"
--name "opensearch-node"
--health-cmd="curl --silent --fail localhost:9200/_cluster/health || exit 1"
--health-interval=30s
--health-timeout=30s
--health-retries=8
strategy:
matrix:
# https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/system-requirements.html
include:
- magento: "2.4.5-p14"
php: "8.1"
composer: "v2"
opensearch: "1.2.0"
phpunit: "9.6.33"
search_engine: "elasticsearch7"
# - magento: "2.4.6-p13"
# php: "8.2"
# composer: "v2"
# opensearch: "2.5.0"
# phpunit: "9.6.33"
# search_engine: "elasticsearch7"
- magento: "2.4.7-p8"
php: "8.3"
composer: "v2"
opensearch: "2.5.0"
search_engine: "elasticsearch7"
- magento: "2.4.8-p3"
php: "8.4"
composer: "v2"
opensearch: "2.5.0"
search_engine: "opensearch"
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:${{ matrix.composer }}
- name: Create Magento 2 project
run: |
composer create-project --repository-url="https://mirror.mage-os.org/" \
"magento/project-community-edition=${{ matrix.magento }}" . --no-install
- name: Ignore specific security advisories
run: |
composer config --json audit.ignore '{
"PKSA-7h5p-prw9-w5nr": "advisory is time complexity related, low impact for our scenario",
"PKSA-xwpn-zs9j-6wy5": "advisory is related to recursion in parser, low impact for our scenario",
"PKSA-sf9j-1gs7-xzvx": "advisory is time complexity related, low impact for our scenario"
}'
- name: Force PHPUnit version
if: matrix.phpunit != ''
run: composer require --no-install --dev "phpunit/phpunit:${{ matrix.phpunit }}"
- run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
id: composer-cache
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Magento 2
run: composer install && mkdir -p app/code/Fastly/Cdn/
- name: Setup Fastly CDN module
uses: actions/checkout@v3
with:
path: "app/code/Fastly/Cdn/"
- name: Configure localhost
run: echo "127.0.0.1 magento2.test" | sudo tee -a /etc/hosts
- name: Setup Magento 2 with OpenSearch
if: matrix.search_engine == 'opensearch'
run: |
bin/magento setup:install \
--base-url=http://magento2.test/ \
--db-host=127.0.0.1:33060 \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Los_Angeles \
--use-rewrites=1 \
--search-engine=opensearch \
--opensearch-host=localhost \
--opensearch-port=9200 \
--opensearch-index-prefix=magento2 \
--opensearch-timeout=15
- name: Setup Magento 2 with Elasticsearch
if: matrix.search_engine == 'elasticsearch7'
run: |
bin/magento setup:install \
--base-url=http://magento2.test/ \
--db-host=127.0.0.1:33060 \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Los_Angeles \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15
- name: Verify Fastly is installed in Magento
run: bin/magento module:status --enabled | grep -q Fastly_Cdn
- name: Compile DI
run: bin/magento setup:di:compile
- name: Setup Problem Matcher for PHPUnit
run: echo "::add-matcher::${{ github.workspace }}/app/code/Fastly/Cdn/.github/tests/phpunit_matcher.json"
- name: Run tests
run: ../../../vendor/bin/phpunit -c ../unit/phpunit.xml.dist --teamcity ../../../app/code/Fastly/Cdn/
working-directory: dev/tests/integration