-
Notifications
You must be signed in to change notification settings - Fork 123
157 lines (135 loc) · 5.07 KB
/
code_quality.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
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:
# Higher matching version 4.6.1 of magento/magento2-functional-testing-framework was found in public repository packagist.org
# than 4.4.2 in private https://mirror.mage-os.org. Public package might've been taken over by a malicious entity,
# please investigate and update package requirement to match the version from the private repository
#- magento: "2.4.3-p3"
# php: "7.4"
# composer: "v1"
# elasticsearch: "7.10.2"
- magento: "2.4.4"
php: "8.1"
composer: "v2"
opensearch: "1.2.0"
- magento: "2.4.5"
php: "8.1"
composer: "v2"
opensearch: "1.2.0"
- magento: "2.4.6"
php: "8.2"
composer: "v2"
opensearch: "2.5.0"
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
- 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: Setup Magento 2
run: |
echo "127.0.0.1 magento2.test" | sudo tee -a /etc/hosts && \
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-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