-
Notifications
You must be signed in to change notification settings - Fork 4
167 lines (149 loc) · 6.18 KB
/
api-functional-tests.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
name: REST
on:
pull_request:
branches:
- 3.x
jobs:
api-functional-test:
runs-on: "ubuntu-latest"
# Only run api tests on feature branches. Simple documentation updates, formatting can be ignored
if: contains(github.head_ref, 'feature')
name: ${{ matrix.job_title }}
strategy:
fail-fast: true
matrix:
magento:
[
"magento/project-community-edition:>=2.4.4 <2.4.5",
"magento/project-community-edition:>=2.4.5 <2.4.6",
"magento/project-community-edition:>=2.4.6 <2.4.7",
"magento/project-community-edition:>=2.4.7 <2.4.8",
]
include:
- magento: magento/project-community-edition:>=2.4.4 <2.4.5
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
job_title: "2.4.4"
- magento: magento/project-community-edition:>=2.4.5 <2.4.6
php: 8.1
composer: 2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.16.3"
rabbitmq: "rabbitmq:3.9-management"
redis: "redis:6.2"
job_title: "2.4.5"
- magento: magento/project-community-edition:>=2.4.6 <2.4.7
php: 8.2
composer: 2.2
mysql: "mysql:8.0"
elasticsearch: "elasticsearch:7.17.9"
rabbitmq: "rabbitmq:3.12-management"
redis: "redis:7.0"
job_title: "2.4.6"
- magento: magento/project-community-edition:>=2.4.7 <2.4.8
php: 8.3
composer: 2.7
mysql: "mariadb:10.6"
elasticsearch: "elasticsearch:7.17.9"
rabbitmq: "rabbitmq:3.12-management"
redis: "redis:7.2"
job_title: "2.4.7"
services:
elasticsearch:
image: ${{ matrix.elasticsearch }}
env:
discovery.type: single-node
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200
mysql:
image: ${{ matrix.mysql }}
env:
MYSQL_DATABASE: magento_functional_tests
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
rabbitmq:
image: ${{ matrix.rabbitmq }}
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
- 15672:15672
steps:
- uses: actions/checkout@v4
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:2
coverage: none
- run: composer create-project --repository-url="https://mirror.mage-os.org/" "${{ matrix.magento }}" ../magento2 --no-install
shell: bash
env:
COMPOSER_AUTH: ""
name: Create Magento ${{ matrix.magento }} Project
- uses: graycoreio/github-actions-magento2/get-magento-version@main
id: magento-version
with:
working-directory: "../magento2"
- name: Get Composer Cache Directory
shell: bash
working-directory: "../magento2"
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer Packages"
uses: actions/cache@v3
with:
key: "composer | v5 | '' | ${{ hashFiles('composer.lock') }}"
path: ${{ steps.composer-cache.outputs.dir }}
- run: composer config repositories.local path $GITHUB_WORKSPACE
name: Add Github Repo for Testing
working-directory: "../magento2"
shell: bash
- run: |
composer config --no-interaction allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer config --no-interaction allow-plugins.laminas/laminas-dependency-plugin true
composer config --no-interaction allow-plugins.magento/* true
name: Fixup Composer Plugins
working-directory: "../magento2"
- run: composer require aligent/async-events "@dev" --no-update && composer install
name: Require and attempt install
working-directory: "../magento2"
shell: bash
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
COMPOSER_AUTH: ${{ secrets.composer_auth }}
- name: Replace Configuration Settings for env
working-directory: ../magento2/dev/tests/api-functional
run: |
cp phpunit_rest.xml.dist phpunit_rest.xml
cp config/install-config-mysql.php.dist config/install-config-mysql.php
sed -i 's/name="TESTS_MAGENTO_INSTALLATION" value="disabled"/name="TESTS_MAGENTO_INSTALLATION" value="enabled"/' phpunit_rest.xml
sed -i 's#http://magento.url#http://127.0.0.1:8082/index.php/#' phpunit_rest.xml
sed -i 's/value="admin"/value="Test Webservice User"/' phpunit_rest.xml
sed -i 's/value="123123q"/value="Test Webservice API key"/' phpunit_rest.xml
sed -i "s,http://localhost/,http://127.0.0.1:8082/index.php/," config/install-config-mysql.php
sed -i "s/'db-host' => 'localhost'/'db-host' => '127.0.0.1'/" config/install-config-mysql.php
sed -i "s/'db-user' => 'root'/'db-user' => 'user'/" config/install-config-mysql.php
sed -i "s/'db-password' => ''/'db-password' => 'password'/" config/install-config-mysql.php
sed -i "s/'elasticsearch-host' => 'localhost'/'elasticsearch-host' => '127.0.0.1'/" config/install-config-mysql.php
- run: |
php -S 127.0.0.1:8082 -t ./pub/ ./phpserver/router.php &
sleep 5
vendor/bin/phpunit -c $(pwd)/dev/tests/api-functional/phpunit_rest.xml vendor/aligent/async-events/Test/Api
working-directory: ../magento2
name: Run API Functional Tests