forked from tkotosz/BehatMagento2Extension
-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (152 loc) · 5.71 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
name: "CI"
on:
pull_request:
push:
branches:
- "master"
jobs:
behat:
name: "Acceptance Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
env:
M2_INSTANCE_ROOT_DIR: ${{ github.workspace }}/magento
services:
mysql:
image: mariadb:10.6
env:
MYSQL_USER: magento
MYSQL_PASSWORD: magento
MYSQL_DATABASE: magento
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping"
opensearch:
image: opensearchproject/opensearch:2.7.0
ports:
- 9200:9200
env:
discovery.type: single-node
cluster.name: opensearch-cluster
node.name: opensearch-node
bootstrap.memory_lock: true
OPENSEARCH_JAVA_OPTS: -Xms512m -Xmx512m
DISABLE_INSTALL_DEMO_CONFIG: true
plugins.security.disabled: true
plugins.security.ssl.http.enabled: false
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: none
php-version: "${{ matrix.php-version }}"
extensions: bcmath, ctype, curl, dom, gd, hash, iconv, intl, mbstring, openssl, pdo_mysql, simplexml, soap, xsl, zip, sockets
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
- name: "Setup Composer Auth"
run: "echo $COMPOSER_AUTH_JSON > ~/.composer/auth.json"
env:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
magento
key: "magento-2.4.6-with-php-${{ matrix.php-version }}"
- name: "Create Magento 2.4.6 project with testing dependencies"
run: |
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.4.6 magento
if: hashFiles('magento/composer.json') == ''
- name: "Checkout"
uses: "actions/checkout@v2"
with:
path: 'magento/vendor/seec/behat-magento2-extension'
- name: "Install Magento"
run: |
rm -f app/etc/env.php
mkdir -p pub/static pub/media
bin/magento setup:install \
--admin-email="magento@magento.com" \
--admin-firstname="admin" \
--admin-lastname="admin" \
--admin-password="admin123!#" \
--admin-user="admin" \
--backend-frontname="admin" \
--base-url="http://magento.test" \
--cleanup-database \
--db-host="127.0.0.1" \
--db-name="magento" \
--db-password="magento" \
--db-user="magento" \
--opensearch-host="127.0.0.1" \
--opensearch-port=9200 \
--search-engine="opensearch" \
--session-save="files" \
--skip-db-validation \
--timezone="Europe/Amsterdam" \
--use-rewrites=1 \
--use-secure-admin=0 \
--use-secure=0 \
-vvv
bin/magento setup:upgrade
working-directory: 'magento'
- name: "Install Behat Magento 2 Extension in the Magento 2 Test Environment"
run: |
composer config minimum-stability dev
composer config repositories.behat-m2-extension path vendor/seec/behat-magento2-extension
composer require seec/behat-magento2-extension:@dev
working-directory: 'magento'
- name: "Install Behat Magento 2 Extension's testing dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
working-directory: 'magento/vendor/seec/behat-magento2-extension'
- name: "PhpStan for Src and Feature Contexts"
run: "vendor/bin/phpstan analyse --error-format=checkstyle src/ features/ --level=8 | cs2pr"
working-directory: 'magento/vendor/seec/behat-magento2-extension'
- name: "PhpStan for Test"
run: "vendor/bin/phpstan analyse --error-format=checkstyle tests/ --level=6 | cs2pr"
working-directory: 'magento/vendor/seec/behat-magento2-extension'
- name: "Run full test suite"
run: "vendor/bin/behat --tags=@virtual --stop-on-failure --config behat.yml"
working-directory: 'magento/vendor/seec/behat-magento2-extension'
code-style:
name: "CodeStyle + UnitTests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Setup Composer Auth"
run: "echo $COMPOSER_AUTH_JSON > ~/.composer/auth.json"
env:
COMPOSER_AUTH_JSON: ${{ secrets.COMPOSER_AUTH_JSON }}
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: none
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "EasyCodingStandards for Src, Features and Tests"
run: "vendor/bin/ecs check src/ features/ tests/ --no-interaction --no-progress-bar"
- name: "Run unit tests"
run: "vendor/bin/phpunit tests/"