forked from tkotosz/BehatMagento2Extension
-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (125 loc) · 4.89 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
name: "CI"
on:
pull_request:
push:
branches:
- "master"
jobs:
behat:
name: "Acceptance Tests"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
- "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: magentodb
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
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
DISABLE_SECURITY_PLUGIN: true
ports:
- "8892:9200"
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" --db-host 127.0.0.1 --db-name magento --db-user magento --db-password magento --session-save files --use-rewrites 1 --use-secure 0 --opensearch-host="opensearch" --opensearch-port="9200" --timezone="Europe/Amsterdam" -vvv
bin/magento setup:upgrade
working-directory: 'magento'
- name: "Install Behat Magento 2 Extension in the Magento 2 Test Environment"
run: |
composer config repositories.behat-m2-extension path vendor/seec/behat-magento2-extension
composer require --dev 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: "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: "Check code style"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
- "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"
run: "vendor/bin/ecs check src/ features/ tests/ --no-interaction --no-progress-bar"
- name: "PhpStan for Src and Feature Contexts"
run: "vendor/bin/phpstan analyse --error-format=checkstyle src/ features/ --level=8 | cs2pr"
- name: "PhpStan for Test"
run: "vendor/bin/phpstan analyse --error-format=checkstyle tests/ --level=6 | cs2pr"