Skip to content

Commit eb3afcf

Browse files
First attempt at integration tests
1 parent 5a7199d commit eb3afcf

File tree

1 file changed

+83
-6
lines changed

1 file changed

+83
-6
lines changed

.circleci/config.yml

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ executors:
99
image: ubuntu-2404:2024.11.1
1010
docker_layer_caching: true
1111

12-
jobs:
13-
magento-build:
14-
executor:
15-
name: magento-executor
12+
commands:
13+
setup-magento-environment:
14+
description: "Setup Magento environment with common configuration"
1615
parameters:
1716
php-version:
1817
type: string
@@ -32,8 +31,6 @@ jobs:
3231
name: Setup folder structure and override file
3332
command: |
3433
mkdir ~/Sites
35-
mkdir ~/Sites/unit-tests
36-
mkdir ~/Sites/unit-coverage
3734
cd ~/Sites
3835
cat \<<EOF > compose.override.yml
3936
services:
@@ -64,6 +61,29 @@ jobs:
6461
command: |
6562
bin/magento setup:di:compile
6663
bin/magento module:status Algolia_AlgoliaSearch
64+
65+
jobs:
66+
magento-build:
67+
executor:
68+
name: magento-executor
69+
parameters:
70+
php-version:
71+
type: string
72+
magento-version:
73+
type: string
74+
steps:
75+
- setup-magento-environment:
76+
php-version: << parameters.php-version >>
77+
magento-version: << parameters.magento-version >>
78+
- run:
79+
name: Create test directories
80+
command: |
81+
mkdir ~/Sites/unit-tests
82+
mkdir ~/Sites/unit-coverage
83+
- persist_to_workspace:
84+
root: ~/Sites
85+
paths:
86+
- .
6787
- run:
6888
name: Run Unit Tests and copy results to CircleCI
6989
working_directory: ~/Sites
@@ -89,6 +109,55 @@ jobs:
89109
path: ~/Sites/unit-coverage/report
90110
destination: test-results/magento-<< parameters.magento-version >>-php-<< parameters.php-version >>
91111

112+
magento-integration-test:
113+
executor:
114+
name: magento-executor
115+
parameters:
116+
php-version:
117+
type: string
118+
magento-version:
119+
type: string
120+
steps:
121+
- setup-magento-environment:
122+
php-version: << parameters.php-version >>
123+
magento-version: << parameters.magento-version >>
124+
- run:
125+
name: Configure integration tests
126+
working_directory: ~/Sites
127+
command: |
128+
bin/cli dev/tests/integration/phpunit.xml.dist dev/tests/integration/phpunit.xml
129+
- run:
130+
name: Create integration test environment file
131+
working_directory: ~/Sites
132+
command: |
133+
cat > dev/tests/integration/.env << 'EOF'
134+
135+
MAGENTO_ADMIN_FIRST_NAME=john
136+
MAGENTO_ADMIN_LAST_NAME=smith
137+
MAGENTO_ADMIN_USER=john.smith
138+
MAGENTO_ADMIN_PASSWORD=password123
139+
MAGENTO_ADMIN_FRONTNAME=admin
140+
MAGENTO_LOCALE=en_US
141+
MAGENTO_CURRENCY=USD
142+
MAGENTO_TIMEZONE=America/New_York
143+
ALGOLIA_APPLICATION_ID=TEST123
144+
ALGOLIA_SEARCH_KEY_1=TEST123
145+
ALGOLIA_API_KEY=TEST123
146+
INDEX_PREFIX=TEST123
147+
EOF
148+
docker cp dev/tests/integration/.env $(docker compose ps -q phpfpm):/var/www/html/dev/tests/integration/.env
149+
- run:
150+
name: Apply environment variables
151+
working_directory: ~/Sites
152+
command: |
153+
bin/cli cd ./dev/tests/integration
154+
bin/cli export $(cat .env | xargs)
155+
- run:
156+
name: Run Integration Tests
157+
working_directory: ~/Sites
158+
command: |
159+
bin/dev-test-run integration --debug /var/www/html/app/code/Algolia/AlgoliaSearch/Test/Integration/
160+
92161
workflows:
93162
magento-build-and-test-workflow:
94163
jobs:
@@ -97,3 +166,11 @@ workflows:
97166
parameters:
98167
php-version: ["8.2"]
99168
magento-version: ["2.4.6-p11", "2.4.7-p6"]
169+
- magento-integration-test:
170+
matrix:
171+
parameters:
172+
php-version: ["8.2"]
173+
magento-version: ["2.4.6-p11", "2.4.7-p6"]
174+
filters:
175+
branches:
176+
only: chore/MAGE-1368-add-integration-tests-circleci

0 commit comments

Comments
 (0)